From da8d5d313f46aa2dc89b9f6845a22ff189424c68 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Thu, 29 Aug 2024 22:40:32 -0400 Subject: [PATCH 1/4] Use CUTEst.jl v1.0.0 --- .github/workflows/CI.yml | 2 +- Project.toml | 4 ++-- test/runtests.jl | 16 +++++++--------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8b55ac6..c86c018 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,7 +30,7 @@ jobs: - x86 steps: - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} diff --git a/Project.toml b/Project.toml index f083c34..f24e4f8 100644 --- a/Project.toml +++ b/Project.toml @@ -18,8 +18,8 @@ PRIMACUTEstExt = "CUTEst" PRIMANLPModelsExt = "NLPModels" [compat] -CUTEst = "0.13" -NLPModels = "0.20" +CUTEst = "1.0.0" +NLPModels = "0.21.3" PRIMA_jll = "0.7.1" Requires = "1" TypeUtils = "0.3" diff --git a/test/runtests.jl b/test/runtests.jl index 76712d7..f91ce33 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using PRIMA using Test, TypeUtils -Sys.WORD_SIZE > 32 && using CUTEst +using CUTEst optimizer_name(::typeof(PRIMA.uobyqa)) = "UOBYQA" optimizer_name(::typeof(PRIMA.newuoa)) = "NEWUOA" @@ -381,14 +381,12 @@ end end end - if Sys.WORD_SIZE > 32 - @testset "Unconstrained CUTEst problem $name" for name in ("TOINTQOR", "OSBORNEB", "LANCZOS1LS",) - x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) - @test issuccess(res1) - x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) - @test issuccess(res2) - @test x1 ≈ x2 - end + @testset "Unconstrained CUTEst problem $name" for name in ("TOINTQOR", "OSBORNEB", "LANCZOS1LS",) + x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) + @test issuccess(res1) + x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) + @test issuccess(res2) + @test x1 ≈ x2 end end From 5a5ca89cea9a561709f04a7c66381d2fd28dbe65 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Thu, 29 Aug 2024 23:24:33 -0400 Subject: [PATCH 2/4] Fix the tests --- ext/PRIMACUTEstExt.jl | 6 +++--- test/runtests.jl | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/PRIMACUTEstExt.jl b/ext/PRIMACUTEstExt.jl index 9f6e2f5..487e310 100644 --- a/ext/PRIMACUTEstExt.jl +++ b/ext/PRIMACUTEstExt.jl @@ -7,10 +7,10 @@ else end for func in (:uobyqa, :newuoa, :bobyqa, :lincoa, :cobyla, :prima) - @eval function PRIMA.$(Symbol(func,"_CUTEst"))(name::AbstractString; kwds...) - nlp = CUTEstModel(name) + @eval function PRIMA.$(Symbol(func,"_CUTEst"))(name::AbstractString; kwargs...) + nlp = CUTEstModel{Float64}(name) try - return $func(nlp; kwds...) + return $func(nlp; kwargs...) finally finalize(nlp) end diff --git a/test/runtests.jl b/test/runtests.jl index f91ce33..500718e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -247,7 +247,7 @@ end f2(x, cx) = f2(x) n = 2 rhobeg = 1.0 - rhoend = 1e-6 + rhoend = 1e-5 ftarget = -Inf maxfun = 3000n npt = 2n + 1 @@ -382,9 +382,11 @@ end end @testset "Unconstrained CUTEst problem $name" for name in ("TOINTQOR", "OSBORNEB", "LANCZOS1LS",) - x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) + # x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) + x1, res1 = PRIMA.prima_CUTEst(name; maxfun=5000) @test issuccess(res1) - x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) + # x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) + x2, res2 = PRIMA.newuoa_CUTEst(name; maxfun=5000) @test issuccess(res2) @test x1 ≈ x2 end From 7e89cf63e03e1ddd26afd8f926711f2ef2ad5902 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Thu, 29 Aug 2024 23:41:56 -0400 Subject: [PATCH 3/4] Don't test CUTEst on 32-bit linux --- test/runtests.jl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 500718e..fb921e0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,8 @@ using PRIMA using Test, TypeUtils -using CUTEst +if Sys.WORD_SIZE > 32 || Sys.iswindows() + using CUTEst +end optimizer_name(::typeof(PRIMA.uobyqa)) = "UOBYQA" optimizer_name(::typeof(PRIMA.newuoa)) = "NEWUOA" @@ -381,14 +383,16 @@ end end end - @testset "Unconstrained CUTEst problem $name" for name in ("TOINTQOR", "OSBORNEB", "LANCZOS1LS",) - # x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) - x1, res1 = PRIMA.prima_CUTEst(name; maxfun=5000) - @test issuccess(res1) - # x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) - x2, res2 = PRIMA.newuoa_CUTEst(name; maxfun=5000) - @test issuccess(res2) - @test x1 ≈ x2 + if Sys.WORD_SIZE > 32 || Sys.iswindows() + @testset "Unconstrained CUTEst problem $name" for name in ("TOINTQOR", "OSBORNEB", "LANCZOS1LS",) + # x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) + x1, res1 = PRIMA.prima_CUTEst(name; maxfun=5000) + @test issuccess(res1) + # x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) + x2, res2 = PRIMA.newuoa_CUTEst(name; maxfun=5000) + @test issuccess(res2) + @test x1 ≈ x2 + end end end From a8e62a572308622b5dacc007116f4ddafa6cdc52 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Sat, 31 Aug 2024 00:11:56 -0400 Subject: [PATCH 4/4] Use CUTEst.jl v1.0.1 --- Project.toml | 2 +- test/runtests.jl | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index f24e4f8..8c3da37 100644 --- a/Project.toml +++ b/Project.toml @@ -18,7 +18,7 @@ PRIMACUTEstExt = "CUTEst" PRIMANLPModelsExt = "NLPModels" [compat] -CUTEst = "1.0.0" +CUTEst = "1.0.1" NLPModels = "0.21.3" PRIMA_jll = "0.7.1" Requires = "1" diff --git a/test/runtests.jl b/test/runtests.jl index fb921e0..9fee61c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -385,11 +385,9 @@ end if Sys.WORD_SIZE > 32 || Sys.iswindows() @testset "Unconstrained CUTEst problem $name" for name in ("TOINTQOR", "OSBORNEB", "LANCZOS1LS",) - # x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) - x1, res1 = PRIMA.prima_CUTEst(name; maxfun=5000) + x1, res1 = @inferred PRIMA.prima_CUTEst(name; maxfun=5000) @test issuccess(res1) - # x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) - x2, res2 = PRIMA.newuoa_CUTEst(name; maxfun=5000) + x2, res2 = @inferred PRIMA.newuoa_CUTEst(name; maxfun=5000) @test issuccess(res2) @test x1 ≈ x2 end