Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back SDPA #170

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ Base.@kwdef struct TaylorModelsEnclosure <: AbstractDirectRangeAlgorithm
normalize::Bool = true
end

# TODO turn example below into doctest when SDPA works again
"""
SumOfSquaresEnclosure{T} <: AbstractIterativeRangeAlgorithm

Expand All @@ -148,7 +147,7 @@ result of this algorithm is not rigorous.

### Examples

```example
```jldoctest
julia> using SumOfSquares, SDPA, DynamicPolynomials

julia> backend = SDPA.Optimizer;
Expand Down
15 changes: 3 additions & 12 deletions test/multivariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,9 @@ end
# Note: DynamicPolynomials automatically expands p, and evaluation using
# interval arithmetic gives a worse left bound than the factored expression.

if Sys.iswindows() || VERSION >= v"1.10"
# SDPA is broken on Windows or v1.10
@test_broken begin
x = enclose(p, dom, SumOfSquaresEnclosure(; backend=SDPA.Optimizer))
isapprox(inf(x), 0.0; atol=1e-3)
isapprox(sup(x), 670.612; atol=1e-3)
end
else
x = enclose(p, dom, SumOfSquaresEnclosure(; backend=SDPA.Optimizer))
@test isapprox(inf(x), 0.0; atol=1e-3)
@test isapprox(sup(x), 670.612; atol=1e-3)
end
x = enclose(p, dom, SumOfSquaresEnclosure(; backend=SDPA.Optimizer))
@test isapprox(inf(x), 0.0; atol=1e-3)
@test isapprox(sup(x), 670.612; atol=1e-3)
end

@testset "Taylor-model solver without normalization" begin
Expand Down
20 changes: 5 additions & 15 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
using Test, RangeEnclosures
using AffineArithmetic, IntervalOptimisation, TaylorModels, SumOfSquares

@static if Sys.iswindows() || VERSION >= v"1.10"
# SDPA is broken on Windows or v1.10
@test_broken using SDPA
else
using SDPA
end

using AffineArithmetic, IntervalOptimisation, TaylorModels, SDPA, SumOfSquares
using DynamicPolynomials: @polyvar

available_solvers = (NaturalEnclosure(),
Expand All @@ -21,12 +13,10 @@ include("univariate.jl")
include("multivariate.jl")
include("paper.jl")

@static if !Sys.iswindows() # broken due to SDPA
using Documenter
include("../docs/init.jl")
@testset "doctests" begin
doctest(RangeEnclosures)
end
using Documenter
include("../docs/init.jl")
@testset "doctests" begin
doctest(RangeEnclosures)
end

include("Aqua.jl")
18 changes: 4 additions & 14 deletions test/univariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,10 @@ end
rleft, rright = relative_precision(x, xref)
@test rleft ≤ 1e-5 && rright ≤ 1e-5

if Sys.iswindows() || VERSION >= v"1.10"
# SDPA is broken on Windows or v1.10
@test_broken begin
x = enclose(p, dom, SumOfSquaresEnclosure(; backend=SDPA.Optimizer))
xref = interval(4.8333, 10.541)
rleft, rright = relative_precision(x, xref)
rleft ≤ 1e-5 && rright ≤ 1e-5
end
else
x = enclose(p, dom, SumOfSquaresEnclosure(; backend=SDPA.Optimizer))
xref = interval(4.8333, 10.541)
rleft, rright = relative_precision(x, xref)
@test rleft ≤ 1e-5 && rright ≤ 1e-5
end
x = enclose(p, dom, SumOfSquaresEnclosure(; backend=SDPA.Optimizer))
xref = interval(4.8333, 10.541)
rleft, rright = relative_precision(x, xref)
@test rleft ≤ 1e-5 && rright ≤ 1e-5
end

@testset "Taylor-model solver without normalization" begin
Expand Down
Loading