From e19951e8ce08a75a81008bf6ebab8f629f9aaf06 Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Thu, 28 Dec 2023 14:02:12 +0100 Subject: [PATCH 1/4] Aqua CI --- Project.toml | 13 ++++++++++++- src/Optimization.jl | 2 +- src/Surrogates.jl | 5 ++--- test/qa.jl | 11 +++++++++++ test/runtests.jl | 3 +++ 5 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test/qa.jl diff --git a/Project.toml b/Project.toml index f6e3274f..0f082238 100644 --- a/Project.toml +++ b/Project.toml @@ -15,18 +15,29 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] +Aqua = "0.8" +Cubature = "1" Distributions = "0.21, 0.22, 0.23, 0.24, 0.25" ExtendableSparse = "1" Flux = "0.12, 0.13" +ForwardDiff = "0.10" GLM = "1.3" IterativeSolvers = "0.9" +LinearAlgebra = "1.9" PolyChaos = "0.2" +Pkg = "1" +QuadGK = "2" QuasiMonteCarlo = "0.3" +SafeTestsets = "0.1" +SparseArrays = "1.9" Statistics = "1" +Test = "1" +Tracker = "0.2" Zygote = "0.4, 0.5, 0.6" julia = "1.9" [extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Cubature = "667455a9-e2ce-5579-9412-b964f529a492" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" @@ -38,4 +49,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" [targets] -test = ["Cubature", "SafeTestsets", "Flux", "ForwardDiff", "PolyChaos", "QuadGK", "Test", "Tracker", "Pkg"] +test = ["Aqua", "Cubature", "SafeTestsets", "Flux", "ForwardDiff", "PolyChaos", "QuadGK", "Test", "Tracker", "Pkg"] diff --git a/src/Optimization.jl b/src/Optimization.jl index cc615a98..82e0996f 100755 --- a/src/Optimization.jl +++ b/src/Optimization.jl @@ -2045,7 +2045,7 @@ function surrogate_optimize(obj, rtea::RTEA, lb, ub, surrRTEAND::AbstractSurroga return pareto_set, pareto_front end -function surrogate_optimize(obj::Function, ::EI, lb, ub, krig, sample_type::SectionSample; +function surrogate_optimize(obj::Function, ::EI, lb::AbstractArray, ub::AbstractArray, krig, sample_type::SectionSample; maxiters = 100, num_new_samples = 100) dtol = 1e-3 * norm(ub - lb) eps = 0.01 diff --git a/src/Surrogates.jl b/src/Surrogates.jl index 0d388a6a..c9d5a1de 100755 --- a/src/Surrogates.jl +++ b/src/Surrogates.jl @@ -89,7 +89,7 @@ export LobachevskyStructure, SecondOrderPolynomialStructure export WendlandStructure export AbstractSurrogate, SamplingAlgorithm -export Kriging, RadialBasis, add_point!, current_estimate, std_error_at_point +export Kriging, RadialBasis, add_point!, std_error_at_point # Parallelization Strategies export potential_optimal_points export MinimumConstantLiar, MaximumConstantLiar, MeanConstantLiar, KrigingBeliever, @@ -104,10 +104,9 @@ export sample, GridSample, RandomSample, SobolSample, LatinHypercubeSample, export RandomSample, KroneckerSample, GoldenSample, SectionSample # Optimization algorithms -export SRBF, LCBS, EI, DYCORS, SOP, EGO, RTEA, SMB, surrogate_optimize +export SRBF, LCBS, EI, DYCORS, SOP, RTEA, SMB, surrogate_optimize export LobachevskySurrogate, lobachevsky_integral, lobachevsky_integrate_dimension export LinearSurrogate -export SVMSurrogate export InverseDistanceSurrogate export SecondOrderPolynomialSurrogate export Wendland diff --git a/test/qa.jl b/test/qa.jl new file mode 100644 index 00000000..53f65d36 --- /dev/null +++ b/test/qa.jl @@ -0,0 +1,11 @@ +using Surrogates, Aqua +@testset "Aqua" begin + Aqua.find_persistent_tasks_deps(Surrogates) + Aqua.test_ambiguities(Surrogates, recursive = false) + Aqua.test_deps_compat(Surrogates) + Aqua.test_piracies(Surrogates, broken = true) + Aqua.test_project_extras(Surrogates) + Aqua.test_stale_deps(Surrogates) + Aqua.test_unbound_args(Surrogates) + Aqua.test_undefined_exports(Surrogates) +end diff --git a/test/runtests.jl b/test/runtests.jl index b94a25ac..0c39dc03 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -10,6 +10,9 @@ function dev_subpkg(subpkg) end @testset "Surrogates" begin + @safetestset "Quality Assurance" begin + include("qa.jl") + end @testset "Libs" begin @testset "$pkg" for pkg in [ "SurrogatesAbstractGPs", "SurrogatesFlux", From 8c3659c45c70e65e6ba5c381cd04f4b6b6174e63 Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Thu, 28 Dec 2023 16:16:58 +0100 Subject: [PATCH 2/4] Downgrade CI --- .github/workflows/Downgrade.yml | 29 +++++++++++++++++++++++++++++ Project.toml | 22 +++++++++++----------- test/runtests.jl | 1 - 3 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/Downgrade.yml diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml new file mode 100644 index 00000000..01ff8cad --- /dev/null +++ b/.github/workflows/Downgrade.yml @@ -0,0 +1,29 @@ +name: Downgrade +on: + pull_request: + branches: + - master + paths-ignore: + - 'docs/**' + push: + branches: + - master + paths-ignore: + - 'docs/**' +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + version: ['1'] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + - uses: cjdoris/julia-downgrade-compat-action@v1 +# if: ${{ matrix.version == '1.6' }} + with: + skip: Pkg,TOML + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 \ No newline at end of file diff --git a/Project.toml b/Project.toml index 0f082238..b97bfaa0 100644 --- a/Project.toml +++ b/Project.toml @@ -16,24 +16,24 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] Aqua = "0.8" -Cubature = "1" -Distributions = "0.21, 0.22, 0.23, 0.24, 0.25" +Cubature = "1.5" +Distributions = "0.25.71" ExtendableSparse = "1" -Flux = "0.12, 0.13" -ForwardDiff = "0.10" -GLM = "1.3" +Flux = "0.13" +ForwardDiff = "0.10.19" +GLM = "1.5" IterativeSolvers = "0.9" LinearAlgebra = "1.9" -PolyChaos = "0.2" +PolyChaos = "0.2.5" Pkg = "1" -QuadGK = "2" -QuasiMonteCarlo = "0.3" +QuadGK = "2.4" +QuasiMonteCarlo = "0.3.1" SafeTestsets = "0.1" SparseArrays = "1.9" -Statistics = "1" +Statistics = "1.9" Test = "1" -Tracker = "0.2" -Zygote = "0.4, 0.5, 0.6" +Tracker = "0.2.18" +Zygote = "0.6.36" julia = "1.9" [extras] diff --git a/test/runtests.jl b/test/runtests.jl index 0c39dc03..5b1d127b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,6 @@ using Surrogates using Test using SafeTestsets using Pkg -VERSION <= v"1.7" && Pkg.add(name = "Statistics", version = VERSION) function dev_subpkg(subpkg) subpkg_path = joinpath(dirname(@__DIR__), "lib", subpkg) From fb53ec764823460c296ecb867fd4e833a4ed6e28 Mon Sep 17 00:00:00 2001 From: ArnoStrouwen Date: Thu, 28 Dec 2023 17:32:29 +0100 Subject: [PATCH 3/4] fix type piracy --- src/Radials.jl | 7 ++++--- test/qa.jl | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Radials.jl b/src/Radials.jl index d60f3ca4..9b0a0a13 100644 --- a/src/Radials.jl +++ b/src/Radials.jl @@ -1,7 +1,8 @@ using LinearAlgebra using ExtendableSparse -Base.copy(t::Tuple) = t +_copy(t::Tuple) = t +_copy(t) = copy(t) mutable struct RadialBasis{F, Q, X, Y, L, U, C, S, D} <: AbstractSurrogate phi::F @@ -58,9 +59,9 @@ function _calc_coeffs(x, y, lb, ub, phi, q, scale_factor, sparse) D = _construct_rbf_interp_matrix(x, first(x), lb, ub, phi, q, scale_factor, sparse) Y = _construct_rbf_y_matrix(y, first(y), length(y) + num_poly_terms) if (typeof(y) == Vector{Float64}) #single output case - coeff = copy(transpose(D \ y)) + coeff = _copy(transpose(D \ y)) else - coeff = copy(transpose(D \ Y[1:size(D)[1], :])) #if y is multi output; + coeff = _copy(transpose(D \ Y[1:size(D)[1], :])) #if y is multi output; end return coeff end diff --git a/test/qa.jl b/test/qa.jl index 53f65d36..57158f31 100644 --- a/test/qa.jl +++ b/test/qa.jl @@ -3,7 +3,7 @@ using Surrogates, Aqua Aqua.find_persistent_tasks_deps(Surrogates) Aqua.test_ambiguities(Surrogates, recursive = false) Aqua.test_deps_compat(Surrogates) - Aqua.test_piracies(Surrogates, broken = true) + Aqua.test_piracies(Surrogates) Aqua.test_project_extras(Surrogates) Aqua.test_stale_deps(Surrogates) Aqua.test_unbound_args(Surrogates) From 3fd8d0b08f8230b8df632fe330877fb3a749c318 Mon Sep 17 00:00:00 2001 From: ArnoStrouwen Date: Thu, 28 Dec 2023 18:33:43 +0100 Subject: [PATCH 4/4] Julia 1.10 compat maintenance --- Project.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index b97bfaa0..df00fbe8 100644 --- a/Project.toml +++ b/Project.toml @@ -23,18 +23,18 @@ Flux = "0.13" ForwardDiff = "0.10.19" GLM = "1.5" IterativeSolvers = "0.9" -LinearAlgebra = "1.9" +LinearAlgebra = "1.10" PolyChaos = "0.2.5" Pkg = "1" QuadGK = "2.4" QuasiMonteCarlo = "0.3.1" SafeTestsets = "0.1" -SparseArrays = "1.9" -Statistics = "1.9" +SparseArrays = "1.10" +Statistics = "1.10" Test = "1" Tracker = "0.2.18" -Zygote = "0.6.36" -julia = "1.9" +Zygote = "0.6.62" +julia = "1.10" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"