JuliaHomotopyContinuation / HomotopyContinuation.jl

A Julia package for solving systems of polynomials via homotopy continuation.
https://www.JuliaHomotopyContinuation.org
MIT License
178 stars 30 forks source link

Error in "Sampling and Homology via Bottlenecks" #505

Closed danielplatt closed 2 years ago

danielplatt commented 2 years ago

When trying to run the code from https://www.juliahomotopycontinuation.org/examples/sampling_bottlenecks/ I get an error in the line S_p₀ = solutions(solve(subs(Ft, [y; p[1:l]] => p₀))), namely: ERROR: UndefVarError: l not defined.

What's the problem and how can it be fixed?

PBrdng commented 2 years ago

Hi,

first of all: Thanks, for trying out our package :)

This code was written by Oliver Gäfvert, so I don't know exactly what it does. I will send him an email asking if he could at your error.

PBrdng commented 2 years ago

@danielplatt I have not heard back from Oliver, unfortunately.

This morning I had some time to look at the code and fixed the problem. Can you check if it works for you now?

danielplatt commented 2 years ago

@PBrdng Thanks! For which version is this code now? When running it, the line result = solve(system) gives me the error:

ERROR: ArgumentError: `variable_ordering = ...` needs to be passed as a keyword argument to indicate the order of the variables.
Stacktrace:
 [1] input_startsolutions(::Vector{HomotopyContinuation.ModelKit.Operation}; variable_ordering::Nothing, parameters::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/mJDHb/src/input.jl:150
 [2] problem_startsolutions(args::Any; seed::Any, variable_ordering::Any, kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/mJDHb/src/problems.jl:367
 [3] problem_startsolutions
   @ ~/.julia/packages/HomotopyContinuation/mJDHb/src/problems.jl:365 [inlined]
 [4] solver_startsolutions(args::Vector{HomotopyContinuation.ModelKit.Operation}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/mJDHb/src/solver.jl:124
 [5] solver_startsolutions
   @ ~/.julia/packages/HomotopyContinuation/mJDHb/src/solver.jl:123 [inlined]
 [6] solve(args::Vector{HomotopyContinuation.ModelKit.Operation}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/mJDHb/src/solver.jl:540
 [7] solve(args::Vector{HomotopyContinuation.ModelKit.Operation})
   @ HomotopyContinuation ~/.julia/packages/HomotopyContinuation/mJDHb/src/solver.jl:539
 [8] top-level scope
   @ REPL[17]:1

My packages and their versions are:

(@v1.7) pkg> status
      Status `~/.julia/environments/v1.7/Project.toml`
  [7c1d4256] DynamicPolynomials v0.3.21
  [9c0f25c4] Eirene v1.3.5
  [f213a82b] HomotopyContinuation v1.4.4
  [7073ff75] IJulia v1.23.3
  [c8e1da08] IterTools v1.4.0
  [f0f68f2c] PlotlyJS v0.14.1
  [91a5bcdd] Plots v1.6.8

I use the old version HomotopyContinuation v1.4.4 because it was recommended for another piece of code, but not specifically for this example.

PBrdng commented 2 years ago

I use Julia 1.7.2 and HomotopyContinuation.jl 2.6.4.

danielplatt commented 2 years ago

Thanks! Can you add using Plots before

scatter(sample_matrix[1,:], sample_matrix[2,:],
        legend = false)

Then that code works perfectly for me. Other users may benefit from the information that this was tested with Julia 1.7.2 and HomotopyContinuation.jl 2.6.4.

PBrdng commented 2 years ago

Good point. I added the using Plots. Thanks! :)

Where exactly is the information that one should a version different than the most recent one?

danielplatt commented 2 years ago

"Where exactly is the information that one should a version different than the most recent one?" Oliver advised me to do this via email. But that was pertaining to a different piece of code that used an old function (pathfinder? I'm not sure anymore). So, he never said anything wrong, and I believe there is no published info saying to use an old version to run the code on the website.

Writing down the version number was just an idea to make that website future proof, in case any of the packages discontinue one of the functions used.

PBrdng commented 2 years ago

I see. This is a good point. I'll think about how to implement it. Thanks!

Can I close this issue then?

danielplatt commented 2 years ago

Yes, the issue can be closed. Thank you very much for all your help!