Skip to content

Commit 1fcf549

Browse files
committed
Update
1 parent f229368 commit 1fcf549

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_model.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,28 @@ function test_ideal_point()
206206
return
207207
end
208208

209+
function test_SubproblemCount()
210+
model = MOA.Optimizer(HiGHS.Optimizer)
211+
@test MOI.get(model, MOA.SubproblemCount()) == 0
212+
@test MOI.is_set_by_optimize(MOA.SubproblemCount())
213+
MOI.set(model, MOI.Silent(), true)
214+
x = MOI.add_variables(model, 2)
215+
MOI.add_constraint.(model, x, MOI.GreaterThan(0.0))
216+
MOI.add_constraint(model, x[2], MOI.LessThan(3.0))
217+
MOI.add_constraint(model, 3.0 * x[1] - 1.0 * x[2], MOI.LessThan(6.0))
218+
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
219+
f = MOI.Utilities.vectorize([
220+
3.0 * x[1] + x[2],
221+
-1.0 * x[1] - 2.0 * x[2],
222+
])
223+
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
224+
MOI.optimize!(model)
225+
@test MOI.get(model, MOA.SubproblemCount()) > 0
226+
MOI.empty!(model)
227+
@test MOI.get(model, MOA.SubproblemCount()) == 0
228+
return
229+
end
230+
209231
end # module
210232

211233
TestModel.run_tests()

0 commit comments

Comments
 (0)