@@ -45,13 +45,13 @@ function test_moi_bolp_1()
45
45
MOI. Utilities. loadfromstring! (
46
46
model,
47
47
"""
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
+ """ ,
55
55
)
56
56
x = MOI. get (model, MOI. VariableIndex, " x" )
57
57
y = MOI. get (model, MOI. VariableIndex, " y" )
@@ -81,21 +81,21 @@ function test_moi_bolp_1_maximize()
81
81
MOI. Utilities. loadfromstring! (
82
82
model,
83
83
"""
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
+ """ ,
91
91
)
92
92
x = MOI. get (model, MOI. VariableIndex, " x" )
93
93
y = MOI. get (model, MOI. VariableIndex, " y" )
94
94
MOI. optimize! (model)
95
95
@test MOI. get (model, MOI. TerminationStatus ()) == MOI. OPTIMAL
96
96
@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 ]]
99
99
for i in 1 : 3
100
100
@test MOI. get (model, MOI. PrimalStatus (i)) == MOI. FEASIBLE_POINT
101
101
@test MOI. get (model, MOI. DualStatus (i)) == MOI. NO_SOLUTION
@@ -117,13 +117,13 @@ function test_moi_bolp_1_reversed()
117
117
MOI. Utilities. loadfromstring! (
118
118
model,
119
119
"""
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
+ """ ,
127
127
)
128
128
x = MOI. get (model, MOI. VariableIndex, " x" )
129
129
y = MOI. get (model, MOI. VariableIndex, " y" )
@@ -153,13 +153,13 @@ function test_moi_bolp_1_scalar()
153
153
MOI. Utilities. loadfromstring! (
154
154
model,
155
155
"""
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
+ """ ,
163
163
)
164
164
x = MOI. get (model, MOI. VariableIndex, " x" )
165
165
y = MOI. get (model, MOI. VariableIndex, " y" )
@@ -219,17 +219,16 @@ function test_biobjective_knapsack()
219
219
MOI. LessThan (900.0 ),
220
220
)
221
221
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 = [
226
223
[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
+ ]
228
228
for i in 1 : MOI. get (model, MOI. ResultCount ())
229
229
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))
233
232
end
234
233
return
235
234
end
@@ -353,9 +352,9 @@ function test_three_objective()
353
352
MOI. Utilities. loadfromstring! (
354
353
model,
355
354
"""
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
+ """ ,
359
358
)
360
359
@test_throws (
361
360
ErrorException (" Only scalar or bi-objective problems supported." ),
@@ -408,6 +407,6 @@ function test_vector_of_variables_objective()
408
407
return
409
408
end
410
409
411
- end
410
+ end # module TestDichotomy
412
411
413
412
TestDichotomy. run_tests ()
0 commit comments