Skip to content

Commit

Permalink
Fix complement test
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Feb 3, 2023
1 parent 9e4176b commit b6a4030
Showing 1 changed file with 44 additions and 5 deletions.
49 changes: 44 additions & 5 deletions src/Test/test_nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1549,11 +1549,50 @@ function test_nonlinear_vector_complements(
x = MOI.add_variables(model, 4)
MOI.add_constraint.(model, x, MOI.Interval(T(0), T(10)))
MOI.set.(model, MOI.VariablePrimalStart(), x, T(1))
f = MOI.VectorNonlinearFunction([
-1.0 * x[3]^2 + -1.0 * x[4] + 2.0,
x[3]^3 + -1.0 * 2x[4]^2 + 2.0,
x[1]^5 + -1.0 * x[2] + 2.0 * x[3] + -2.0 * x[4] + -2.0,
x[1] + 2.0 * x[2]^3 + -2.0 * x[3] + 4.0 * x[4] + -6.0,
# f = [
# -1 * x3^2 + -1 * x4 + 2.0
# x3^3 + -1.0 * 2x4^2 + 2.0
# x1^5 + -1.0 * x2 + 2.0 * x3 + -2.0 * x4 + -2.0
# x1 + 2.0 * x2^3 + -2.0 * x3 + 4.0 * x4 + -6.0
# x...
# ]
f = MOI.VectorNonlinearFunction{T}([
MOI.ScalarNonlinearFunction{T}(
:+,
Any[
MOI.ScalarNonlinearFunction{T}(:*, Any[-T(1), x[3], x[3]]),
MOI.ScalarNonlinearFunction{T}(:*, Any[-T(1), x[4]]),
T(2),
],
),
MOI.ScalarNonlinearFunction{T}(
:+,
Any[
MOI.ScalarNonlinearFunction{T}(:^, Any[x[3], 3]),
MOI.ScalarNonlinearFunction{T}(:*, Any[-T(2), x[4], x[4]]),
T(2),
],
),
MOI.ScalarNonlinearFunction{T}(
:+,
Any[
MOI.ScalarNonlinearFunction{T}(:^, Any[x[1], 5]),
MOI.ScalarAffineFunction{T}(
MOI.ScalarAffineTerm.(T[-1, 2, -2], x[2:4]),
-T(2),
),
],
),
MOI.ScalarNonlinearFunction{T}(
:+,
Any[
MOI.ScalarNonlinearFunction{T}(:*, Any[T(2), x[2], x[2], x[2]]),
MOI.ScalarAffineFunction{T}(
MOI.ScalarAffineTerm.(T[1, -2, 4], [x[1], x[3], x[4]]),
-T(6),
),
],
),
x[1],
x[2],
x[3],
Expand Down

0 comments on commit b6a4030

Please sign in to comment.