@@ -33,7 +33,9 @@ function test_solve_singlevariable_obj()
3333 )
3434 MOI. Test. test_objective_ObjectiveFunction_duplicate_terms (
3535 model,
36- MOI. Test. Config (;exclude = Any[MOI. DualObjectiveValue, MOI. ConstraintDual, ]),
36+ MOI. Test. Config (;
37+ exclude = Any[MOI. DualObjectiveValue, MOI. ConstraintDual],
38+ ),
3739 )
3840 @test MOI. get (mock, MOI. ObjectiveFunctionType ()) ==
3941 MOI. ScalarNonlinearFunction
@@ -43,7 +45,7 @@ function test_solve_singlevariable_obj()
4345 @test MOI. get (model, MOI. ObjectiveSense ()) == MOI. MIN_SENSE
4446 vis = MOI. get (model, MOI. ListOfVariableIndices ())
4547 func = 3.0 * vis[1 ] + 0.0
46-
48+
4749 @test MOI. get (
4850 model,
4951 MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} (),
@@ -69,39 +71,84 @@ function test_solve_result_index()
6971 (MOI. VariableIndex, MOI. GreaterThan{Float64}) => [1.0 ],
7072 ),
7173 )
72- MOI. Test. test_solve_result_index (model, MOI. Test. Config (;exclude = Any[MOI. DualObjectiveValue, MOI. ConstraintDual, ]))
74+ MOI. Test. test_solve_result_index (
75+ model,
76+ MOI. Test. Config (;
77+ exclude = Any[MOI. DualObjectiveValue, MOI. ConstraintDual],
78+ ),
79+ )
7380
7481 return
7582end
7683
7784function test_runtests ()
7885 MOI. Bridges. runtests (
7986 MOI. Bridges. Objective. NonlinearizeBridge,
80- model -> begin
87+ model -> begin
8188 x = MOI. add_variable (model)
82- aff = MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .([2.0 ], [x]), 1.0 )
83- MOI. set (model, MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} (), aff)
89+ aff = MOI. ScalarAffineFunction (
90+ MOI. ScalarAffineTerm .([2.0 ], [x]),
91+ 1.0 ,
92+ )
93+ MOI. set (
94+ model,
95+ MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} (),
96+ aff,
97+ )
8498 MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
8599 end ,
86100 model -> begin
87101 x = MOI. add_variable (model)
88- exp = MOI. ScalarNonlinearFunction (:+ , [MOI. ScalarNonlinearFunction (:* , [2.0 , MOI. VariableIndex (1 )]), 1.0 ])
89- MOI. set (model, MOI. ObjectiveFunction {MOI.ScalarNonlinearFunction} (), exp)
102+ exp = MOI. ScalarNonlinearFunction (
103+ :+ ,
104+ [
105+ MOI. ScalarNonlinearFunction (
106+ :* ,
107+ [2.0 , MOI. VariableIndex (1 )],
108+ ),
109+ 1.0 ,
110+ ],
111+ )
112+ MOI. set (
113+ model,
114+ MOI. ObjectiveFunction {MOI.ScalarNonlinearFunction} (),
115+ exp,
116+ )
90117 MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
91118 end ,
92119 )
93120 MOI. Bridges. runtests (
94121 MOI. Bridges. Objective. NonlinearizeBridge,
95- model -> begin
122+ model -> begin
96123 x = MOI. add_variable (model)
97- aff = MOI. ScalarAffineFunction (MOI. ScalarAffineTerm .([2.0 ], [x]), 1.0 )
98- MOI. set (model, MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} (), aff)
124+ aff = MOI. ScalarAffineFunction (
125+ MOI. ScalarAffineTerm .([2.0 ], [x]),
126+ 1.0 ,
127+ )
128+ MOI. set (
129+ model,
130+ MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} (),
131+ aff,
132+ )
99133 MOI. set (model, MOI. ObjectiveSense (), MOI. MAX_SENSE)
100134 end ,
101135 model -> begin
102136 x = MOI. add_variable (model)
103- exp = MOI. ScalarNonlinearFunction (:+ , [MOI. ScalarNonlinearFunction (:* , [2.0 , MOI. VariableIndex (1 )]), 1.0 ])
104- MOI. set (model, MOI. ObjectiveFunction {MOI.ScalarNonlinearFunction} (), exp)
137+ exp = MOI. ScalarNonlinearFunction (
138+ :+ ,
139+ [
140+ MOI. ScalarNonlinearFunction (
141+ :* ,
142+ [2.0 , MOI. VariableIndex (1 )],
143+ ),
144+ 1.0 ,
145+ ],
146+ )
147+ MOI. set (
148+ model,
149+ MOI. ObjectiveFunction {MOI.ScalarNonlinearFunction} (),
150+ exp,
151+ )
105152 MOI. set (model, MOI. ObjectiveSense (), MOI. MAX_SENSE)
106153 end ,
107154 )
110157
111158end # module
112159
113- TestObjectiveNonlinearize. runtests ()
160+ TestObjectiveNonlinearize. runtests ()
0 commit comments