Skip to content
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

helical fonction creation #145

Merged
merged 4 commits into from
Apr 19, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Ajout des trois fichiers helical.jl
ines1406 committed Apr 16, 2022
commit 98c38e7aaaf6ffbb4a41fe4bc14ba021f9c79804
9 changes: 9 additions & 0 deletions src/ADNLPProblems/helical.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export helical

function helical(; n::Int = default_nvar, type::Val{T} = Val(Float64), kwargs...) where {T}
function f(x)
return (10*(x[3]-10*(atan(x[2]/x[1])-one(T)/4*(x[1]-abs(x[1])/x[1]))/(2*T(pi))))^2+(10*(sqrt(x[1]^2+x[2]^2)-1))^2+x[3]^2
end
x0 = T[-1; 0; 0]
return ADNLPModels.ADNLPModel(f, x0, name = "helical"; kwargs...)
end
25 changes: 25 additions & 0 deletions src/Meta/helical.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
helical_meta = Dict(
:nvar => 3,
:variable_nvar => false,
:ncon => 0,
:variable_ncon => false,
:minimize => true,
:name => "helical",
:has_equalities_only => false,
:has_inequalities_only => false,
:has_bounds => false,
:has_fixed_variables => false,
:objtype => :other,
:contype => :unconstrained,
:best_known_lower_bound => -Inf,
:best_known_upper_bound => 0.0,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_helical_nvar(; n::Integer = default_nvar, kwargs...) = 3
get_helical_ncon(; n::Integer = default_nvar, kwargs...) = 0
get_helical_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_helical_nnln(; n::Integer = default_nvar, kwargs...) = 0
get_helical_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_helical_nineq(; n::Integer = default_nvar, kwargs...) = 0
14 changes: 14 additions & 0 deletions src/PureJuMP/helical.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Source: problem 7 in
# J.J. More', B.S. Garbow and K.E. Hillstrom,
# "Testing Unconstrained Optimization Software",
# ACM Transactions on Mathematical Software, vol. 7(1), pp. 17-41, 1981.

export helical

function helical()
nlp = Model()
x0 = [-1.0; 0.0;0.0]
@variable(nlp,x[i=1:3], start=x0[i])
@NLobjective(nlp,Min,(10*(x[3]-10*(atan(x[2]/x[1])-0.25*(x[1]-abs(x[1])/x[1]))/(2*pi)))^2+(10*(sqrt(x[1]^2+x[2]^2)-1))^2+x[3]^2)
return nlp
end