Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial values for primal variables #155

Closed
ambyld opened this issue Jan 8, 2019 · 1 comment
Closed

Initial values for primal variables #155

ambyld opened this issue Jan 8, 2019 · 1 comment

Comments

@ambyld
Copy link

ambyld commented Jan 8, 2019

It doesn't yet seem to be possible to warm-start primal variables. For example, the following code:

solver_model = JuMP.Model(with_optimizer(Ipopt.Optimizer))
@variable(solver_model, x[1:2])
@constraint(solver_model, x .>= 0.)
@objective(solver_model, Min, x[1]+x[2])
set_start_value(x[1], 1.0)
JuMP.optimize!(solver_model)

Results in:

MathOptInterface.SetAttributeNotAllowed{MathOptInterface.VariablePrimalStart}: Setting attribute MathOptInterface.VariablePrimalStart() cannot be performed. You may want to use a `CachingOptimizer` in `AUTOMATIC` mode or you may need to call `resetoptimizer!` before doing this operation if the `CachingOptimizer` is in `MANUAL` mode.

Stacktrace:
 [1] #throw_set_error_fallback#13(::MathOptInterface.SetAttributeNotAllowed{MathOptInterface.VariablePrimalStart}, ::Function, ::Ipopt.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Nothing) at /home/bylard/.julia/dev/MathOptInterface/src/attributes.jl:312
 [2] throw_set_error_fallback(::Ipopt.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Nothing) at /home/bylard/.julia/dev/MathOptInterface/src/attributes.jl:311
 [3] set(::Ipopt.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Nothing) at /home/bylard/.julia/dev/MathOptInterface/src/attributes.jl:289
 [4] _broadcast_getindex_evalf at ./broadcast.jl:574 [inlined]
 [5] _broadcast_getindex at ./broadcast.jl:547 [inlined]
 [6] getindex at ./broadcast.jl:507 [inlined]
 [7] macro expansion at ./broadcast.jl:814 [inlined]
 [8] macro expansion at ./simdloop.jl:73 [inlined]
 [9] copyto! at ./broadcast.jl:813 [inlined]
 [10] copyto! at ./broadcast.jl:768 [inlined]
 [11] copy at ./broadcast.jl:744 [inlined]
 [12] materialize at ./broadcast.jl:724 [inlined]
 [13] set(::Ipopt.Optimizer, ::MathOptInterface.VariablePrimalStart, ::Array{MathOptInterface.VariableIndex,1}, ::Array{Union{Nothing, Float64},1}) at /home/bylard/.julia/dev/MathOptInterface/src/attributes.jl:285
 [14] _pass_attributes(::Ipopt.Optimizer, ::MathOptInterface.Utilities.UniversalFallback{JuMP.JuMPMOIModel{Float64}}, ::Bool, ::MathOptInterface.Utilities.IndexMap, ::Array{MathOptInterface.AbstractVariableAttribute,1}, ::Tuple{DataType}, ::Tuple{Array{MathOptInterface.VariableIndex,1}}, ::Tuple{Array{MathOptInterface.VariableIndex,1}}, ::typeof(MathOptInterface.set)) at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/copy.jl:127
 [15] pass_attributes at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/copy.jl:111 [inlined]
 [16] pass_attributes at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/copy.jl:109 [inlined]
 [17] default_copy_to(::Ipopt.Optimizer, ::MathOptInterface.Utilities.UniversalFallback{JuMP.JuMPMOIModel{Float64}}, ::Bool) at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/copy.jl:179
 [18] #copy_to#12 at /home/bylard/.julia/packages/Ipopt/OLtKb/src/MOI_wrapper.jl:72 [inlined]
 [19] #copy_to at ./none:0 [inlined]
 [20] attach_optimizer(::MathOptInterface.Utilities.CachingOptimizer{Ipopt.Optimizer,MathOptInterface.Utilities.UniversalFallback{JuMP.JuMPMOIModel{Float64}}}) at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/cachingoptimizer.jl:125
 [21] optimize!(::MathOptInterface.Utilities.CachingOptimizer{Ipopt.Optimizer,MathOptInterface.Utilities.UniversalFallback{JuMP.JuMPMOIModel{Float64}}}) at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/cachingoptimizer.jl:161
 [22] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{Ipopt.Optimizer,MathOptInterface.Utilities.UniversalFallback{JuMP.JuMPMOIModel{Float64}}},MathOptInterface.Bridges.AllBridgedConstraints{Float64}}) at /home/bylard/.julia/dev/MathOptInterface/src/Bridges/bridgeoptimizer.jl:73
 [23] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP.JuMPMOIModel{Float64}}}) at /home/bylard/.julia/dev/MathOptInterface/src/Utilities/cachingoptimizer.jl:165
 [24] #optimize!#77(::Bool, ::Bool, ::Function, ::Model, ::Nothing) at /home/bylard/.julia/packages/JuMP/MuwSj/src/optimizer_interface.jl:124
 [25] optimize! at /home/bylard/.julia/packages/JuMP/MuwSj/src/optimizer_interface.jl:101 [inlined] (repeats 2 times)
 [26] top-level scope at In[9]:6
@mlubin
Copy link
Member

mlubin commented Jan 8, 2019

Thanks for the report. This is a bug somewhere in the MOI interface. It works correctly if you set a start value for all variables in the model.
@blegat

mlubin added a commit that referenced this issue Jan 12, 2019
mlubin added a commit that referenced this issue Jan 29, 2019
* Accept nothing for VariablePrimalStart

Closes #155

* need UniversalFallback to pass the test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants