Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions data/tetra.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
xe_tetra = [
0 0 0
1 0 0
0 1 0
0 0 1
0.5 0.2 0.1
];

Tets_tetra = [
1 2 3 5
5 4 3 1
5 4 1 2
5 2 3 4
];

Tets_tetra = vec(reshape(Tets_tetra, 16, 1));
xe_tetra = vec(reshape(xe_tetra, 15, 1));
Constants_tetra = [1, 2, 3, 4];
23,430 changes: 23,430 additions & 0 deletions data/tetra_duct12.jl

Large diffs are not rendered by default.

11,150 changes: 11,150 additions & 0 deletions data/tetra_duct15.jl

Large diffs are not rendered by default.

5,182 changes: 5,182 additions & 0 deletions data/tetra_duct20.jl

Large diffs are not rendered by default.

6,197 changes: 6,197 additions & 0 deletions data/tetra_foam5.jl

Large diffs are not rendered by default.

3,991 changes: 3,991 additions & 0 deletions data/tetra_gear.jl

Large diffs are not rendered by default.

5,878 changes: 5,878 additions & 0 deletions data/tetra_hook.jl

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions src/ADNLPProblems/tetra.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Minimize the sum of the inverse weighted mean ratio of the elements in a fixed–boundary
# tetrahedral mesh by adjusting the locations of the free vertices.

# This is problem 19 in the COPS (Version 3) collection of
# E. Dolan and J. More
# see "Benchmarking Optimization Software with COPS"
# Argonne National Labs Technical Report ANL/MCS-246 (2004)

include("../../data/tetra.jl")
export tetra

function tetra(x0 = xe_tetra, TETS::Vector{Int64} = Tets_tetra, Const::Vector{Int64} = Constants_tetra; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}

x0 = T.(x0)
n = length(x0)
τ = zero(T)
N = round(Int,n/3)
E = round(Int,length(TETS)/4)

function area(e,x)
return sum((x[TETS[e+E]+N*i] - x[TETS[e]+N*i])*((x[TETS[e+2*E]+N*mod(i+1,3)]-x[TETS[e]+N*mod(i+1,3)])*(x[TETS[e+3*E]+N*mod(i-1,3)]-x[TETS[e]+N*mod(i-1,3)])- (x[TETS[e+2*E]+N*mod(i-1,3)]-x[TETS[e]+N*mod(i-1,3)])*(x[TETS[e+3*E]+N*mod(i+1,3)]-x[TETS[e]+N*mod(i+1,3)])) * T(sqrt(2)) for i=0:2)
end
function nfrob(e,x)
return sum((1*x[TETS[e+E]+N*i] - x[TETS[e]+N*i])^2 + (2*x[TETS[e+2*E]+N*i] - x[TETS[e+E]+N*i] - x[TETS[e]+N*i])^2 / 3 + (3*x[TETS[e+3*E]+N*i] - x[TETS[e+2*E]+N*i] - x[TETS[e+E]+N*i] - x[TETS[e]+N*i])^2 / 6 for i=0:2)
end

function f(y)
return sum(nfrob(e,y)/(3*area(e,y)^(2//3)) for e=1:E)
end
function c(y)
return [area(e,y) for e=1:E]
end

lvar = -T(Inf) * ones(T, n)
lvar[Const] = x0[Const]
lvar[Const.+N] = x0[Const.+N]
lvar[Const.+ 2*N] = x0[Const.+ 2*N]

uvar = T(Inf) * ones(T, n)
uvar[Const] = x0[Const]
uvar[Const.+N] = x0[Const.+N]
uvar[Const.+ 2*N] = x0[Const.+ 2*N]

lcon = τ*ones(T, E)
ucon = T(Inf)*ones(T, E)
return ADNLPModels.ADNLPModel(
f,
x0,
lvar,
uvar,
c,
lcon,
ucon,
name = "tetra";
kwargs...,
)
end

include("../../data/tetra_duct12.jl")
export tetra_duct12
tetra_duct12(;kwargs...) = tetra(xe_duct12, TETS_duct12, Const_duct12; name = "tetra_duct12", kwargs...)

include("../../data/tetra_duct15.jl")
export tetra_duct15
tetra_duct15(;kwargs...) = tetra(xe_duct15, TETS_duct15, Const_duct15; name = "tetra_duct15", kwargs...)

include("../../data/tetra_duct20.jl")
export tetra_duct20
tetra_duct20(;kwargs...) = tetra(xe_duct20, TETS_duct20, Const_duct20; name = "tetra_duct20", kwargs...)

include("../../data/tetra_hook.jl")
export tetra_hook
tetra_hook(;kwargs...) = tetra(xe_hook, TETS_hook, Const_hook; name = "tetra_hook", kwargs...)

include("../../data/tetra_foam5.jl")
export tetra_foam5
tetra_foam5(;kwargs...) = tetra(xe_foam5, TETS_foam5, Const_foam5; name = "tetra_foam5", kwargs...)

include("../../data/tetra_gear.jl")
export tetra_gear
tetra_gear(;kwargs...) = tetra(xe_gear, TETS_gear, Const_gear; name = "tetra_gear", kwargs...)

25 changes: 25 additions & 0 deletions src/Meta/tetra.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_meta = Dict(
:nvar => 15,
:variable_nvar => false,
:ncon => 4,
:variable_ncon => false,
:minimize => true,
:name => "tetra",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => Inf,
:is_feasible => missing,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_nvar(; n::Integer = default_nvar, kwargs...) = 15
get_tetra_ncon(; n::Integer = default_nvar, kwargs...) = 4
get_tetra_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_nnln(; n::Integer = default_nvar, kwargs...) = 4
get_tetra_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_nineq(; n::Integer = default_nvar, kwargs...) = 4
25 changes: 25 additions & 0 deletions src/Meta/tetra_duct12.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_duct12_meta = Dict(
:nvar => 12597,
:variable_nvar => false,
:ncon => 19222,
:variable_ncon => false,
:minimize => true,
:name => "tetra_duct12",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 23246.058150514582,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_duct12_nvar(; n::Integer = default_nvar, kwargs...) = 12597
get_tetra_duct12_ncon(; n::Integer = default_nvar, kwargs...) = 19222
get_tetra_duct12_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_duct12_nnln(; n::Integer = default_nvar, kwargs...) = 19222
get_tetra_duct12_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_duct12_nineq(; n::Integer = default_nvar, kwargs...) = 19222
25 changes: 25 additions & 0 deletions src/Meta/tetra_duct15.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_duct15_meta = Dict(
:nvar => 6417,
:variable_nvar => false,
:ncon => 9000,
:variable_ncon => false,
:minimize => true,
:name => "tetra_duct15",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 10890.937025065883,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_duct15_nvar(; n::Integer = default_nvar, kwargs...) = 6417
get_tetra_duct15_ncon(; n::Integer = default_nvar, kwargs...) = 9000
get_tetra_duct15_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_duct15_nnln(; n::Integer = default_nvar, kwargs...) = 9000
get_tetra_duct15_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_duct15_nineq(; n::Integer = default_nvar, kwargs...) = 9000
25 changes: 25 additions & 0 deletions src/Meta/tetra_duct20.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_duct20_meta = Dict(
:nvar => 3201,
:variable_nvar => false,
:ncon => 4104,
:variable_ncon => false,
:minimize => true,
:name => "tetra_duct20",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 4959.804733960625,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_duct20_nvar(; n::Integer = default_nvar, kwargs...) = 3201
get_tetra_duct20_ncon(; n::Integer = default_nvar, kwargs...) = 4104
get_tetra_duct20_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_duct20_nnln(; n::Integer = default_nvar, kwargs...) = 4104
get_tetra_duct20_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_duct20_nineq(; n::Integer = default_nvar, kwargs...) = 4104
25 changes: 25 additions & 0 deletions src/Meta/tetra_foam5.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_foam5_meta = Dict(
:nvar => 4011,
:variable_nvar => false,
:ncon => 4847,
:variable_ncon => false,
:minimize => true,
:name => "tetra_foam5",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 6497.104132398904,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_foam5_nvar(; n::Integer = default_nvar, kwargs...) = 4011
get_tetra_foam5_ncon(; n::Integer = default_nvar, kwargs...) = 4847
get_tetra_foam5_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_foam5_nnln(; n::Integer = default_nvar, kwargs...) = 4847
get_tetra_foam5_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_foam5_nineq(; n::Integer = default_nvar, kwargs...) = 4847
25 changes: 25 additions & 0 deletions src/Meta/tetra_gear.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_gear_meta = Dict(
:nvar => 2598,
:variable_nvar => false,
:ncon => 3116,
:variable_ncon => false,
:minimize => true,
:name => "tetra_gear",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 4256.375736370327,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_gear_nvar(; n::Integer = default_nvar, kwargs...) = 2598
get_tetra_gear_ncon(; n::Integer = default_nvar, kwargs...) = 3116
get_tetra_gear_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_gear_nnln(; n::Integer = default_nvar, kwargs...) = 3116
get_tetra_gear_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_gear_nineq(; n::Integer = default_nvar, kwargs...) = 3116
25 changes: 25 additions & 0 deletions src/Meta/tetra_hook.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
tetra_hook_meta = Dict(
:nvar => 3570,
:variable_nvar => false,
:ncon => 4675,
:variable_ncon => false,
:minimize => true,
:name => "tetra_hook",
:has_equalities_only => false,
:has_inequalities_only => true,
:has_bounds => true,
:has_fixed_variables => true,
:objtype => :other,
:contype => :general,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 6157.142959931886,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_tetra_hook_nvar(; n::Integer = default_nvar, kwargs...) = 3570
get_tetra_hook_ncon(; n::Integer = default_nvar, kwargs...) = 4675
get_tetra_hook_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_hook_nnln(; n::Integer = default_nvar, kwargs...) = 4675
get_tetra_hook_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_tetra_hook_nineq(; n::Integer = default_nvar, kwargs...) = 4675