From 125831721000f3d67452a78f5e3cd7ade008e4b1 Mon Sep 17 00:00:00 2001 From: danphenderson Date: Fri, 20 Dec 2024 15:18:12 -0500 Subject: [PATCH] fix: discrepancy in problem names. --- src/ADNLPProblems/chnrosnb_mod.jl | 2 +- src/ADNLPProblems/errinros_mod.jl | 4 ++-- src/ADNLPProblems/fletcbv3_mod.jl | 2 +- src/ADNLPProblems/genrose.jl | 2 +- src/ADNLPProblems/indef_mod.jl | 2 +- test/runtests.jl | 2 ++ 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ADNLPProblems/chnrosnb_mod.jl b/src/ADNLPProblems/chnrosnb_mod.jl index fc4b9c19..bfe362fc 100644 --- a/src/ADNLPProblems/chnrosnb_mod.jl +++ b/src/ADNLPProblems/chnrosnb_mod.jl @@ -8,5 +8,5 @@ function chnrosnb_mod(; n::Int = default_nvar, type::Type{T} = Float64, kwargs.. sum((1 - x[i])^2 for i = 2:n) end x0 = -ones(T, n) - return ADNLPModels.ADNLPModel(f, x0, name = "chnrosnb"; kwargs...) + return ADNLPModels.ADNLPModel(f, x0, name = "chnrosnb_mod"; kwargs...) end diff --git a/src/ADNLPProblems/errinros_mod.jl b/src/ADNLPProblems/errinros_mod.jl index c536dcc7..ce642616 100644 --- a/src/ADNLPProblems/errinros_mod.jl +++ b/src/ADNLPProblems/errinros_mod.jl @@ -18,7 +18,7 @@ function errinros_mod( 1 // 2 * sum((1 - x[i])^2 for i = 2:n) end x0 = -ones(T, n) - return ADNLPModels.ADNLPModel(f, x0, name = "errinros"; kwargs...) + return ADNLPModels.ADNLPModel(f, x0, name = "errinros_mod"; kwargs...) end function errinros_mod( @@ -37,5 +37,5 @@ function errinros_mod( return r end x0 = -ones(T, n) - return ADNLPModels.ADNLSModel!(F!, x0, 2 * (n - 1), name = "errinros-nls"; kwargs...) + return ADNLPModels.ADNLSModel!(F!, x0, 2 * (n - 1), name = "errinros_mod-nls"; kwargs...) end diff --git a/src/ADNLPProblems/fletcbv3_mod.jl b/src/ADNLPProblems/fletcbv3_mod.jl index 830d8c44..8863951c 100644 --- a/src/ADNLPProblems/fletcbv3_mod.jl +++ b/src/ADNLPProblems/fletcbv3_mod.jl @@ -10,5 +10,5 @@ function fletcbv3_mod(; n::Int = default_nvar, type::Type{T} = Float64, kwargs.. p * sum(100 * (1 + (2 / h^2)) * sin(x[i] / 100) + (1 / h^2) * cos(x[i]) for i = 1:n) end x0 = T.([(i / (n + 1)) for i = 1:n]) - return ADNLPModels.ADNLPModel(f, x0, name = "fletcbv3"; kwargs...) + return ADNLPModels.ADNLPModel(f, x0, name = "fletcbv3_mod"; kwargs...) end diff --git a/src/ADNLPProblems/genrose.jl b/src/ADNLPProblems/genrose.jl index 6ff000d6..d264f693 100644 --- a/src/ADNLPProblems/genrose.jl +++ b/src/ADNLPProblems/genrose.jl @@ -12,4 +12,4 @@ function genrose(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) wh return ADNLPModels.ADNLPModel(f, x0, name = "genrose"; kwargs...) end -rosenbrock(args...; kwargs...) = genrose(args..., n = 2; delete!(Dict(kwargs), :n)...) +rosenbrock(args...; kwargs...) = genrose(args..., n = 2, name="rosenbrock"; delete!(Dict(kwargs), :n)...) diff --git a/src/ADNLPProblems/indef_mod.jl b/src/ADNLPProblems/indef_mod.jl index 3950ae45..c9e2d77c 100644 --- a/src/ADNLPProblems/indef_mod.jl +++ b/src/ADNLPProblems/indef_mod.jl @@ -8,5 +8,5 @@ function indef_mod(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) 1 // 2 * sum(cos(2 * x[i] - x[n] - x[1]) for i = 2:(n - 1)) end x0 = T.([(i / (n + 1)) for i = 1:n]) - return ADNLPModels.ADNLPModel(f, x0, name = "indef"; kwargs...) + return ADNLPModels.ADNLPModel(f, x0, name = "indef_mod"; kwargs...) end diff --git a/test/runtests.jl b/test/runtests.jl index a57bd3d2..539e1012 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -27,6 +27,8 @@ include("test_utils.jl") eval(Meta.parse("ADNLPProblems.$(prob)(" * simp_backend * ")")) end + @test nlp_ad.meta.name == pb + if pb in meta[(meta.contype .== :quadratic) .| (meta.contype .== :general), :name] @testset "Test In-place Nonlinear Constraints for AD-$prob" begin test_in_place_constraints(prob, nlp_ad)