Skip to content

Commit 2ddff6d

Browse files
committed
Add test
1 parent 0c10445 commit 2ddff6d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/iis.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,36 @@ function test_range_and_bound()
240240
return
241241
end
242242

243+
function test_range_and_bound_2()
244+
model = Model()
245+
@variable(model, 10 <= x <= 11)
246+
@variable(model, 1 <= y <= 11)
247+
@variable(model, 1 <= z <= 0)
248+
@constraint(model, c, x + y + z <= 1)
249+
@objective(model, Max, x + y)
250+
solver = MOCS.Optimizer()
251+
MOI.set(solver, MOCS.InfeasibleModel(), JuMP.backend(model))
252+
MOI.compute_conflict!(solver)
253+
data = solver.results
254+
@test length(data) == 1
255+
@test _isequal_unordered(
256+
data[].constraints,
257+
[JuMP.index(LowerBoundRef(z)), JuMP.index(UpperBoundRef(z))],
258+
)
259+
@test MOI.get(solver, MOCS.StopIfInfeasibleBounds()) == true
260+
MOI.set(solver, MOCS.StopIfInfeasibleBounds(), false)
261+
@test MOI.get(solver, MOCS.StopIfInfeasibleBounds()) == false
262+
MOI.compute_conflict!(solver)
263+
data = solver.results
264+
# the result is only one conflic again because the range fail cant be computed
265+
@test length(data) == 1
266+
@test _isequal_unordered(
267+
data[1].constraints,
268+
[JuMP.index(LowerBoundRef(z)), JuMP.index(UpperBoundRef(z))],
269+
)
270+
return
271+
end
272+
243273
function test_range_neg()
244274
model = Model()
245275
@variable(model, 10 <= x <= 11)

0 commit comments

Comments
 (0)