-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathhs67.jl
More file actions
70 lines (65 loc) · 2.13 KB
/
hs67.jl
File metadata and controls
70 lines (65 loc) · 2.13 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
64
65
66
67
68
69
70
# Hock and Schittkowski problem number 67.
#
# Source:
# Problem 67 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 GGI-P1-1
#
# Original sources
#
# A.R. Colville, A comparative study on nonlinear programming codes,
# IBM Scientific Center REport 320-2949, New York, 1968.
#
# D.M. Himmelbau, Applied nonlinear programming, McGraw-Hill Book-Company, New York, 1972.
#
export hs67
function hs67(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
a = [0, 0, 85, 90, 3, 1 // 100, 145, 5000, 2000, 93, 95, 12, 4, 162]
function yvec(x)
y = similar(x, 8)
y[2] = 16 // 10 * x[1]
y[3] = 122 // 100 * y[2] - x[1]
y[6] = (x[2] + y[3]) / x[1]
yc = 1 // 100 * x[1] * (112 + 13167 // 1000 * y[6] - 6667 // 10000 * y[6]^2)
while abs(yc - y[2]) > 0.001
y[2] = yc
y[3] = 122 // 100 * y[2] - x[1]
y[6] = (x[2] + y[3]) / x[1]
yc = 1 // 100 * x[1] * (112 + 13167 // 1000 * y[6] - 6667 // 10000 * y[6]^2)
end
y[4] = 93
y[5] = 8635 // 100 + 1098 // 1000 * y[6] - 38 // 1000 * y[6]^2 + 325 // 1000 * (y[4] - 89)
y[8] = 3 * y[5] - 133
y[7] = 3582 // 100 - 222 // 1000 * y[8]
yc = 98000 * x[3] / (y[2] * y[7] + 1000 * x[3])
while abs(yc - y[4]) > 0.001
y[4] = yc
y[5] = 8635 // 100 + 1098 // 1000 * y[6] - 38 // 1000 * y[6]^2 + 325 // 1000 * (y[4] - 89)
y[8] = 3 * y[5] - 133
y[7] = 3582 // 100 - 222 // 1000 * y[8]
yc = 98000 * x[3] / (y[2] * y[7] + 1000 * x[3])
end
return y
end
function f(x)
y = yvec(x)
return - (63 // 1000 * y[2] * y[5] - 504 // 100 * x[1] - 336 // 100 * y[3] - 35 // 1000 * x[2] - 10 * x[3])
end
x0 = T[1745, 12000, 110]
uvar = T[1e-5, 1e-5, 1e-5]
lvar = T[2e3, 1.6e4, 1.2e2]
function c(x)
y = yvec(x)
return vcat(
[y[i+1] - a[i] for i=1:7],
[a[i] - y[i - 6] for i=8:14]
)
end
lcon = zeros(T, 14)
ucon = T(Inf) * ones(T, 14)
return ADNLPModels.ADNLPModel(f, x0, lvar, uvar, c, lcon, ucon, name = "hs67"; kwargs...)
end