ds4dm / Tulip.jl

Interior-point solver in pure Julia
Other
154 stars 20 forks source link

Error when calling `solution_summary()` #110

Closed ketch closed 2 years ago

ketch commented 2 years ago

I'm using Tulip via JuMP. I'm able to set up and solve a model, but I'm not sure how to see the solution. When I call

solution_summary(model)

I get the following:

ArgumentError: ModelLike of type Tulip.Optimizer{Float64} does not support accessing the attribute MathOptInterface.RawStatusString()

Stacktrace:
  [1] get_fallback(::Tulip.Optimizer{Float64}, ::MathOptInterface.RawStatusString)
    @ MathOptInterface ~/.julia/packages/MathOptInterface/YDdD3/src/attributes.jl:296
  [2] get(::Tulip.Optimizer{Float64}, ::MathOptInterface.RawStatusString)
    @ MathOptInterface ~/.julia/packages/MathOptInterface/YDdD3/src/attributes.jl:293
  [3] get(b::MathOptInterface.Bridges.LazyBridgeOptimizer{Tulip.Optimizer{Float64}}, attr::MathOptInterface.RawStatusString)
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:804
  [4] get(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, attr::MathOptInterface.RawStatusString)
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/YDdD3/src/Utilities/cachingoptimizer.jl:716
  [5] _moi_get_result(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, args::MathOptInterface.RawStatusString)
    @ JuMP ~/.julia/packages/JuMP/klrjG/src/JuMP.jl:1199
  [6] get(model::Model, attr::MathOptInterface.RawStatusString)
    @ JuMP ~/.julia/packages/JuMP/klrjG/src/JuMP.jl:1212
  [7] raw_status
    @ ~/.julia/packages/JuMP/klrjG/src/JuMP.jl:765 [inlined]
  [8] solution_summary(model::Model; verbose::Bool)
    @ JuMP ~/.julia/packages/JuMP/klrjG/src/print.jl:463
  [9] solution_summary(model::Model)
    @ JuMP ~/.julia/packages/JuMP/klrjG/src/print.jl:463
 [10] top-level scope
    @ In[99]:1
 [11] eval
    @ ./boot.jl:360 [inlined]
 [12] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1116
mtanneau commented 2 years ago

Hi! Thanks for reporting this.

The error you observe is cause by Tulip not supporting one of the attributes that JuMP tries to query within solution_summary. I'll get that fixed.

In the meantime, you should still be able to query the solution through JuMP.value (see, e.g., here). I can also point you to this page of the docs, which has more details.

mtanneau commented 2 years ago

@ketch #111 should fix the issue. I'll a new release when this gets merged, and you should be good to go!

ketch commented 2 years ago

That was fast. Thanks!