Obtaining Irreducible Inconsistent Subsystem (IIS) with JumP - Gurobi


I am kind of new to Julia (+/- 3 months of usage)

I am trying to find which constraints are members of IIS of an Infeasible or Unbounded optimisation problem. For example, I have the following script

using JuMP, Gurobi
model = direct_model(Gurobi.Optimizer())

# defining variables
@variable(model, z)
@variable(model, x1[a=1:10, b=1:5] => 0)
@variable(model, x2[a=1:10, b=1:5, c=1:7] => 0)
# and so on...

# objective and constraints

@objective(model, Max, z)

@constraint(model, const1[a=1:10, b=1:5, c=1:7], equation1)
@constraint(model, const2[b=1:5, c=1:7], equation2)
# and so on...


if termination_status(model) == MOI.INFEASIBLE_OR_UNBOUNDED
    @assert termination_status(model) == MOI.INFEASIBLE_OR_UNBOUNDED
    MOI.get(model, MOI.ConstraintConflictStatus(), const1) 
    MOI.get(model, MOI.ConstraintConflictStatus(), const2) 

I want to know which constraint at which index is a member of IIS

However, it returns an error of

MethodError: no method matching get(::Model, ::MathOptInterface.ConstraintConflictStatus, ::Array{ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64},MathOptInterface.EqualTo{Float64}},ScalarShape},3})

Am I doing something wrong with my script? I think I followed what the syntax should be according to JuMP manuals

I am using JuliaPro_v1.53-1, JuMP v0.21.6, and Gurobi v0.9.11

Any help or suggestions are appreciated.

Thanks in advance


const1 is an array. Use broadcasting:

MOI.get.(model, MOI.ConstraintConflictStatus(), const1)

Ah I see, Thank you very much!

1 Like