ds4dm / Tulip.jl

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

MathOptInterface.BarrierIterations #135

Open nsajko opened 1 year ago

nsajko commented 1 year ago

The README suggests setting the iteration limit like so:

MOI.set(moi_model, MOI.RawOptimizerAttribute("IPM_IterationsLimit"), 200)

I think, however, that perhaps this is supposed to have the same effect:

MOI.set(moi_model, MOI.BarrierIterations(), 200)

The latter call fails like so:

julia> using Tulip, MathOptInterface

julia> const MOI = MathOptInterface
MathOptInterface

julia> lp = Tulip.Optimizer{BigFloat}()
Tulip.Optimizer{BigFloat}

julia> MOI.set(lp, MOI.BarrierIterations(), 100)
ERROR: MathOptInterface.SetAttributeNotAllowed{MathOptInterface.BarrierIterations}: Setting attribute MathOptInterface.BarrierIterations() cannot be performed. You may want to use a `CachingOptimizer` in `AUTOMATIC` mode or you may need to call `reset_optimizer` before doing this operation if the `CachingOptimizer` is in `MANUAL` mode.
Stacktrace:
 [1] throw_set_error_fallback(model::Tulip.Optimizer{BigFloat}, attr::MathOptInterface.BarrierIterations, value::Int64; error_if_supported::MathOptInterface.SetAttributeNotAllowed{MathOptInterface.BarrierIterations})
   @ MathOptInterface ~/.julia/packages/MathOptInterface/wx5Ea/src/attributes.jl:584
 [2] throw_set_error_fallback(model::Tulip.Optimizer{BigFloat}, attr::MathOptInterface.BarrierIterations, value::Int64)
   @ MathOptInterface ~/.julia/packages/MathOptInterface/wx5Ea/src/attributes.jl:577
 [3] set(model::Tulip.Optimizer{BigFloat}, attr::MathOptInterface.BarrierIterations, args::Int64)
   @ MathOptInterface ~/.julia/packages/MathOptInterface/wx5Ea/src/attributes.jl:550
 [4] top-level scope
   @ REPL[4]:1