-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathclplatea.jl
More file actions
32 lines (31 loc) · 996 Bytes
/
clplatea.jl
File metadata and controls
32 lines (31 loc) · 996 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 clplatea
function clplatea(;
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("clplatea", n_orig, n)
hp2 = (1 // 2) * p^2
function f(x; p = p, hp2 = hp2, wght = wght)
return (eltype(x)(wght) * x[p + (p - 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 = "clplatea"; kwargs...)
end