how can i get a list of basic variables with jumpgurobi?

This is poorly documented, but you can see which constraints are basic:

model = Model(Gurobi.Optimizer)
@variable(model, x >= 0)
@constraint(model, c, 2x >= 1)
@objective(model, Min, x)
optimize!(model)

julia> MOI.get(model, MOI.ConstraintBasisStatus(), c)
NONBASIC::BasisStatusCode = 1

julia> MOI.get(model, MOI.ConstraintBasisStatus(), LowerBoundRef(x))
BASIC::BasisStatusCode = 0

Note that since variables can have lower and upper bounds, we report which constraints are basic, rather than which variables are.

Documentation: https://jump.dev/MathOptInterface.jl/stable/apireference/#MathOptInterface.ConstraintBasisStatus https://jump.dev/MathOptInterface.jl/stable/apireference/#MathOptInterface.BasisStatusCode

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top