@@ -89,21 +89,32 @@ function test_MOI_Test()
89
89
return
90
90
end
91
91
92
- function _test_Optimizer_Model_attributes (uf, model, attr, listattr)
92
+ function _test_Optimizer_Model_attributes (
93
+ uf:: MOI.Utilities.UniversalFallback ,
94
+ model:: MOI.ModelLike ,
95
+ attr:: Union{MOI.AbstractOptimizerAttribute,MOI.AbstractModelAttribute} ,
96
+ list:: Union{MOI.ListOfOptimizerAttributesSet,MOI.ListOfModelAttributesSet} ,
97
+ )
93
98
@test ! MOI. supports (model, attr)
94
99
@test MOI. supports (uf, attr)
95
- @test isempty (MOI. get (uf, listattr ))
100
+ @test isempty (MOI. get (uf, list ))
96
101
MOI. set (uf, attr, 0 )
97
102
@test MOI. get (uf, attr) == 0
98
- @test MOI. get (uf, listattr) == [attr]
103
+ @test MOI. get (uf, list) == [attr]
104
+ MOI. set (uf, attr, nothing )
105
+ @test isempty (MOI. get (uf, list))
106
+ MOI. set (uf, attr, 0 )
99
107
return
100
108
end
101
109
102
110
function _test_Variable_Constraint_attributes (
103
- uf,
104
- model,
105
- attr,
106
- listattr,
111
+ uf:: MOI.Utilities.UniversalFallback ,
112
+ model:: MOI.ModelLike ,
113
+ attr:: Union{MOI.AbstractVariableAttribute,MOI.AbstractConstraintAttribute} ,
114
+ listattr:: Union {
115
+ MOI. ListOfVariableAttributesSet,
116
+ MOI. ListOfConstraintAttributesSet,
117
+ },
107
118
I:: Type{<:MOI.Index} ,
108
119
addfun,
109
120
x,
@@ -114,6 +125,11 @@ function _test_Variable_Constraint_attributes(
114
125
@test MOI. supports (uf, attr, I)
115
126
@test isempty (MOI. get (uf, listattr))
116
127
MOI. set (uf, attr, [x, y], [2 , 0 ])
128
+ @test MOI. get (uf, listattr) == [attr]
129
+ MOI. set (uf, attr, x, nothing )
130
+ MOI. set (uf, attr, y, nothing )
131
+ @test isempty (MOI. get (uf, listattr))
132
+ MOI. set (uf, attr, [x, y], [2 , 0 ])
117
133
@test MOI. get (uf, attr, z) === nothing
118
134
@test ! MOI. is_empty (uf)
119
135
@test MOI. get (uf, listattr) == [attr]
@@ -235,18 +251,13 @@ function test_supported_constraint_attributes()
235
251
cx = _add_constraint (uf, x, 0.0 )
236
252
cy = _add_constraint (uf, y, 1.0 )
237
253
cz = _add_constraint (uf, z, 2.0 )
254
+ F, S = MOI. ScalarAffineFunction{Float64}, MOI. LessThan{Float64}
238
255
_test_Variable_Constraint_attributes (
239
256
uf,
240
257
model,
241
258
MOI. Test. UnknownConstraintAttribute (),
242
- MOI. ListOfConstraintAttributesSet{
243
- MOI. ScalarAffineFunction{Float64},
244
- MOI. LessThan{Float64},
245
- }(),
246
- MOI. ConstraintIndex{
247
- MOI. ScalarAffineFunction{Float64},
248
- MOI. LessThan{Float64},
249
- },
259
+ MOI. ListOfConstraintAttributesSet {F,S} (),
260
+ MOI. ConstraintIndex{F,S},
250
261
uf -> _add_constraint (uf, x, 0.0 ),
251
262
cx,
252
263
cy,
@@ -282,18 +293,13 @@ function test_unsupported_constraint_attributes()
282
293
cx = _add_constraint (uf, x, 0.0 )
283
294
cy = _add_constraint (uf, y, 1.0 )
284
295
cz = _add_constraint (uf, z, 2.0 )
296
+ F, S = MOI. ScalarAffineFunction{Float64}, MOI. EqualTo{Float64}
285
297
_test_Variable_Constraint_attributes (
286
298
uf,
287
299
model,
288
300
MOI. Test. UnknownConstraintAttribute (),
289
- MOI. ListOfConstraintAttributesSet{
290
- MOI. ScalarAffineFunction{Float64},
291
- MOI. EqualTo{Float64},
292
- }(),
293
- MOI. ConstraintIndex{
294
- MOI. ScalarAffineFunction{Float64},
295
- MOI. EqualTo{Float64},
296
- },
301
+ MOI. ListOfConstraintAttributesSet {F,S} (),
302
+ MOI. ConstraintIndex{F,S},
297
303
uf -> _add_constraint (uf, x, 0.0 ),
298
304
cx,
299
305
cy,
0 commit comments