I am trying to obtain the constraints that are included in the IIS, for example with the following infeasible problem
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...
optimize!(model)
if termination_status(model) == MOI.INFEASIBLE_OR_UNBOUNDED
@assert termination_status(model) == MOI.INFEASIBLE_OR_UNBOUNDED
compute_conflict!(model)
MOI.get(model, MOI.ConstraintConflictStatus(), const1)
end
However, it always 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 this correctly?
I am using JuliaPro_v1.53-1, JuMP v0.21.6, Gurobi v0.9.11
Any bits of help or suggestions are appreciated.
Thanks in advance
Answered on the community forum: https://discourse.julialang.org/t/obtaining-irreducible-inconsistent-subsystem-iis-with-jump-gurobi/58491/2
const1
is an array. Use broadcasting:
MOI.get.(model, MOI.ConstraintConflictStatus(), const1)