Skip to content

Commit 796df85

Browse files
andrewrosembergamontoison
authored andcommitted
normalize constraints test
1 parent 08c47ab commit 796df85

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

test/nlp_problems/hs10.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ function hs10_oracle()
2727
# Bounds: 0 ≤ g(x) ≤ +∞
2828
set = MOI.VectorNonlinearOracle(;
2929
dimension = 2, # number of input variables (x1, x2)
30-
l = [0.0], # lower bound on g(x)
30+
l = [-1.0], # lower bound on g(x)
3131
u = [Inf], # upper bound on g(x)
3232
eval_f = (ret, xv) -> begin
3333
# ret[1] = g(x)
34-
ret[1] = -3 * xv[1]^2 + 2 * xv[1] * xv[2] - xv[2]^2 + 1
34+
ret[1] = -3 * xv[1]^2 + 2 * xv[1] * xv[2] - xv[2]^2
3535
end,
3636
# Jacobian of g(x): ∇g = [∂g/∂x1, ∂g/∂x2]
3737
# ∂g/∂x1 = -6 x1 + 2 x2

test/nlp_problems/hs14.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ function hs14_oracle()
2929
# g(x) = -x1^2/4 - x2^2 + 1, 0 ≤ g(x) ≤ +∞
3030
set = MOI.VectorNonlinearOracle(;
3131
dimension = 2, # 2 inputs: x1, x2
32-
l = [0.0], # lower bound on g(x)
32+
l = [-1.0], # lower bound on g(x)
3333
u = [Inf], # upper bound on g(x)
3434
eval_f = (ret, xv) -> begin
3535
# ret[1] = g(x)
36-
ret[1] = -0.25 * xv[1]^2 - xv[2]^2 + 1
36+
ret[1] = -0.25 * xv[1]^2 - xv[2]^2
3737
end,
3838
# Jacobian of g(x): ∇g = [∂g/∂x1, ∂g/∂x2]
3939
# ∂g/∂x1 = -0.5 x1

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ end
2121
include("test_moi_nlp_model.jl")
2222
include("test_moi_nls_model.jl")
2323

24+
include("test_moi_nlp_oracle.jl")
25+
2426
include("nlp_consistency.jl")
2527
include("nls_consistency.jl")
2628

test/test_moi_nlp_oracle.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
if m > 0
1717
ncx_no_oracle = cons(nlp_no_oracle, x)
1818
ncx_with_oracle = cons(nlp_with_oracle, x)
19-
@test isapprox(ncx_no_oracle, ncx_with_oracle; rtol = 1e-1)
19+
@test isapprox(ncx_no_oracle, ncx_with_oracle; atol = 1e-8, rtol = 1e-8)
2020
end
2121
end

0 commit comments

Comments
 (0)