Skip to content

Commit 6c40153

Browse files
authored
Update the ADNLPModel hs119 (#398)
1 parent 3682401 commit 6c40153

File tree

1 file changed

+9
-38
lines changed

1 file changed

+9
-38
lines changed

src/ADNLPProblems/hs119.jl

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,17 @@
11
export hs119
22

33
function hs119(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
4-
ci = T[2.5, 1.1, -3.1, -3.5, 1.3, 2.1, 2.3, -1.5]
4+
Q_rows = [1, 2, 2, 3, 1, 4, 5, 5, 6, 1, 2, 3, 4, 7, 1, 6, 8, 3, 9, 2, 3, 5, 8, 10, 4, 7, 11, 5, 9, 12, 7, 11, 13, 3, 10, 12, 13, 14, 4, 6, 8, 15, 1, 5, 9, 16]
5+
Q_cols = [1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16]
56

6-
a = Array{Int}(undef, 16, 16)
7-
a[1, :] = [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1]
8-
a[2, :] = [0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0]
9-
a[3, :] = [0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0]
10-
a[4, :] = [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]
11-
a[5, :] = [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1]
12-
a[6, :] = [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0]
13-
a[7, :] = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0]
14-
a[8, :] = [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0]
15-
a[9, :] = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1]
16-
a[10, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]
17-
a[11, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]
18-
a[12, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0]
19-
a[13, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]
20-
a[14, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
21-
a[15, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
22-
a[16, :] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
7+
clinrows = [1, 2, 3, 4, 7, 1, 3, 4, 6, 8, 1, 2, 4, 6, 8, 1, 2, 4, 5, 7, 8, 1, 2, 3, 5, 6, 8, 1, 3, 4, 5, 6, 1, 2, 4, 5, 6, 7, 8, 1, 3, 5, 6, 8, 1, 7, 2, 3, 4, 5, 6, 7, 8]
8+
clincols = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16]
9+
clinvals = T[0.22, -1.46, 1.29, -1.1, 1.12, 0.2, -0.89, -1.06, -1.72, 0.45, 0.19, -1.3, 0.95, -0.33, 0.26, 0.25, 1.82, -0.54, -1.43, 0.31, -1.1, 0.15, -1.15, -1.16, 1.51, 1.62, 0.58, 0.11, -0.96, -1.78, 0.59, 1.24, 0.12, 0.8, -0.41, -0.33, 0.21, 1.12, -1.03, 0.13, -0.49, -0.43, -0.26, 0.1, 1.0, -0.36, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
2310

24-
b = Array{T}(undef, 8, 16)
25-
b[:, 1] = [0.22, -1.46, 1.29, -1.10, 0, 0, 1.12, 0]
26-
b[:, 2] = [0.20, 0, -0.89, -1.06, 0, -1.72, 0, 0.45]
27-
b[:, 3] = [0.19, -1.30, 0, 0.95, 0, -0.33, 0, 0.26]
28-
b[:, 4] = [0.25, 1.82, 0, -0.54, -1.43, 0, 0.31, -1.10]
29-
b[:, 5] = [0.15, -1.15, -1.16, 0, 1.51, 1.62, 0, 0.58]
30-
b[:, 6] = [0.11, 0, -0.96, -1.78, 0.59, 1.24, 0, 0]
31-
b[:, 7] = [0.12, 0.80, 0, -0.41, -0.33, 0.21, 1.12, -1.03]
32-
b[:, 8] = [0.13, 0, -0.49, 0, -0.43, -0.26, 0, 0.10]
33-
b[:, 9] = [1, 0, 0, 0, 0, 0, -0.36, 0]
34-
b[:, 10] = [0, 1, 0, 0, 0, 0, 0, 0]
35-
b[:, 11] = [0, 0, 1, 0, 0, 0, 0, 0]
36-
b[:, 12] = [0, 0, 0, 1, 0, 0, 0, 0]
37-
b[:, 13] = [0, 0, 0, 0, 1, 0, 0, 0]
38-
b[:, 14] = [0, 0, 0, 0, 0, 1, 0, 0]
39-
b[:, 15] = [0, 0, 0, 0, 0, 0, 1, 0]
40-
b[:, 16] = [0, 0, 0, 0, 0, 0, 0, 1]
41-
function f(x; a = a)
42-
return sum(sum(a[i, j] * (x[i]^2 + x[i] + 1) * (x[j]^2 + x[j] + 1) for j = 1:16) for i = 1:16)
11+
function f(x; rows = Q_rows, cols = Q_cols)
12+
return sum((x[rows[k]]^2 + x[rows[k]] + 1) * (x[cols[k]]^2 + x[cols[k]] + 1) for k in 1:46)
4313
end
14+
4415
x0 = 10 * ones(T, 16)
4516
lvar = zeros(T, 16)
4617
uvar = 5 * ones(T, 16)
@@ -64,5 +35,5 @@ function hs119(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wher
6435
36.8,
6536
-24,
6637
]
67-
return ADNLPModels.ADNLPModel(f, x0, lvar, uvar, sparse(b), lcon, ucon, name = "hs119"; kwargs...)
38+
return ADNLPModels.ADNLPModel(f, x0, lvar, uvar, clinrows, clincols, clinvals, lcon, ucon, name = "hs119"; kwargs...)
6839
end

0 commit comments

Comments
 (0)