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

Add HS201 #345

Merged
merged 3 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions src/ADNLPProblems/hs201.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export hs201

function hs201(; n::Int=default_nvar, type::Type{T} = Float64, kwargs...) where {T}
f(x) = 4 * (x[1] - 5)^2 + (x[2] - 6)^2
x0 = T[8, 9]
return ADNLPModels.ADNLPModel(f, x0, name="hs201"; kwargs...)
end
25 changes: 25 additions & 0 deletions src/Meta/hs201.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
hs201_meta = Dict(
:nvar => 2,
:variable_nvar => false,
:ncon => 0,
:variable_ncon => false,
:minimize => true,
:name => "hs201",
: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 => 45.0,
:is_feasible => true,
:defined_everywhere => missing,
:origin => :unknown,
)
get_hs201_nvar(; n::Integer = default_nvar, kwargs...) = 2
get_hs201_ncon(; n::Integer = default_nvar, kwargs...) = 0
get_hs201_nlin(; n::Integer = default_nvar, kwargs...) = 0
get_hs201_nnln(; n::Integer = default_nvar, kwargs...) = 0
get_hs201_nequ(; n::Integer = default_nvar, kwargs...) = 0
get_hs201_nineq(; n::Integer = default_nvar, kwargs...) = 0
24 changes: 24 additions & 0 deletions src/PureJuMP/hs201.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Hock and Schittkowski problem number 201.
#
# Source:
# Problem 201 in
# K. Schittkowski,
# More Test Examples for Nonlinear Programming Codes,
# Lectures Notes in Economics and Mathematical Systems 282,
# Springer Verlag, Heidelberg, 1987.
#
export hs201
"HS201 model"
function hs201(args...; n::Int = default_nvar, kwargs...)
model = Model()

#Déclaration des variables
@variable(model, x1)
set_start_value(x1, 8)
@variable(model, x2)
set_start_value(x2, 9)

#Définition de la fonction objectif
@NLobjective(model, Min, 4*(x1-5)^2+(x2-6)^2)
tmigot marked this conversation as resolved.
Show resolved Hide resolved
return model
end
Loading