-
Notifications
You must be signed in to change notification settings - Fork 48
add tetra.jl #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tmigot
merged 10 commits into
JuliaSmoothOptimizers:main
from
MohamedLaghdafHABIBOULLAH:tetra
Jun 8, 2022
Merged
add tetra.jl #190
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
86b7f75
add tetra.jl
MohamedLaghdafHABIBOULLAH d742b24
Edit data/tetra.jl
MohamedLaghdafHABIBOULLAH 1e01b6f
Edit2 tetra.jl
MohamedLaghdafHABIBOULLAH f883283
Update tetra.jl
MohamedLaghdafHABIBOULLAH 2b1caf7
Update src/ADNLPProblems/tetra.jl
MohamedLaghdafHABIBOULLAH e754e90
Update data/tetra.jl
MohamedLaghdafHABIBOULLAH ea4c031
Update data/tetra.jl
MohamedLaghdafHABIBOULLAH aa10008
Update data/tetra.jl
MohamedLaghdafHABIBOULLAH d242e6f
Update data/tetra.jl
MohamedLaghdafHABIBOULLAH 2134c68
Update data/tetra.jl
MohamedLaghdafHABIBOULLAH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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...) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.