You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a model with parameters whose initial values are NaN seems to break the model, even if those parameters are changed to non-NaN before any call to solve!. For example:
# Set up the model
m =Model(OSQP.Optimizer())
# Create an externally-controlled value. This is initially NaN, but# we will set it to non-NaN later
outer_value =Ref(NaN)
# Create a parameter which just reads from our outer value
param =Parameter(m) do
outer_value[]
end# Constrain that the variable x == param. At this point, outer_value[] == NaN
x =Variable(m)
@constraint m x == param
# Fix our outer_value so that it is non-NaN
outer_value[] =1.0# Solve. All the parameters are now non-NaN, but the solver still fails:solve!(m)
objectivevalue(m)
gives an objective value of NaN.
Moving the outer_value[] = 1.0 to before the call to @constraint fixes the problem, but shouldn't be necessary as far as I know.
The text was updated successfully, but these errors were encountered:
So the same thing also happens for Gurobi, and it looks like both OSQP.jl and LinQuadOptInterface.jl have essentially the same bug. The problem is that a difference between the current and new value of the right-hand side is computed, so if the old value is NaN you run into trouble.
Creating a model with parameters whose initial values are
NaN
seems to break the model, even if those parameters are changed to non-NaN before any call tosolve!
. For example:gives an objective value of
NaN
.Moving the
outer_value[] = 1.0
to before the call to@constraint
fixes the problem, but shouldn't be necessary as far as I know.The text was updated successfully, but these errors were encountered: