I am a casual/academic user of optimization with Julia/JuMP, and I noticed there is the possibility to include initial solution setting the function set_start_value, but I just want to set initially some variables of my whole model. I use Gurobi with solver, and the bellow code is the part that I added the start values:
for i in 1:n for j in 1:m set_start_value(X[i,j], XFITSP[i,j]) set_start_value(Y[i,j], YFITSP[i,j]) end end tempo = time() status = optimize!(modelo) tempo = time() - tempo
My model has 3 group of variables: X, Y and W. If I listed only two groups, it returned this error:
Academic license - for non-commercial use only
Academic license - for non-commercial use only
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
Warning, invalid warm-start basis discarded
ERROR: LoadError: MathOptInterface.SetAttributeNotAllowed{MathOptInterface.VariablePrimalStart}: Setting attribute MathOptInterface.VariablePrimalStart() cannot be performed. You may want to use aCachingOptimizer
inAUTOMATIC
mode or you may need to callreset_optimizer
before doing this operation if theCachingOptimizer
is inMANUAL
mode.
Stacktrace:
[1] #throw_set_error_fallback#13(::MathOptInterface.SetAttributeNotAllowed{MathOptInterface.VariablePrimalStart}, ::Function, ::Gurobi.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Nothing) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\attributes.jl:318
[2] throw_set_error_fallback(::Gurobi.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Nothing) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\attributes.jl:317
[3] set(::Gurobi.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Nothing) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\attributes.jl:295
[4] _broadcast_getindex_evalf at .\broadcast.jl:578 [inlined]
[5] _broadcast_getindex at .\broadcast.jl:551 [inlined]
[6] getindex at .\broadcast.jl:511 [inlined]
[7] macro expansion at .\broadcast.jl:843 [inlined]
[8] macro expansion at .\simdloop.jl:73 [inlined]
[9] copyto! at .\broadcast.jl:842 [inlined]
[10] copyto! at .\broadcast.jl:797 [inlined]
[11] copy at .\broadcast.jl:773 [inlined]
[12] materialize at .\broadcast.jl:753 [inlined]
[13] set(::Gurobi.Optimizer, ::MathOptInterface.VariablePrimalStart, ::Array{MathOptInterface.VariableIndex,1}, ::Array{Union{Nothing, Float64},1}) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\attributes.jl:291
[14] set(::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.VariablePrimalStart, ::Array{MathOptInterface.VariableIndex,1}, ::Array{Union{Nothing, Float64},1}) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Bridges\bridgeoptimizer.jl:222
[15] _pass_attributes(::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{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 C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\copy.jl:141
[16] pass_attributes at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\copy.jl:111 [inlined]
[17] pass_attributes at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\copy.jl:109 [inlined]
[18] default_copy_to(::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}, ::Bool) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\copy.jl:192
[19] #automatic_copy_to#61 at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\copy.jl:15 [inlined]
[20] #automatic_copy_to at .\none:0 [inlined]
[21] #copy_to#1 at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Bridges\bridgeoptimizer.jl:91 [inlined]
[22] (::getfield(MathOptInterface, Symbol(“#kw##copy_to”)))(::NamedTuple{(:copy_names,),Tuple{Bool}}, ::typeof(MathOptInterface.copy_to), ::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, ::MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}) at .\none:0
[23] attach_optimizer(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\cachingoptimizer.jl:130
[24] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}}) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\MathOptInterface\C3lip\src\Utilities\cachingoptimizer.jl:166
[25] #optimize!#79(::Bool, ::Bool, ::Function, ::Model, ::Nothing) at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\JuMP\ibcEh\src\optimizer_interface.jl:132
[26] optimize! at C:\Users\Miguel.juliapro\JuliaPro_v1.1.1.1\packages\JuMP\ibcEh\src\optimizer_interface.jl:105 [inlined] (repeats 2 times)
[27] top-level scope at none:0
in expression starting at C:\Users\Miguel\Documents\model.jl:110
If I include the third group of variable W, it didn’t return any error, just the warning “Warning, invalid warm-start basis discarded” and the solution without any initial solution. I already read the topic Warning, invalid warm-start basis discarded , but I didn’t understand how i can fix this situation. Furthermore, i have a friend with a similar code that tested in his computer and had suscess
I doing correctly?