Skip to content

Initial values for primal variables #155

@ambyld

Description

@ambyld

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions