@@ -45,13 +45,13 @@ function test_moi_bolp_1()
4545 MOI. Utilities. loadfromstring! (
4646 model,
4747 """
48- variables: x, y
49- minobjective: [2 * x + y + 1, x + 3 * y]
50- c1: x + y >= 1.0
51- c2: 0.5 * x + y >= 0.75
52- c3: x >= 0.0
53- c4: y >= 0.25
54- """ ,
48+ variables: x, y
49+ minobjective: [2 * x + y + 1, x + 3 * y]
50+ c1: x + y >= 1.0
51+ c2: 0.5 * x + y >= 0.75
52+ c3: x >= 0.0
53+ c4: y >= 0.25
54+ """ ,
5555 )
5656 x = MOI. get (model, MOI. VariableIndex, " x" )
5757 y = MOI. get (model, MOI. VariableIndex, " y" )
@@ -81,21 +81,21 @@ function test_moi_bolp_1_maximize()
8181 MOI. Utilities. loadfromstring! (
8282 model,
8383 """
84- variables: x, y
85- maxobjective: [-2.0 * x + -1.0 * y, -1.0 * x + -3.0 * y + 0.5]
86- c1: x + y >= 1.0
87- c2: 0.5 * x + y >= 0.75
88- c3: x >= 0.0
89- c4: y >= 0.25
90- """ ,
84+ variables: x, y
85+ maxobjective: [-2.0 * x + -1.0 * y, -1.0 * x + -3.0 * y + 0.5]
86+ c1: x + y >= 1.0
87+ c2: 0.5 * x + y >= 0.75
88+ c3: x >= 0.0
89+ c4: y >= 0.25
90+ """ ,
9191 )
9292 x = MOI. get (model, MOI. VariableIndex, " x" )
9393 y = MOI. get (model, MOI. VariableIndex, " y" )
9494 MOI. optimize! (model)
9595 @test MOI. get (model, MOI. TerminationStatus ()) == MOI. OPTIMAL
9696 @test MOI. get (model, MOI. ResultCount ()) == 3
97- X = [[0 .0 , 1.0 ], [0.5 , 0.5 ], [1 .0 , 0.25 ]]
98- Y = [- [ 1.0 , 2.5 ], - [ 1.5 , 1.5 ], - [ 2.25 , 1.25 ]]
97+ X = [[1 .0 , 0.25 ], [0.5 , 0.5 ], [0 .0 , 1.0 ]]
98+ Y = [[ - 2.25 , - 1.25 ], [ - 1.5 , - 1.5 ], [ - 1.0 , - 2.5 ]]
9999 for i in 1 : 3
100100 @test MOI. get (model, MOI. PrimalStatus (i)) == MOI. FEASIBLE_POINT
101101 @test MOI. get (model, MOI. DualStatus (i)) == MOI. NO_SOLUTION
@@ -117,13 +117,13 @@ function test_moi_bolp_1_reversed()
117117 MOI. Utilities. loadfromstring! (
118118 model,
119119 """
120- variables: x, y
121- minobjective: [x + 3 * y, 2 * x + y]
122- c1: x + y >= 1.0
123- c2: 0.5 * x + y >= 0.75
124- c3: x >= 0.0
125- c4: y >= 0.25
126- """ ,
120+ variables: x, y
121+ minobjective: [x + 3 * y, 2 * x + y]
122+ c1: x + y >= 1.0
123+ c2: 0.5 * x + y >= 0.75
124+ c3: x >= 0.0
125+ c4: y >= 0.25
126+ """ ,
127127 )
128128 x = MOI. get (model, MOI. VariableIndex, " x" )
129129 y = MOI. get (model, MOI. VariableIndex, " y" )
@@ -153,13 +153,13 @@ function test_moi_bolp_1_scalar()
153153 MOI. Utilities. loadfromstring! (
154154 model,
155155 """
156- variables: x, y
157- minobjective: [2 * x + y, x + 3 * y]
158- c1: x + y >= 1.0
159- c2: 0.5 * x + y >= 0.75
160- c3: x >= 0.0
161- c4: y >= 0.25
162- """ ,
156+ variables: x, y
157+ minobjective: [2 * x + y, x + 3 * y]
158+ c1: x + y >= 1.0
159+ c2: 0.5 * x + y >= 0.75
160+ c3: x >= 0.0
161+ c4: y >= 0.25
162+ """ ,
163163 )
164164 x = MOI. get (model, MOI. VariableIndex, " x" )
165165 y = MOI. get (model, MOI. VariableIndex, " y" )
@@ -219,17 +219,16 @@ function test_biobjective_knapsack()
219219 MOI. LessThan (900.0 ),
220220 )
221221 MOI. optimize! (model)
222- results = Dict (
223- [955.0 , 906.0 ] => [2 , 3 , 5 , 6 , 9 , 10 , 11 , 14 , 15 , 16 , 17 ],
224- [948.0 , 939.0 ] => [1 , 2 , 3 , 5 , 6 , 8 , 10 , 11 , 15 , 16 , 17 ],
225- [934.0 , 971.0 ] => [2 , 3 , 5 , 6 , 8 , 10 , 11 , 12 , 15 , 16 , 17 ],
222+ results = [
226223 [918.0 , 983.0 ] => [2 , 3 , 4 , 5 , 6 , 8 , 10 , 11 , 12 , 16 , 17 ],
227- )
224+ [934.0 , 971.0 ] => [2 , 3 , 5 , 6 , 8 , 10 , 11 , 12 , 15 , 16 , 17 ],
225+ [948.0 , 939.0 ] => [1 , 2 , 3 , 5 , 6 , 8 , 10 , 11 , 15 , 16 , 17 ],
226+ [955.0 , 906.0 ] => [2 , 3 , 5 , 6 , 9 , 10 , 11 , 14 , 15 , 16 , 17 ],
227+ ]
228228 for i in 1 : MOI. get (model, MOI. ResultCount ())
229229 x_sol = MOI. get (model, MOI. VariablePrimal (i), x)
230- X = findall (elt -> elt > 0.9 , x_sol)
231- Y = MOI. get (model, MOI. ObjectiveValue (i))
232- @test results[Y] == X
230+ @test results[i][2 ] == findall (elt -> elt > 0.9 , x_sol)
231+ @test results[i][1 ] ≈ MOI. get (model, MOI. ObjectiveValue (i))
233232 end
234233 return
235234end
@@ -353,9 +352,9 @@ function test_three_objective()
353352 MOI. Utilities. loadfromstring! (
354353 model,
355354 """
356- variables: x
357- maxobjective: [1.0 * x, -1.0 * x, 2.0 * x + 2.0]
358- """ ,
355+ variables: x
356+ maxobjective: [1.0 * x, -1.0 * x, 2.0 * x + 2.0]
357+ """ ,
359358 )
360359 @test_throws (
361360 ErrorException (" Only scalar or bi-objective problems supported." ),
@@ -408,6 +407,6 @@ function test_vector_of_variables_objective()
408407 return
409408end
410409
411- end
410+ end # module TestDichotomy
412411
413412TestDichotomy. run_tests ()
0 commit comments