Hi and welcome @Aida_Khajavirad
Yeah, as mentioned above some solver do not support initial values for variables. e.g. for GLPK If we call set_start_value
before optimize!
we only have a warning:
using JuMP, GLPK
model = Model(GLPK.Optimizer)
@variable(model, 0 <= x <= 2)
@variable(model, 0 <= y <= 30)
@objective(model, Max, 5x + 3 * y)
@constraint(model, con, 1x + 5y <= 3)
JuMP.set_start_value(all_variables(model)[1],1.5)
optimize!(model)
┌ Warning: MathOptInterface.VariablePrimalStart() is not supported by
MathOptInterface.Bridges.LazyBridgeOptimizer{GLPK.Optimizer}.
This information will be discarded.
However, if we have already optimized our model and we try to use set_start_value
again, we have the error you describe:
optimize!(model)
JuMP.set_start_value(all_variables(model)[1],1.5)
ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterfac
One solver you can try if you need to use set_start_value
is Ipopt.
using JuMP, Ipopt
model = Model(Ipopt.Optimizer)
@variable(model, 0 <= x <= 2)
@variable(model, 0 <= y <= 30)
@objective(model, Max, 5x + 3 * y)
@constraint(model, con, 1x + 5y <= 3)
JuMP.set_start_value(all_variables(model)[1],1.5)
optimize!(model)
julia> optimize!(model)
This is Ipopt version 3.13.4, running with linear solver mumps.
NOTE: Other linear solvers might be more efficient
(see Ipopt documentation).
Number of nonzeros in equality constraint Jacobian...: 0
Number of nonzeros in inequality constraint Jacobian.: 2
Number of nonzeros in Lagrangian Hessian.............: 0
However it nicely warns you that “Other linear solvers might be more efficient (see Ipopt documentation).”
I have never used initial values for LP problems though since solvers are so efficient at it, I would like also to know if initial values are common for LP as they are for NLP.