lanl-ansi / PowerModels.jl

A Julia/JuMP Package for Power Network Optimization
https://lanl-ansi.github.io/PowerModels.jl/stable/
Other
388 stars 145 forks source link

VariablePrimalStart ERROR #477

Closed andrewrosemberg closed 5 years ago

andrewrosemberg commented 5 years ago

Hi,

I'm using the moi-2 branch and I'm trying to run the following command:

pm = PowerModels.build_generic_model(case, 
                                                                  DCPPowerModel, 
                                                                  PowerModels.post_opf, 
                                                                  jump_model=Model(with_optimizer(Clp.Optimizer)), 
                                                                  setting = Dict("output" => Dict("branch_flows" => true)))

But I'm getting the following error:

ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterface.VariablePrimalStart}: Attribute MathOptInterface.VariablePrimalStart() is not supported by the model.

Does anyone have encountered the same problem? Is there a way to disable VariablePrimalStart parameter?

Thank you for the help in advance!

jd-lara commented 5 years ago

This is a problem in your version ofClp.jl that doesn't support warm starts, try with GLPK.

andrewrosemberg commented 5 years ago

This is a problem in your version ofClp.jl that doesn't support warm starts, try with GLPK.

@jd-lara GLPK gives the same problem unfortunately.

jd-lara commented 5 years ago

This is a problem in your version ofClp.jl that doesn't support warm starts, try with GLPK.

@jd-lara GLPK gives the same problem unfortunately.

Which version of GLPK.jl are you using? In GLPK v0.9.1 it should throw a warning

andrewrosemberg commented 5 years ago

This is a problem in your version ofClp.jl that doesn't support warm starts, try with GLPK.

@jd-lara GLPK gives the same problem unfortunately.

Which version of GLPK.jl are you using? In GLPK v0.9.1 it should throw a warning

I'm using GLPK v0.9.1:

Status `~/.julia/dev/HydroPowerModels/Project.toml`
  [336ed68f]   CSV v0.4.3
  [e2554f3b]   Clp v0.6.1
  [31a5f54b]   Debugger v0.2.2
  [60bf3e95] + GLPK v0.9.1
  [682c06a0]   JSON v0.20.0
  [4076af6c]   JuMP v0.19.0
  [f4570300]   MathOptFormat v0.0.0 #master (https://github.com/odow/MathOptFormat.jl)
  [91a5bcdd]   Plots v0.19.3
  [c36e90e8]   PowerModels v0.9.4 #moi-2 (https://github.com/lanl-ansi/PowerModels.jl.git)
  [189a3867]   Reexport v0.2.0
  [f4570300]   SDDP v0.0.0 #master (https://github.com/odow/SDDP.jl)
  [44d3d7a6]   Weave v0.6.2
jd-lara commented 5 years ago

@andrewrosemberg check your Manifest.TOML and make sure that your InfrastructureModels version is also set to branch moi-2 you should be getting this warning

┌ Warning: MathOptInterface.VariablePrimalStart() is not supported by MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{SCS.Optimizer,MathOptInterface.Utilities.UniversalFallback{JuMP._MOIModel{Float64}}},MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}. This 
│   information will be discarded. = "information will be discarded."
└ @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:133
ccoffrin commented 5 years ago

@jd-lara's assessment seem right. Any luck with the fix @andrewrosemberg?

andrewrosemberg commented 5 years ago

Hi, I have set the InfrastructureModels to moi-2 but I'm still getting the error. My current error and stacktrace:

ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterface.VariablePrimalStart}: Attribute MathOptInterface.VariablePrimalStart() is not supported by the model.
Stacktrace:
 [1] set(::GLPK.Optimizer, ::MathOptInterface.VariablePrimalStart, ::Array{MathOptInterface.VariableIndex,1}, ::Array{Float64,1}) at /home/andrew/.julia/packages/LinQuadOptInterface/ZMx9f/src/variables.jl:211
 [2] set(::GLPK.Optimizer, ::MathOptInterface.VariablePrimalStart, ::MathOptInterface.VariableIndex, ::Float64) at /home/andrew/.julia/packages/LinQuadOptInterface/ZMx9f/src/variables.jl:218
 [3] set(::Model, ::MathOptInterface.VariablePrimalStart, ::VariableRef, ::Float64) at /home/andrew/.julia/packages/JuMP/jnmGG/src/JuMP.jl:625
 [4] set_start_value at /home/andrew/.julia/packages/JuMP/jnmGG/src/variables.jl:710 [inlined]
 [5] add_variable(::Model, ::ScalarVariable{Float64,Float64,Float64,Float64}, ::String) at /home/andrew/.julia/packages/JuMP/jnmGG/src/variables.jl:760
 [6] macro expansion at /home/andrew/.julia/packages/JuMP/jnmGG/src/macros.jl:177 [inlined]
 [7] #variable_voltage_angle#228(::Int64, ::Int64, ::Bool, ::Function, ::GenericPowerModel{DCPlosslessForm}) at /home/andrew/.julia/packages/PowerModels/nIvjv/src/core/variable.jl:18
 [8] variable_voltage_angle at /home/andrew/.julia/packages/PowerModels/nIvjv/src/core/variable.jl:18 [inlined]
 [9] #variable_voltage#467 at /home/andrew/.julia/packages/PowerModels/nIvjv/src/form/dcp.jl:8 [inlined]
 [10] variable_voltage at /home/andrew/.julia/packages/PowerModels/nIvjv/src/form/dcp.jl:8 [inlined]
 [11] post_opf(::GenericPowerModel{DCPlosslessForm}) at /home/andrew/.julia/packages/PowerModels/nIvjv/src/prob/opf.jl:20
 [12] #build_generic_model#131(::Bool, ::Bool, ::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:jump_model, :setting),Tuple{Model,Dict{String,Dict{String,Bool}}}}}, ::Function, ::Dict{String,Any}, ::Type, ::typeof(PowerModels.post_opf)) at /home/andrew/.julia/packages/PowerModels/nIvjv/src/core/base.jl:220
 [13] (::getfield(PowerModels, Symbol("#kw##build_generic_model")))(::NamedTuple{(:jump_model, :setting),Tuple{Model,Dict{String,Dict{String,Bool}}}}, ::typeof(build_generic_model), ::Dict{String,Any}, ::Type, ::Function) at ./none:0
 [14] (::getfield(HydroPowerModels, Symbol("##71#73")){Array{Dict{Any,Any},1},Dict{Any,Any}})(::Model, ::Int64) at /home/andrew/.julia/dev/HydroPowerModels/src/HydroPowerModels.jl:45
 [15] #PolicyGraph#8(::Symbol, ::Nothing, ::Float64, ::Float64, ::OptimizerFactory, ::Bool, ::Type, ::getfield(HydroPowerModels, Symbol("##71#73")){Array{Dict{Any,Any},1},Dict{Any,Any}}, ::SDDP.Graph{Int64}) at /home/andrew/.julia/packages/SDDP/79Uum/src/user_interface.jl:364
 [16] (::getfield(Core, Symbol("#kw#Type")))(::NamedTuple{(:sense, :optimizer, :lower_bound),Tuple{Symbol,OptimizerFactory,Float64}}, ::Type{SDDP.PolicyGraph}, ::Function, ::SDDP.Graph{Int64}) at ./none:0
 [17] #LinearPolicyGraph#6 at /home/andrew/.julia/packages/SDDP/79Uum/src/user_interface.jl:274 [inlined]
 [18] (::getfield(SDDP, Symbol("#kw##LinearPolicyGraph")))(::NamedTuple{(:sense, :stages, :optimizer, :lower_bound),Tuple{Symbol,Int64,OptimizerFactory,Float64}}, ::typeof(SDDP.LinearPolicyGraph), ::Function) at ./none:0
 [19] hydrothermaloperation(::Array{Dict{Any,Any},1}, ::Dict{Any,Any}) at /home/andrew/.julia/dev/HydroPowerModels/src/HydroPowerModels.jl:26
 [20] top-level scope at none:0

Thanks again for the help.

andrewrosemberg commented 5 years ago

Hello Guys, Found out the cause of this error: The package I was using to create the model (SDDP) created a direct_model, which doesn't allow 'Variable Primal Start', by default. To solve it disabled the direct_model option. Is there a way to pass a direct_model to PowerModels ?

If you agree, I will close this issue! Thanks again for the help.