Skip to content

Improve IIS log #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ext/ModelAnalyzerJuMPExt/ModelAnalyzerJuMPExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ function ModelAnalyzer._name(ref::MOI.ConstraintIndex, model::JuMP.GenericModel)
return "$jump_ref"
end

function ModelAnalyzer._show(ref::MOI.ConstraintIndex, model::JuMP.GenericModel)
jump_ref = JuMP.constraint_ref_with_index(model, ref)
io = IOBuffer()
show(io, jump_ref)
return String(take!(io))
end

"""
variable(issue::ModelAnalyzer.AbstractIssue, model::JuMP.GenericModel)

Expand Down
12 changes: 7 additions & 5 deletions src/Infeasibility/summarize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ function ModelAnalyzer._verbose_summarize(
issue::IrreducibleInfeasibleSubset,
model,
)
return print(
io,
"Irreducible Infeasible Subset: ",
join(map(x -> ModelAnalyzer._name(x, model), issue.constraint), ", "),
)
print(io, "Irreducible Infeasible Subset: ")
for constraint in issue.constraint
println(io)
print(io, " ")
print(io, ModelAnalyzer._show(constraint, model))
end
return
end

function ModelAnalyzer.list_of_issues(data::Data, ::Type{InfeasibleBounds})
Expand Down
4 changes: 4 additions & 0 deletions src/ModelAnalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ function _name(ref, ::Nothing)
return "$ref"
end

function _show(ref::MOI.ConstraintIndex, model)
return _name(ref, model)
end

include("Numerical/Numerical.jl")
include("Feasibility/Feasibility.jl")
include("Infeasibility/Infeasibility.jl")
Expand Down
2 changes: 2 additions & 0 deletions test/test_Infeasibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ function test_iis_spare()
iis = ModelAnalyzer.constraints(ret[], model)
@test length(iis) == 2
@test Set(iis) == Set([c2, c1])
io = IOBuffer()
ModelAnalyzer.summarize(io, ret[1], verbose = true, model = model)
return
end

Expand Down
Loading