-
Notifications
You must be signed in to change notification settings - Fork 48
/
tquartic.jl
37 lines (28 loc) · 929 Bytes
/
tquartic.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
# A quartic function with nontrivial groups and
# repetitious elements.
# Source:
# Ph. Toint, private communication.
# classification SUR2-AN-V-0#
# Problem 57 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 tquartic
"A quartic function with nontrivial groups and repetitious elements in size 'n' "
function tquartic(args...; n::Int = default_nvar, kwargs...)
n < 2 && @warn("tquartic: number of variables must be ≥ 2")
n = max(2, n)
nlp = Model()
@variable(nlp, x[i = 1:n], start = 0.1)
@NLobjective(
nlp,
Min,
0.5 * (x[1] - 1.0)^2 + 0.5 * sum((x[1]^2 - x[i + 1]^2)^2 for i = 1:(n - 2))
)
return nlp
end