JuliaHomotopyContinuation / HomotopyContinuation.jl

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

AssertionError b ≥ 0 during solve #408

Closed benlorenz closed 3 years ago

benlorenz commented 3 years ago

I was trying to follow the Oscar Wronski Polynomial tutorial and ran into the following error:

(hc) pkg> st
Status `/tmp/hc/Project.toml`
  [7c1d4256] DynamicPolynomials v0.3.13
  [f213a82b] HomotopyContinuation v2.0.7

julia> using HomotopyContinuation
julia> using DynamicPolynomials

julia> @polyvar x₁ x₂ s
(x₁, x₂, s)

julia> HC_I = DynamicPolynomials.Polynomial{true,Int64}[x₁^3*s^15 + x₁*x₂*s + x₂^3 + s^12, x₁^2*s^9 + x₁*x₂^2 + x₂*s^3, x₁^2*x₂*s^5 + x₁*s^8 + x₂^2]
3-element Array{Polynomial{true,Int64},1}:
 x₁³s¹⁵ + s¹² + x₁x₂s + x₂³
 x₁²s⁹ + x₂s³ + x₁x₂²
 x₁s⁸ + x₁²x₂s⁵ + x₂²

julia> res = HomotopyContinuation.solve(HC_I; start_system = :polyhedral, only_torus = true)
ERROR: AssertionError: b ≥ 0
Stacktrace:
 [1] pow!(::HomotopyContinuation.ModelKit.InstructionList, ::Any, ::Int64) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/model_kit/instructions.jl:90
 [2] diff!(::HomotopyContinuation.ModelKit.InstructionList, ::Int64, ::HomotopyContinuation.ModelKit.DiffMap) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/model_kit/instructions.jl:187
 [3] diff(::HomotopyContinuation.ModelKit.InstructionList, ::Array{Symbol,1}, ::Array{Symbol,1}) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/model_kit/instructions.jl:159
 [4] _evaluate_and_jacobian!_impl(::Type{CompiledSystem{(0x12a7c573e8e73766, 1)}}) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/model_kit/compiler.jl:124
 [5] #s142#151 at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/model_kit/compiled.jl:215 [inlined]
 [6] #s142#151(::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at ./none:0
 [7] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:527
 [8] evaluate_and_jacobian! at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/homotopies/toric_homotopy.jl:208 [inlined]
 [9] init!(::Tracker{HomotopyContinuation.ToricHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},HomotopyContinuation.AD{1},Array{Complex{Float64},2}}, ::Array{Complex{Float64},1}, ::Float64, ::Float64; ω::Float64, μ::Float64, τ::Float64, max_initial_step_size::Float64, keep_steps::Bool, extended_precision::Bool) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/tracker.jl:705
 [10] #track!#121 at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/tracker.jl:892 [inlined]
 [11] track(::PolyhedralTracker{HomotopyContinuation.ToricHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},CoefficientHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},HomotopyContinuation.AD{1},Array{Complex{Float64},2}}, ::Tuple{MixedSubdivisions.MixedCell,Array{Complex{Float64},1}}; path_number::Int64, debug::Bool) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/polyhedral.jl:384
 [12] serial_solve(::Solver{PolyhedralTracker{HomotopyContinuation.ToricHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},CoefficientHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},HomotopyContinuation.AD{1},Array{Complex{Float64},2}}}, ::Array{Tuple{MixedSubdivisions.MixedCell,Array{Complex{Float64},1}},1}, ::ProgressMeter.Progress, ::typeof(HomotopyContinuation.always_false); catch_interrupt::Bool) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/solve.jl:566
 [13] solve(::Solver{PolyhedralTracker{HomotopyContinuation.ToricHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},CoefficientHomotopy{CompiledSystem{(0x12a7c573e8e73766, 1)}},HomotopyContinuation.AD{1},Array{Complex{Float64},2}}}, ::Array{Tuple{MixedSubdivisions.MixedCell,Array{Complex{Float64},1}},1}; stop_early_cb::Function, show_progress::Bool, threading::Bool, catch_interrupt::Bool) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/solve.jl:520
 [14] #solve#275 at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/solve.jl:499 [inlined]
 [15] solve(::Array{Polynomial{true,Int64},1}; show_progress::Bool, threading::Bool, catch_interrupt::Bool, target_parameters::Nothing, stop_early_cb::Function, transform_result::Nothing, transform_parameters::typeof(identity), flatten::Nothing, target_subspaces::Nothing, kwargs::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:start_system, :only_torus),Tuple{Symbol,Bool}}}) at /home/lorenz/.julia/packages/HomotopyContinuation/Mpo5H/src/solve.jl:485
 [16] top-level scope at REPL[9]:1

Any ideas or recommendations? The set of polynomials is exactly the one from the tutorial.

saschatimme commented 3 years ago

Thanks for the bug report! I just tagged a 2.0.8 release which should fix this :)