-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathhs117.jl
More file actions
63 lines (53 loc) · 1.51 KB
/
hs117.jl
File metadata and controls
63 lines (53 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Hock and Schittkowski problem number 117.
#
# Source:
# Problem 117 in
# W. Hock and K. Schittkowski,
# Test examples for nonlinear programming codes,
# Lectures Notes in Economics and Mathematical Systems 187,
# Springer Verlag, Heidelberg, 1981.
#
# classification PQR-AN-15-5
#
# A. Montoison, Montreal, 05/2018.
export hs117
"HS117 model"
function hs117(args...; kwargs...)
nlp = Model()
x0 = 0.001 * [1, 1, 1, 1, 1, 1, 60000, 1, 1, 1, 1, 1, 1, 1, 1]
@variable(nlp, x[i = 1:15] ≥ 0, start = x0[i])
a = Array{Float64}(undef, 10, 5)
a[1, :] = [-16, 2, 0, 1, 0]
a[2, :] = [0, -2, 0, 4, 2]
a[3, :] = [-3.5, 0, 2, 0, 0]
a[4, :] = [0, -2, 0, -4, -1]
a[5, :] = [0, -9, -2, 1, -2.8]
a[6, :] = [2, 0, -4, 0, 0]
a[7, :] = [-1, -1, -1, -1, -1]
a[8, :] = [-1, -2, -3, -2, -1]
a[9, :] = [1, 2, 3, 4, 5]
a[10, :] = [1, 1, 1, 1, 1]
b = [-40, -2, -0.25, -4, -4, -1, -40, -60, 5, 1]
c = Float64[ 30 -20 -10 32 -10;
-20 39 -6 -31 32;
-10 -6 10 -6 -10;
32 -31 -6 39 -20;
-10 32 -10 -20 30]
d = [4, 8, 10, 6, 2]
e = [-15, -27, -36, -18, -12]
for j = 1:5
@constraint(
nlp,
2 * sum(c[k, j] * x[10 + k] + 3 * d[j] * x[10 + j]^2 for k = 1:5) + e[j] -
sum(a[k, j] * x[k] for k = 1:10) ≥ 0
)
end
@objective(
nlp,
Min,
-sum(b[j] * x[j] for j = 1:10) +
sum(sum(c[k, j] * x[10 + k] * x[10 + j] for k = 1:5) for j = 1:5) +
2 * sum(d[j] * x[10 + j]^3 for j = 1:5)
)
return nlp
end