Failure to evaluate numerical expression
baggepinnen opened this issue · 1 comments
I get results like
julia> HomotopyContinuation.evaluate(constraints, (Dict(f.variables .=> real.(sol))))
8-element Vector{Expression}:
-1.77635683940025e-15*-0.235475
-0.929620778338419*-0.222360917086043
-3.00918102352667*-0.198144357487694
-8.44189647517252*-0.1555001812606
-28.9660551738096*-0.0884901134798353
-276.162595297163*-0.0162316466214997
-70.7686049843743*-0.0896340387513346
-2.98369032774388*-1.025
which seems strange, why wouldn't this return numerical values?
The array of constraints
looks like this
ulia> constraints
8-element Vector{Expression}:
-0.235475*(-4.24673532222104*(0.1 + 1.0*a0₀^2) + 1.0*b₀^2)
-0.222360917086043*(-4.49719318081895*(0.193069772888325 + 1.0*a0₀^2) + 1.0*b₀^2)
-0.198144357487694*(-5.04682551993491*(0.372759372031494 + 1.0*a0₀^2) + 1.0*b₀^2)
-0.1555001812606*(-6.43086067098607*(0.719685673001152 + 1.0*a0₀^2) + 1.0*b₀^2)
-0.0884901134798353*(-11.300697452805*(1.38949549437314 + 1.0*a0₀^2) + 1.0*b₀^2)
-0.0162316466214997*(-61.6080440462182*(2.68269579527973 + 1.0*a0₀^2) + 1.0*b₀^2)
-0.0896340387513346*(-11.1564759764338*(5.17947467923121 + 1.0*a0₀^2) + 1.0*b₀^2)
-1.025*(-0.975609756097561*(10.0 + 1.0*a0₀^2) + 1.0*b₀^2)
and the parameters were created like this
na = 1
nb = 0
@var a0[0:na-1] b[0:nb]
I'm trying to solve a QCQP but where the constraints is in the wrong (non-convex) direction, and get the correct results sometimes but not always, I wonder if it's related to my problem setup that causes some internal confusion that leads to expressions like the first one above?
This should in principle evaluate to floats and not expressions but there seems to be a specialization for dicts as input missing.
You can first convert to a System
before evaluating it (https://www.juliahomotopycontinuation.org/HomotopyContinuation.jl/stable/model_kit/#HomotopyContinuation.ModelKit.System).
I am also happy to look at your specific QCQP problem if your problem persists