Skip to content

Commit 0d4ba59

Browse files
authored
Simplify objective function and constraints in tests
Refactor objective function creation and update constraints.
1 parent 2dadbbd commit 0d4ba59

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

test/algorithms/DominguezRios.jl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,14 @@ function test_lp()
161161
x = MOI.add_variables(model, 2)
162162
MOI.add_constraint(model, x[1], MOI.GreaterThan(0.0))
163163
MOI.add_constraint(model, x[2], MOI.Interval(0.0, 3.0))
164-
C = Float64[
165-
3 1
166-
-1 -2
167-
]
168-
f = MOI.VectorAffineFunction(
169-
[
170-
MOI.VectorAffineTerm(i, MOI.ScalarAffineTerm(C[i, j], x[j])) for
171-
i in 1:2 for j in 1:2
172-
],
173-
fill(0.0, 2),
174-
)
175164
MOI.add_constraint(model, 3.0 * x[1] - 1.0 * x[2], MOI.LessThan(6.0))
176-
MOI.set(model, MOA.Algorithm(), MOA.DominguezRios())
177165
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
166+
f = MOI.Utilities.vectorize([3.0 1.0; -1.0 -2.0] * x)
178167
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
179168
MOI.optimize!(model)
180169
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
170+
@test MOI.get(model, MOI.ResultCount()) > 1
171+
return
181172
end
182173

183174
end # module TestDominguezRios

0 commit comments

Comments
 (0)