-
Notifications
You must be signed in to change notification settings - Fork 48
/
sinquad.jl
39 lines (30 loc) · 953 Bytes
/
sinquad.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
# Another function with nontrivial groups and
# repetitious elements.
# Source:
# N. Gould, private communication.
# classification OUR2-AY-V-0
# Problem 51 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
#
# J.-P. Dussault, Clermont-Ferrand 05/2016.
export sinquad
"Another function with nontrivial groups and repetitious elements in size 'n' "
function sinquad(args...; n::Int = default_nvar, kwargs...)
n < 3 && @warn("sinquad: number of variables must be ≥ 3")
n = max(3, n)
nlp = Model()
@variable(nlp, x[i = 1:n], start = 0.1)
@NLobjective(
nlp,
Min,
(x[1] - 1.0)^4 +
(x[n]^2 - x[1]^2)^2 +
sum((sin(x[i] - x[n]) - x[1]^2 + x[i]^2)^2 for i = 2:(n - 1))
)
return nlp
end