Skip to content
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
3 changes: 3 additions & 0 deletions src/MathOptIIS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,9 @@ function _dual_certificate!(
)
for (F, S) in MOI.get(model, MOI.ListOfConstraintTypesPresent())
for ci in MOI.get(model, MOI.ListOfConstraintIndices{F,S}())
# This iszero check here is rather tight. We may want to consider
# relaxing it for solvers like SCS that have some tolerance for what
# is a certificate.
if !iszero(MOI.get(model, MOI.ConstraintDual(), ci))
push!(dual_certificate, ci)
end
Expand Down
24 changes: 16 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -569,16 +569,20 @@ function test_iis_spare_scs()
optimize!(model)
solver = MathOptIIS.Optimizer()
MOI.set(solver, MathOptIIS.InfeasibleModel(), backend(model))
MOI.set(solver, MathOptIIS.InnerOptimizer(), HiGHS.Optimizer)
MOI.set(solver, MathOptIIS.InnerOptimizer(), SCS.Optimizer)
MOI.set(solver, MOI.Silent(), false)
MOI.compute_conflict!(solver)
data = solver.results
@test length(data) == 1
@test data[1].metadata === nothing
@test _isequal_unordered(data[].constraints, [index(c2), index(c1)])
data = only(solver.results)
@test data.metadata === nothing
@test _isequal_unordered(data.constraints, [index(c2), index(c1)])
result = Dict(c1 => MOI.IN_CONFLICT, c2 => MOI.IN_CONFLICT)
for ci in all_constraints(model; include_variable_in_set_constraints = true)
@test MOI.get(solver, MOI.ConstraintConflictStatus(), index(ci)) ==
get(result, ci, MOI.NOT_IN_CONFLICT)
stat = MOI.get(solver, MOI.ConstraintConflictStatus(), index(ci))
if haskey(result, ci)
@test stat == result[ci]
else
@test stat != MOI.IN_CONFLICT
end
end
return
end
Expand Down Expand Up @@ -1157,7 +1161,11 @@ function test_time_limit_interrupt()
F, S = MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}
# We've set N such that it cannot find the full IIS in the time
# allowed.
@test MOI.get(iis, MOI.NumberOfConstraints{F,S}()) > 8
if N < 16
@test MOI.get(iis, MOI.NumberOfConstraints{F,S}()) > 8
else
@test MOI.get(iis, MOI.NumberOfConstraints{F,S}()) >= 8
end
end
end
return
Expand Down
Loading