Skip to content

Commit

Permalink
Merge pull request #728 from JuliaReach/schillic/Interval
Browse files Browse the repository at this point in the history
Update to LazySets v2.11
  • Loading branch information
schillic authored Aug 27, 2023
2 parents fb276a4 + 19ff3f8 commit 6834322
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ExprTools = "0.1"
HybridSystems = "0.4"
IntervalArithmetic = "0.16 - 0.20"
IntervalMatrices = "0.6 - 0.8"
LazySets = "2.7.5"
LazySets = "2.11"
MathematicalSystems = "0.11 - 0.13"
Parameters = "0.10 - 0.12"
ReachabilityBase = "0.1, 0.2"
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/BFFPSV18/BFFPSV18.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function BFFPSV18(; δ::N,
lazy_initial_set, lazy_input, sparse, view)
end

_concretize_setrep(setrep::Type{Interval}, N) = Interval{N,IntervalArithmetic.Interval{N}}
_concretize_setrep(setrep::Type{Interval}, N) = Interval{N}
_concretize_setrep(setrep::Type{Hyperrectangle}, N) = Hyperrectangle{N,Vector{N},Vector{N}}

# blocks of size 1
Expand Down
4 changes: 2 additions & 2 deletions src/Algorithms/INT/INT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ end

step_size(alg::INT) = alg.δ
numtype(::INT{N}) where {N} = N
setrep(::INT{N}) where {N} = Interval{N,IA.Interval{N}}
rsetrep(::INT{N}) where {N} = ReachSet{N,Interval{N,IA.Interval{N}}}
setrep(::INT{N}) where {N} = Interval{N}
rsetrep(::INT{N}) where {N} = ReachSet{N,Interval{N}}

include("post.jl")
include("reach_homog.jl")
Expand Down
8 changes: 4 additions & 4 deletions src/Algorithms/INT/reach_homog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# ================

# homogeneous case; no invariant; recursive implementation
function reach_homog_INT!(F::Vector{ReachSet{N,Interval{N,IA.Interval{N}}}},
Ω0::Interval{N,IA.Interval{N}},
function reach_homog_INT!(F::Vector{ReachSet{N,Interval{N}}},
Ω0::Interval{N},
Φ::N,
NSTEPS::Integer,
δ::Float64,
Expand All @@ -25,8 +25,8 @@ function reach_homog_INT!(F::Vector{ReachSet{N,Interval{N,IA.Interval{N}}}},
end

# homogeneous case; with invariant; recursive implementation
function reach_homog_INT!(F::Vector{ReachSet{N,Interval{N,IA.Interval{N}}}},
Ω0::Interval{N,IA.Interval{N}},
function reach_homog_INT!(F::Vector{ReachSet{N,Interval{N}}},
Ω0::Interval{N},
Φ::N,
NSTEPS::Integer,
δ::Float64,
Expand Down
8 changes: 4 additions & 4 deletions src/Algorithms/INT/reach_inhomog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# ===================

# inhomogeneous case; no invariant; recursive implementation
function reach_inhomog_INT!(F::Vector{ReachSet{N,Interval{N,IA.Interval{N}}}},
Ω0::Interval{N,IA.Interval{N}},
function reach_inhomog_INT!(F::Vector{ReachSet{N,Interval{N}}},
Ω0::Interval{N},
Φ::N,
NSTEPS::Integer,
δ::Float64,
Expand All @@ -27,8 +27,8 @@ function reach_inhomog_INT!(F::Vector{ReachSet{N,Interval{N,IA.Interval{N}}}},
end

# inhomogeneous case; with invariant; recursive implementation
function reach_inhomog_INT!(F::Vector{ReachSet{N,Interval{N,IA.Interval{N}}}},
Ω0::Interval{N,IA.Interval{N}},
function reach_inhomog_INT!(F::Vector{ReachSet{N,Interval{N}}},
Ω0::Interval{N},
Φ::N,
NSTEPS::Integer,
δ::Float64,
Expand Down
4 changes: 2 additions & 2 deletions src/Algorithms/QINT/QINT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ end

step_size(alg::QINT) = alg.δ
numtype(::QINT{N}) where {N} = N
setrep(::QINT{N}) where {N} = Interval{N,IA.Interval{N}}
rsetrep(::QINT{N}) where {N} = ReachSet{N,Interval{N,IA.Interval{N}}}
setrep(::QINT{N}) where {N} = Interval{N}
rsetrep(::QINT{N}) where {N} = ReachSet{N,Interval{N}}

include("post.jl")
include("reach_homog.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/Algorithms/QINT/reach_homog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function reach_homog_QINT(; a, b, c, # right-hand side: f(x) = ax^2 + bx + c
maxiter) where {N}

# total flowpipe
RT = ReachSet{N,Interval{N,IA.Interval{N}}}
RT = ReachSet{N,Interval{N}}
VRT = Vector{RT}
FT = Flowpipe{N,RT,VRT}
Ftot = Vector{FT}()
Expand Down
2 changes: 1 addition & 1 deletion src/Continuous/normalization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ for (CAC_S, CLC_S) in ((:CACCS, :CLCCS), (:CACDS, :CLCDS))
end

# fix type inference
function _normalize(ivp::IVP{LCS{N,IdentityMultiple{N}},Interval{N,IA.Interval{N}}}) where {N}
function _normalize(ivp::IVP{LCS{N,IdentityMultiple{N}},Interval{N}}) where {N}
return IVP(CLCS(ivp.s.A, Universe(1)), ivp.x0)
end

Expand Down
2 changes: 1 addition & 1 deletion src/Discretization/Forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function discretize(ivp::IVP{<:CLCS,<:LazySet}, δ, alg::Forward)
return InitialValueProblem(Sdis, Ω0)
end

function discretize(ivp::IVP{<:CLCS,Interval{N,IA.Interval{N}}}, δ, alg::Forward) where {N}
function discretize(ivp::IVP{<:CLCS,Interval{N}}, δ, alg::Forward) where {N}
A = state_matrix(ivp)
@assert size(A, 1) == 1
X0 = initial_state(ivp)
Expand Down
2 changes: 1 addition & 1 deletion src/Flowpipes/Flowpipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function flatten(fp::Flowpipe{N,<:TemplateReachSet}, rows=(1, 2)) where {N}
idx_pos_dir = rows[1]
idx_neg_dir = rows[2]

RT = ReachSet{N,Interval{N,IA.Interval{N}}}
RT = ReachSet{N,Interval{N}}
out = Vector{RT}(undef, length(fp))

@inbounds for (k, Rk) in enumerate(fp)
Expand Down
9 changes: 5 additions & 4 deletions test/algorithms/BFFPSV18.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
@test alg.block_indices == [2]
@test alg.row_blocks == [[2]]
@test alg.column_blocks == [[1], [2], [3], [4]]
@test setrep(alg) == Interval{Float64,IA.Interval{Float64}}
@test setrep(alg) == Interval{Float64}

# interval (1D) decomposition, one variable, without explicitly passing Interval
alg = BFFPSV18(; δ=1e-3, vars=[2], dim=4)
@test alg.vars == [2]
@test alg.block_indices == [2]
@test alg.row_blocks == [[2]]
@test alg.column_blocks == [[1], [2], [3], [4]]
@test setrep(alg) == Interval{Float64,IA.Interval{Float64}}
@test setrep(alg) == Interval{Float64}

# interval (1D) decomposition, two variables
alg = BFFPSV18(; δ=1e-3, vars=[1, 4], dim=4)
@test alg.vars == [1, 4]
@test alg.block_indices == [1, 4]
@test alg.row_blocks == [[1], [4]]
@test alg.column_blocks == [[1], [2], [3], [4]]
@test setrep(alg) == Interval{Float64,IA.Interval{Float64}}
@test setrep(alg) == Interval{Float64}

# hyperrectangle decomposition
alg = BFFPSV18(; δ=1e-3, setrep=Hyperrectangle, vars=[3], partition=[[1], [2, 3, 4]])
Expand All @@ -47,7 +47,8 @@
@test alg.row_blocks == [[25]]
@test alg.column_blocks == [1:24, [25], 26:48]

# hyperrectangular decomposition with different block sizes, with varables belonging to different blocks
# hyperrectangular decomposition with different block sizes, with variables belonging to
# different blocks
alg = BFFPSV18(; δ=1e-3, setrep=Hyperrectangle, vars=[25, 37, 40],
partition=[1:24, [25], 26:48])
@test alg.vars == [25, 37, 40]
Expand Down
2 changes: 1 addition & 1 deletion test/algorithms/INT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@test dim(sol) == 1
@test length(sol) == 100
@test setrep(sol) <: Interval
@test setrep(sol) == Interval{Float64,IA.Interval{Float64}}
@test setrep(sol) == Interval{Float64}

prob, tspan = exponential_1d(; invariant=HalfSpace([-1.0], -0.3)) # x >= 0.3
sol_inv = solve(prob; tspan=tspan, alg=INT(; δ=0.01))
Expand Down

0 comments on commit 6834322

Please sign in to comment.