Skip to content

Commit 6a2ea4d

Browse files
lbenetKolaru
andauthored
Compatibility with IA v1 (#178)
* Initial fixes for compatibility with IA 1.0 * Update Project.toml * Maaaany scattered fixes * More fixes * Upgrade TaylorSeries version, and other fixes * Separate in a submodule validated integration stuff * First round of substitution * Fixes related to validated integration * Fix test errors * Further fixes * Fix docs * Fix a broken test * Fixes in displaying TMs... after upgrading IA to v0.23 * Small fixes * Fix TM.bound_taylor1 (and broken tests) * Use Bunger (2020) method to eval remainder of product * Use pown(ii, n) instead of ii^n, for ii::Interval, n::Int, and fix tests This avoids that the guarateed field of remainder is always false * Use ii^interval(n) instead of pown(ii,n); saves allocs * Bump IA to v1 :-) * Keep compatibility with IA v0.22 and v0.23 --------- Co-authored-by: Benoît Richard <[email protected]>
1 parent bcca0bb commit 6a2ea4d

27 files changed

+1293
-1104
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
.DS_Store
55
docs/build/
66
docs/site/
7+
8+
Manifest.toml

Project.toml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
name = "TaylorModels"
22
uuid = "314ce334-5f6e-57ae-acf6-00b6e903104a"
33
repo = "https://github.com/JuliaIntervals/TaylorModels.jl.git"
4-
version = "0.8.0"
4+
version = "0.9.0"
55

66
[deps]
77
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
88
IntervalRootFinding = "d2bf35a9-74e0-55ec-b149-d360ff49b807"
99
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1010
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
11+
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
1112
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1213
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1314
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
15+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1416
TaylorIntegration = "92b13dbe-c966-51a2-8445-caca9f8a7d42"
1517
TaylorSeries = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
1618

1719
[compat]
1820
Aqua = "0.8"
19-
IntervalArithmetic = "^0.20"
20-
IntervalRootFinding = "0.5"
21-
LinearAlgebra = "<0.0.1, 1"
22-
Markdown = "<0.0.1, 1"
23-
Random = "<0.0.1, 1"
21+
IntervalArithmetic = "0.22, 0.23, 1"
22+
IntervalRootFinding = "0.6"
23+
LinearAlgebra = "1"
24+
Markdown = "1"
25+
Parameters = "0.12.3"
26+
Random = "1"
2427
RecipesBase = "1"
2528
Reexport = "1"
26-
TaylorIntegration = "0.16"
27-
TaylorSeries = "0.18.4"
28-
Test = "<0.0.1, 1"
29+
StaticArrays = "1.9"
30+
TaylorIntegration = "0.17"
31+
TaylorSeries = "0.20"
32+
Test = "1"
2933
julia = "1.10"
3034

3135
[extras]

benchmark/daisy/multivariate.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ DAISY["himmilbeau"] = Dict("dom" => a×b,
55
"numvars" => 2,
66
"vars" => "x1 x2",
77
"f" => ((x1, x2) -> (x1*x1 + x2 - 11)*(x1 * x1 + x2 - 11) + (x1 + x2*x2 - 7)*(x1 + x2*x2 - 7)),
8-
"ref" => Interval(85.46830677734748, 221.7338939301446) # MOSEK deg 6
8+
"ref" => interval(85.46830677734748, 221.7338939301446) # MOSEK deg 6
99
)
1010

1111
DAISY["kepler1"] = Dict("dom" => a×b×c×d×e×f,
1212
"numvars" => 6,
1313
"vars" => "x1 x2 x3 x4 x5 x6",
1414
"f" => ((x1, x2, x3, x4, x5, x6) -> x2 * x5 + x3 * x6 - x2 * x3 - x5 * x6 + x1 * (-x1 + x2 + x3 - x4 + x5 + x6)),
15-
"ref" => Interval(-5.255935494810441, 7.321362422825775) # MOSEK deg 6
15+
"ref" => interval(-5.255935494810441, 7.321362422825775) # MOSEK deg 6
1616
)
1717

1818
DAISY["kepler2"] = Dict("dom" => a×b×c×d,
1919
"numvars" => 4,
2020
"vars" => "x1 x2 x3 x4",
2121
"f" => ((x1, x2, x3, x4) -> x1 * x4 * (-x1 + x2 + x3 - x4) +
2222
x2 * (x1 - x2 + x3 + x4) + x3 * (x1 + x2 - x3 + x4) -x2 * x3 * x4 - x1 * x3 - x1 * x2 - x4),
23-
"ref" => Interval(-195.36974909125482, 78.3669520644375) # MOSEK deg 6
23+
"ref" => interval(-195.36974909125482, 78.3669520644375) # MOSEK deg 6
2424
)
2525

2626
DAISY["kepler3"] = Dict("dom" => a×b×c×d×e×f,
@@ -29,19 +29,19 @@ DAISY["kepler3"] = Dict("dom" => a×b×c×d×e×f,
2929
"f" => ((x1, x2, x3, x4, x5, x6) -> x1 * x4 * (-x1 + x2 + x3 - x4 + x5 + x6) +
3030
x2 * x5 * (x1 - x2 + x3 + x4 - x5 + x6) +x3* x6 * (x1 + x2 - x3 + x4 + x5 - x6) -
3131
x2 * x3 * x4 -x1* x3* x5 - x1 * x2 * x6 - x4 * x5 * x6),
32-
"ref" => Interval(-309.8484155131222, 17.982082401462407) # MOSEK deg 6
32+
"ref" => interval(-309.8484155131222, 17.982082401462407) # MOSEK deg 6
3333
)
3434

3535
DAISY["Rigidbody1"] = Dict("dom" => a×b×c,
3636
"numvars" => 3,
3737
"vars" => "x1 x2 x3",
3838
"f" => ((x1, x2, x3) -> -x1*x2 - 2*x2*x3 - x1 - x3),
39-
"ref" => Interval(-20.786552979420335, -0.540012836551535) # MOSEK deg 6
39+
"ref" => interval(-20.786552979420335, -0.540012836551535) # MOSEK deg 6
4040
)
4141

4242
DAISY["Rigidbody2"] = Dict("dom" => a×b×c,
4343
"numvars" => 3,
4444
"vars" => "x1 x2 x3",
4545
"f" => ((x1, x2, x3) -> 2*(x1*x2*x3) + (3*x3*x3) - x2*(x1*x2*x3) + (3*x3*x3) - x2),
46-
"ref" => Interval(68.81138021006673, 359.98566570476504) # MOSEK deg 6
46+
"ref" => interval(68.81138021006673, 359.98566570476504) # MOSEK deg 6
4747
)

benchmark/daisy/setup.jl

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
# The following domains are used throughout the tests in Tables 3-5 in
66
# [1] Althoff, M., Grebenyuk, D., & Kochdumper, N. (2018). Implementation of Taylor models in CORA 2018.
77
# In Proc. of the 5th International Workshop on Applied Verification for Continuous and Hybrid Systems.
8-
a = Interval(-4.5, -0.3)
9-
b = Interval(0.4, 0.9)
10-
c = Interval(3.8, 7.8)
11-
d = Interval(8.0, 10.0)
12-
e = Interval(-10.0, 8.0)
13-
f = Interval(1.0, 2.0)
8+
a = interval(-4.5, -0.3)
9+
b = interval(0.4, 0.9)
10+
c = interval(3.8, 7.8)
11+
d = interval(8.0, 10.0)
12+
e = interval(-10.0, 8.0)
13+
f = interval(1.0, 2.0)
1414

1515
# ======================
1616
# Relative precision
@@ -27,7 +27,7 @@ function relative_precision(x, x_ref)
2727
x_ref_low, x_ref_high = inf(x_ref), sup(x_ref)
2828
rel_low = -(x_low - x_ref_low) / (x_ref_high - x_ref_low)
2929
rel_high = (x_high - x_ref_high) / (x_ref_high - x_ref_low)
30-
return 100 * Interval(rel_low, rel_high)
30+
return 100 * interval(rel_low, rel_high)
3131
end
3232

3333
# ==========================
@@ -36,37 +36,38 @@ end
3636

3737
# taylor model in one variable
3838
function bounds_TM(func::Function, dom::Interval, ord::Int)
39-
x0 = Interval(mid(dom))
39+
x0 = interval(mid(dom))
4040
x = TaylorModel1(ord, x0, dom)
4141
return evaluate(func(x), dom - x0)
4242
end
4343

4444
# taylor model in N variables
45-
function bounds_TM(func::Function, dom::IntervalBox{N}, ord) where {N}
46-
x0 = mid(dom)
45+
function bounds_TM(func::Function, dom::AbstractVector{<:Interval}, ord)
46+
x0 = mid.(dom)
4747
set_variables(Float64, "x", order=2ord, numvars=N)
48-
x = [TaylorModelN(i, ord, IntervalBox(x0), dom) for i=1:N]
48+
x = [TaylorModelN(i, ord, x0, dom) for i in eachindex(dom)]
4949
return evaluate(func(x...), dom - x0)
5050
end
5151

5252
# normalized taylor model in one variable
5353
function bounds_TM_NORM(func::Function, dom::Interval, ord::Int)
54-
x0 = Interval(mid(dom))
54+
x0 = interval(mid(dom))
5555
x = TaylorModel1(ord, x0, dom)
5656
xnorm = normalize_taylor(x.pol, dom - x0, true)
5757
xnormTM = TaylorModel1(xnorm, 0..0, 0..0, -1..1)
5858
return evaluate(func(xnormTM), -1..1)
5959
end
6060

6161
# normalized taylor model in N variables
62-
function bounds_TM_NORM(func::Function, dom::IntervalBox{N}, ord::Int) where {N}
63-
x0 = mid(dom)
62+
function bounds_TM_NORM(func::Function, dom::AbstractVector{<:Interval}, ord::Int)
63+
x0 = mid.(dom)
64+
N = length(dom)
6465
set_variables(Float64, "x", order=2ord, numvars=N)
6566

66-
zeroBox = IntervalBox(0..0, N)
67-
symBox = IntervalBox(-1..1, N)
67+
zeroBox = fill(0..0, N)
68+
symBox = fill(-1..1, N)
6869

69-
x = [TaylorModelN(i, ord, IntervalBox(x0), dom) for i=1:N]
70+
x = [TaylorModelN(i, ord, x0, dom) for i in eachindex(dom)]
7071
xnorm = [normalize_taylor(xi.pol, dom - x0, true) for xi in x]
7172
xnormTM = [TaylorModelN(xi_norm, 0..0, zeroBox, symBox) for xi_norm in xnorm]
7273
return evaluate(func(xnormTM...), symBox)

benchmark/daisy/univariate.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
DAISY["sine"] = Dict("dom" => a,
77
"numvars" => 1,
88
"f" => (x -> sin(x)),
9-
"ref" => Interval(-1.0, 0.977530117665097) # (*)
9+
"ref" => interval(-1.0, 0.977530117665097) # (*)
1010
)
1111

1212
DAISY["bspline0"] = Dict("dom" => a,
1313
"numvars" => 1,
1414
"f" => (x -> (1 - x) * (1 - x) * (1 - x) / 6.0),
15-
"ref" => Interval(0.36616666666666675, 27.729166666666668) # (*)
15+
"ref" => interval(0.36616666666666675, 27.729166666666668) # (*)
1616
)
1717

1818
DAISY["bspline1"] = Dict("dom" => a,
1919
"numvars" => 1,
2020
"f" => (x -> (3*x*x*x - 6*x*x + 4) / 6.0),
21-
"ref" => Interval(-65.14583333333333, 0.5631666666666667) # (*)
21+
"ref" => interval(-65.14583333333333, 0.5631666666666667) # (*)
2222
)
2323

2424
DAISY["bspline2"] = Dict("dom" => a,
2525
"numvars" => 1,
2626
"f" => (x -> (-3*x*x*x + 3*x*x + 3*x + 1) / 6.0),
27-
"ref" => Interval(0.07516666666666667, 53.604166666666664) # (*)
27+
"ref" => interval(0.07516666666666667, 53.604166666666664) # (*)
2828
)
2929

3030
DAISY["bspline3"] = Dict("dom" => a,
3131
"numvars" => 1,
3232
"f" => (x -> -x*x*x / 6.0),
33-
"ref" => Interval(0.0045, 15.1875) # (*)
33+
"ref" => interval(0.0045, 15.1875) # (*)
3434
)

docs/src/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
```
55

66
```@autodocs
7-
Modules = [TaylorModels]
7+
Modules = [TaylorModels, TaylorModels.ValidatedInteg]
88
```

src/TaylorModels.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
module TaylorModels
22

33
using Reexport
4-
@reexport using TaylorSeries, IntervalArithmetic
5-
@reexport using TaylorIntegration
4+
@reexport using TaylorSeries, IntervalArithmetic, IntervalArithmetic.Symbols
5+
# @reexport using TaylorIntegration
66

77
using IntervalRootFinding
8-
using LinearAlgebra: norm, mul!, cond, isposdef
8+
using LinearAlgebra: norm, isposdef
9+
using StaticArrays
910

1011
using RecipesBase
1112

@@ -29,22 +30,23 @@ import LinearAlgebra: norm
2930
export TaylorModel1, RTaylorModel1, TaylorModelN, TMSol
3031

3132
export remainder, polynomial, domain, expansion_point, flowpipe, get_xTM,
32-
rpa, fp_rpa, bound_remainder, centered_dom,
33-
validated_integ, validated_integ2
33+
rpa, fp_rpa, bound_remainder, centered_dom, symmetric_box
3434

3535
export linear_dominated_bounder, quadratic_fast_bounder
3636

37+
38+
setdisplay(:full)
39+
3740
include("constructors.jl")
3841
include("auxiliary.jl")
3942
include("promotion.jl")
4043
include("bounds.jl")
4144
include("evaluate.jl")
42-
include("rpa_functions.jl")
4345
include("arithmetic.jl")
46+
include("rpa_functions.jl")
4447
include("integration.jl")
4548
include("show.jl")
46-
include("valid_integ/validated_integ.jl")
47-
include("valid_integ/validated_integ2.jl")
49+
include("valid_integ/ValidatedInteg.jl")
4850
include("recipe.jl")
4951

5052

0 commit comments

Comments
 (0)