Skip to content

Commit ddf2ca9

Browse files
tmigotprobot-auto-merge[bot]
authored andcommitted
make constraint linear and not affine
1 parent afe176b commit ddf2ca9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/nlp/problems/hs14.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export HS14
88
```math
99
\\begin{aligned}
1010
\\min \\quad & (x_1 - 2)^2 + (x_2 - 1)^2 \\\\
11-
\\text{s. to} \\quad & x_1 - 2x_2 + 1 = 0 \\\\
11+
\\text{s. to} \\quad & x_1 - 2x_2 = -1 \\\\
1212
& -\\tfrac{1}{4} x_1^2 - x_2^2 + 1 \\geq 0
1313
\\end{aligned}
1414
```
@@ -26,8 +26,8 @@ function HS14(::Type{T}) where {T}
2626
nnzh = 2,
2727
ncon = 2,
2828
x0 = T[2; 2],
29-
lcon = T[0; 0],
30-
ucon = T[0; Inf],
29+
lcon = T[-1; 0],
30+
ucon = T[-1; Inf],
3131
name = "HS14_manual",
3232
lin = 1:1,
3333
lin_nnzj = 2,
@@ -107,7 +107,7 @@ function NLPModels.cons_lin!(nlp::HS14, x::AbstractVector, cx::AbstractVector)
107107
@lencheck 1 cx
108108
@lencheck 2 x
109109
increment!(nlp, :neval_cons_lin)
110-
cx .= [x[1] - 2 * x[2] + 1]
110+
cx .= [x[1] - 2 * x[2]]
111111
return cx
112112
end
113113

src/nlp/problems/mgh01feas.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export MGH01Feas
1313
```math
1414
\\begin{aligned}
1515
\\min \\quad & 0 \\\\
16-
\\text{s. to} \\quad & 1 - x_1 = 0 \\\\
16+
\\text{s. to} \\quad & x_1 = 1 \\\\
1717
& 10 (x_2 - x_1^2) = 0.
1818
\\end{aligned}
1919
```
@@ -31,8 +31,8 @@ function MGH01Feas(::Type{T}) where {T}
3131
x0 = T[-1.2; 1.0],
3232
name = "MGH01Feas_manual",
3333
ncon = 2,
34-
lcon = zeros(T, 2),
35-
ucon = zeros(T, 2),
34+
lcon = T[1; 0],
35+
ucon = T[1; 0],
3636
nnzj = 3,
3737
nnzh = 1,
3838
lin = 1:1,
@@ -61,7 +61,7 @@ function NLPModels.cons_lin!(nls::MGH01Feas, x::AbstractVector, cx::AbstractVect
6161
@lencheck 1 cx
6262
@lencheck 2 x
6363
increment!(nls, :neval_cons_lin)
64-
cx .= [1 - x[1]]
64+
cx .= [x[1]]
6565
return cx
6666
end
6767

@@ -100,7 +100,7 @@ function NLPModels.jac_lin_coord!(nls::MGH01Feas, x::AbstractVector, vals::Abstr
100100
@lencheck 2 x
101101
@lencheck 1 vals
102102
increment!(nls, :neval_jac_lin)
103-
vals .= [-1]
103+
vals .= [1]
104104
return vals
105105
end
106106

@@ -121,7 +121,7 @@ function NLPModels.jprod_lin!(
121121
@lencheck 2 x v
122122
@lencheck 1 Jv
123123
increment!(nls, :neval_jprod_lin)
124-
Jv .= [-v[1]]
124+
Jv .= [v[1]]
125125
return Jv
126126
end
127127

@@ -147,7 +147,7 @@ function NLPModels.jtprod_lin!(
147147
@lencheck 2 x Jtv
148148
@lencheck 1 v
149149
increment!(nls, :neval_jtprod_lin)
150-
Jtv .= [-v[1]; 0]
150+
Jtv .= [v[1]; 0]
151151
return Jtv
152152
end
153153

0 commit comments

Comments
 (0)