diff --git a/src/ADNLPProblems/BOX3.jl b/src/ADNLPProblems/BOX3.jl new file mode 100644 index 00000000..d150b48b --- /dev/null +++ b/src/ADNLPProblems/BOX3.jl @@ -0,0 +1,11 @@ +export BOX3 + +function BOX3(args...; n::Int = default_nvar, type::Val{T} = Val(Float64), m::Int = 2n, kwargs...) where {T} + m < 3 && @warn("BOX3: must have m ≥ 3") + m = max(m, 3) + + x0 = T[0; 10; 20] + f(x) = one(T)/2*sum((exp(-one(T)/10*j*x[1]) - exp(-one(T)/10*j*x[2]) -x[3]*(exp(-one(T)/10*j) - exp(-T(j))))^2 for j = 1:m) + + return ADNLPModels.ADNLPModel(f, x0, name = "BOX3"; kwargs...) +end diff --git a/src/Meta/BOX3.jl b/src/Meta/BOX3.jl new file mode 100644 index 00000000..b116b377 --- /dev/null +++ b/src/Meta/BOX3.jl @@ -0,0 +1,25 @@ +BOX3_meta = Dict( + :nvar => 3, + :variable_nvar => false, + :ncon => 0, + :variable_ncon => false, + :minimize => true, + :name => "BOX3", + :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 => 662.8684162588787, + :is_feasible => true, + :defined_everywhere => missing, + :origin => :unknown, +) +get_BOX3_nvar(; n::Integer = default_nvar, kwargs...) = 3 +get_BOX3_ncon(; n::Integer = default_nvar, kwargs...) = 0 +get_BOX3_nlin(; n::Integer = default_nvar, kwargs...) = 0 +get_BOX3_nnln(; n::Integer = default_nvar, kwargs...) = 0 +get_BOX3_nequ(; n::Integer = default_nvar, kwargs...) = 0 +get_BOX3_nineq(; n::Integer = default_nvar, kwargs...) = 0 diff --git a/src/PureJuMP/BOX3.jl b/src/PureJuMP/BOX3.jl new file mode 100644 index 00000000..a855701b --- /dev/null +++ b/src/PureJuMP/BOX3.jl @@ -0,0 +1,33 @@ +# Source: problem 12 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. + +# Source: Problem 12 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. + +# See also Buckley#BOX663 +# SIF input: Ph. Toint, Dec 1989. + +# classification SUR2-AN-3-0 +export BOX3 + +function BOX3(args...; n::Int = default_nvar, m::Int = 2n, kwargs...) + m < 3 && @warn("BOX3: must have m ≥ 3") + m = max(m, 3) + + nlp = Model() + + x0 = [0.0; 10.0; 20.0] + @variable(nlp, x[i=1:3], start = x0[i]) + + @NLobjective( + nlp, + Min, + 0.5*sum((exp(-0.1*j*x[1]) - exp(-0.1*j*x[2]) -x[3]*(exp(-0.1*j) - exp(-j)))^2 for j = 1:m)) + + return nlp +end +