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 f6e3274f..df00fbe8 100644 --- a/Project.toml +++ b/Project.toml @@ -15,18 +15,29 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] -Distributions = "0.21, 0.22, 0.23, 0.24, 0.25" +Aqua = "0.8" +Cubature = "1.5" +Distributions = "0.25.71" ExtendableSparse = "1" -Flux = "0.12, 0.13" -GLM = "1.3" +Flux = "0.13" +ForwardDiff = "0.10.19" +GLM = "1.5" IterativeSolvers = "0.9" -PolyChaos = "0.2" -QuasiMonteCarlo = "0.3" -Statistics = "1" -Zygote = "0.4, 0.5, 0.6" -julia = "1.9" +LinearAlgebra = "1.10" +PolyChaos = "0.2.5" +Pkg = "1" +QuadGK = "2.4" +QuasiMonteCarlo = "0.3.1" +SafeTestsets = "0.1" +SparseArrays = "1.10" +Statistics = "1.10" +Test = "1" +Tracker = "0.2.18" +Zygote = "0.6.62" +julia = "1.10" [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/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/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..57158f31 --- /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) + 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..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) @@ -10,6 +9,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",