Skip to content

Commit d15a084

Browse files
committed
formatting
1 parent 0ce740a commit d15a084

File tree

3 files changed

+69
-16
lines changed

3 files changed

+69
-16
lines changed

test/Bridges/Objective/NonlinearizeBridge.jl

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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
7582
end
7683

7784
function 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
)
@@ -110,4 +157,4 @@ end
110157

111158
end # module
112159

113-
TestObjectiveNonlinearize.runtests()
160+
TestObjectiveNonlinearize.runtests()

test/Bridges/Objective/SlackBridge.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,10 @@ function test_complex_objective()
525525
MOI.Utilities.Model{Float64}(),
526526
Float64,
527527
)
528-
MOI.Bridges.remove_bridge(dest, MOI.Bridges.Objective.NonlinearizeBridge{Float64}) # Otherwise, would be bridged to Nonlinear.
528+
MOI.Bridges.remove_bridge(
529+
dest,
530+
MOI.Bridges.Objective.NonlinearizeBridge{Float64},
531+
) # Otherwise, would be bridged to Nonlinear.
529532
@test_throws MOI.UnsupportedAttribute(attr) MOI.copy_to(dest, model)
530533
end
531534
return

test/Bridges/debug.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ end
188188

189189
function test_print_active_bridges_objective_unsupported()
190190
model = MOI.Bridges.full_bridge_optimizer(Model{Float64}(), Float64)
191-
MOI.Bridges.remove_bridge(model, MOI.Bridges.Objective.NonlinearizeBridge{Float64}) # Otherwise, Int would be bridged to Nonlinear.
191+
MOI.Bridges.remove_bridge(
192+
model,
193+
MOI.Bridges.Objective.NonlinearizeBridge{Float64},
194+
) # Otherwise, Int would be bridged to Nonlinear.
192195
F = MOI.ScalarAffineFunction{Int}
193196
@test_throws(
194197
MOI.UnsupportedAttribute{MOI.ObjectiveFunction{F}},

0 commit comments

Comments
 (0)