File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 141
141
# ========== Typed scalar functions ==========
142
142
143
143
function moi_to_object (
144
- foo:: MOI.ScalarAffineTerm{Float64} ,
144
+ foo:: MOI.ScalarAffineTerm ,
145
145
name_map:: Dict{MOI.VariableIndex,String} ,
146
146
)
147
147
return OrderedObject (
@@ -151,7 +151,7 @@ function moi_to_object(
151
151
end
152
152
153
153
function moi_to_object (
154
- foo:: MOI.ScalarAffineFunction{Float64} ,
154
+ foo:: MOI.ScalarAffineFunction ,
155
155
name_map:: Dict{MOI.VariableIndex,String} ,
156
156
)
157
157
return OrderedObject (
@@ -162,7 +162,7 @@ function moi_to_object(
162
162
end
163
163
164
164
function moi_to_object (
165
- foo:: MOI.ScalarQuadraticTerm{Float64} ,
165
+ foo:: MOI.ScalarQuadraticTerm ,
166
166
name_map:: Dict{MOI.VariableIndex,String} ,
167
167
)
168
168
return OrderedObject (
@@ -173,7 +173,7 @@ function moi_to_object(
173
173
end
174
174
175
175
function moi_to_object (
176
- foo:: MOI.ScalarQuadraticFunction{Float64} ,
176
+ foo:: MOI.ScalarQuadraticFunction ,
177
177
name_map:: Dict{MOI.VariableIndex,String} ,
178
178
)
179
179
return OrderedObject (
Original file line number Diff line number Diff line change @@ -1344,6 +1344,26 @@ function test_parse_nonlinear_objective_only()
1344
1344
return
1345
1345
end
1346
1346
1347
+ function test_integer_coefficients ()
1348
+ x = MOI. VariableIndex (1 )
1349
+ names = Dict (x => " x" )
1350
+ f = 2 * x * x + 3 * x + 4
1351
+ @test MOF. moi_to_object (f, names) == MOF. OrderedObject (
1352
+ " type" => " ScalarQuadraticFunction" ,
1353
+ " affine_terms" =>
1354
+ [MOF. OrderedObject (" coefficient" => 3 , " variable" => " x" )],
1355
+ " quadratic_terms" => [
1356
+ MOF. OrderedObject (
1357
+ " coefficient" => 4 ,
1358
+ " variable_1" => " x" ,
1359
+ " variable_2" => " x" ,
1360
+ ),
1361
+ ],
1362
+ " constant" => 4 ,
1363
+ )
1364
+ return
1365
+ end
1366
+
1347
1367
end
1348
1368
1349
1369
TestMOF. runtests ()
You can’t perform that action at this time.
0 commit comments