Skip to content

Commit 0c10445

Browse files
committed
fix feasibility check
1 parent b86f7b9 commit 0c10445

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

src/iis.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ function _feasibility_check(optimizer::Optimizer)
409409
if optimizer.verbose
410410
println("Original model primal status: $(primal_status)")
411411
end
412-
if primal_status in (MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT)
412+
if primal_status in (MOI.FEASIBLE_POINT, MOI.NEARLY_FEASIBLE_POINT) && !(
413+
termination_status in
414+
(MOI.INFEASIBLE, MOI.ALMOST_INFEASIBLE, MOI.LOCALLY_INFEASIBLE)
415+
)
413416
return true
414417
end
415418
return false

src/solver.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function _elastic_filter(optimizer::Optimizer)
7676
#
7777
end
7878
if status in
79-
(MOI.INFEASIBLE, MOI.ALMOST_INFEASIBLE, MOI.ALMOST_INFEASIBLE)
79+
(MOI.INFEASIBLE, MOI.ALMOST_INFEASIBLE, MOI.LOCALLY_INFEASIBLE)
8080
break
8181
end
8282
for (con, func) in constraint_to_affine
@@ -129,7 +129,7 @@ function _elastic_filter(optimizer::Optimizer)
129129
MOI.optimize!(model)
130130
status = MOI.get(model, MOI.TerminationStatus())
131131
if status in
132-
(MOI.INFEASIBLE, MOI.ALMOST_INFEASIBLE, MOI.ALMOST_INFEASIBLE)
132+
(MOI.INFEASIBLE, MOI.ALMOST_INFEASIBLE, MOI.LOCALLY_INFEASIBLE)
133133
# this constraint is not in IIS
134134
# hence it remains unfixed
135135
elseif status in (

test/iis.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,33 @@ function test_iis_spare()
639639
return
640640
end
641641

642+
function test_iis_binary()
643+
model = Model(HiGHS.Optimizer)
644+
set_silent(model)
645+
@variable(model, x, Bin)
646+
@constraint(model, c1, x == 1 / 2)
647+
optimize!(model)
648+
@show termination_status(model)
649+
@show primal_status(model)
650+
solver = MOCS.Optimizer()
651+
MOI.set(solver, MOCS.InfeasibleModel(), JuMP.backend(model))
652+
MOI.set(solver, MOCS.InnerOptimizer(), HiGHS.Optimizer)
653+
MOI.compute_conflict!(solver)
654+
data = solver.results
655+
@test length(data) == 1
656+
@test data[].irreducible
657+
@test data[].metadata == MOCS.NoData()
658+
@test _isequal_unordered(data[].constraints, [JuMP.index(c1)])
659+
@test MOI.get(solver, MOI.ConstraintConflictStatus(), JuMP.index(c1)) ==
660+
MOI.IN_CONFLICT
661+
@test MOI.get(
662+
solver,
663+
MOI.ConstraintConflictStatus(),
664+
JuMP.index(BinaryRef(x)),
665+
) == MOI.MAYBE_IN_CONFLICT
666+
return
667+
end
668+
642669
end # module
643670

644671
TestIIS.runtests()

0 commit comments

Comments
 (0)