Skip to content

Commit 5d783f4

Browse files
committed
Update
1 parent ec2f130 commit 5d783f4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/MOI_wrapper.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,29 @@ function test_lm_context()
346346
return
347347
end
348348

349+
function test_AAA_failure()
350+
model = MOI.instantiate(KNITRO.Optimizer; with_bridge_type=Float64, with_cache_type=Float64)
351+
v = MOI.add_variables(model, 2)
352+
MOI.add_constraint(model, v[1], MOI.Semicontinuous(2.0, 3.0))
353+
vc2 = MOI.add_constraint(model, v[2], MOI.EqualTo(0.0))
354+
c = MOI.add_constraint(model, 1.0 * v[1] - 1.0 * v[2], MOI.GreaterThan(0.0))
355+
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
356+
f = 1.0 * v[1]
357+
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
358+
MOI.optimize!(model)
359+
@test isapprox(MOI.get(model, MOI.ConstraintPrimal(), c), 0.0; atol = 1e-5)
360+
MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(1.0))
361+
MOI.optimize!(model)
362+
@test isapprox(MOI.get(model, MOI.ConstraintPrimal(), c), 1.0; atol = 1e-5)
363+
MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(2.0))
364+
MOI.optimize!(model)
365+
@test isapprox(MOI.get(model, MOI.ConstraintPrimal(), c), 0.0; atol = 1e-5)
366+
MOI.set(model, MOI.ConstraintSet(), vc2, MOI.EqualTo(2.5))
367+
MOI.optimize!(model)
368+
@test isapprox(MOI.get(model, MOI.ConstraintPrimal(), c), 0.0; atol = 1e-5)
369+
return
370+
end
371+
349372
end
350373

351374
TestMOIWrapper.runtests()

0 commit comments

Comments
 (0)