-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathclplateb.jl
More file actions
32 lines (31 loc) · 1019 Bytes
/
clplateb.jl
File metadata and controls
32 lines (31 loc) · 1019 Bytes
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
export clplateb
function clplateb(;
n::Int = default_nvar,
type::Type{T} = Float64,
wght = -0.1,
kwargs...,
) where {T}
n_orig = n
p = max(floor(Int, sqrt(n)), 3)
n = p * p
@adjust_nvar_warn("clplateb", n_orig, n)
hp2 = 1 // 2 * p^2
function f(x; p = p, hp2 = hp2, wght = wght)
return sum(eltype(x)(wght) / (p - 1) * x[p + (j - 1) * p] for j = 1:p) +
sum(
sum(
1 // 2 * (x[i + (j - 1) * p] - x[i + (j - 2) * p])^2 +
hp2 * (x[i + (j - 1) * p] - x[i + (j - 2) * p])^4 for j = 2:p
) for i = 2:p
) +
sum(1 // 2 * (x[2 + (j - 1) * p])^2 + hp2 * (x[2 + (j - 1) * p])^4 for j = 2:p) +
sum(
sum(
1 // 2 * (x[i + (j - 1) * p] - x[i - 1 + (j - 1) * p])^2 +
hp2 * (x[i + (j - 1) * p] - x[i - 1 + (j - 1) * p])^4 for j = 2:p
) for i = 3:p
)
end
x0 = zeros(T, n)
return ADNLPModels.ADNLPModel(f, x0, name = "clplateb"; kwargs...)
end