-
Notifications
You must be signed in to change notification settings - Fork 48
/
genrose_nash.jl
50 lines (44 loc) · 1.24 KB
/
genrose_nash.jl
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
# Generalized Rosenbrock function.
#
# Source: problem 4 in
# S. Nash,
# Newton-type minimization via the Lanczos process,
# SIAM J. Num. Anal. 21, 770-788, 1984,
#
# and
#
# problem 36 in
# L. Luksan, C. Matonoha and J. Vlcek
# Modified CUTE problems for sparse unconstrained optimization,
# Technical Report 1081,
# Institute of Computer Science,
# Academy of Science of the Czech Republic
#
# http://www.cs.cas.cz/matonoha/download/V1081.pdf
#
# classification SUR2-AN-V-0
#
# Note: this variant does not reduce to the classical
# Rosenbrock function when n = 2, described in
#
# H. H. Rosenbrock,
# An automatic method for finding the greatest or least value
# of a function
# The Computer Journal 3: 175–184, 1960.
# https://dx.doi.org/10.1093%2Fcomjnl%2F3.3.175
#
# D. Orban, Montreal, 08/2015.
export genrose_nash
"Nash's variant of `genrose()` in size `n`"
function genrose_nash(args...; n::Int = default_nvar, kwargs...)
n < 2 && @warn("genrose_nash: number of variables must be ≥ 2")
n = max(2, n)
nlp = Model()
@variable(nlp, x[i = 1:n], start = (i / (n + 1)))
@NLobjective(
nlp,
Min,
1.0 + 100 * sum((x[i] - x[i - 1]^2)^2 for i = 2:n) + sum((1.0 - x[i])^2 for i = 2:n)
)
return nlp
end