Skip to content

Commit

Permalink
fix flowpipe type
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Mar 17, 2020
1 parent 12be071 commit dc37595
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Expokit = "0.2"
HybridSystems = "0.3"
IntervalArithmetic = "0.15, 0.16"
IntervalMatrices = "0.5, 0.6"
LazySets = "1.30, 1.31"
LazySets = "1.32"
MathematicalPredicates = "0.1"
MathematicalSystems = "0.10, 0.11"
Memento = "0.10, 0.11, 0.12"
Expand Down
19 changes: 16 additions & 3 deletions src/ReachSets/ContinuousPost/GLGM06/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ function post(𝒜::GLGM06,
# Flowpipe computation
# =====================

# preallocate output
Rsets = Vector{ReachSet{Zonotope{Float64}}}(undef, N)
# preallocate output (and convert to concrete vector and matrixes)
if typeof(Φ) != Matrix{Float64}
Φ = Matrix(Φ)
end
G = genmat(Ω0)
if typeof(G) != Matrix{Float64}
Ω0 = Zonotope(center(Ω0), Matrix(G))
end
ZT = Zonotope{Float64, Vector{Float64}, Matrix{Float64}}
Rsets = Vector{ReachSet{ZT}}(undef, N)

info("Reachable States Computation...")
@timing begin
Expand All @@ -31,8 +39,13 @@ function post(𝒜::GLGM06,

else
U = inputset(𝑃_discrete)
V = next_set(U)
G = genmat(V)
if typeof(G) != Matrix{Float64}
V = Zonotope(center(V), Matrix(G))
end
max_order = 𝑂[:max_order]
reach_inhomog!(Rsets, Ω0, U, Φ, N, δ, max_order)
reach_inhomog!(Rsets, Ω0, V, Φ, N, δ, max_order)
end
end # timing

Expand Down
11 changes: 7 additions & 4 deletions src/ReachSets/ContinuousPost/GLGM06/reach.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Homogeneous case
# ================

function reach_homog!(R::Vector{ReachSet{Zonotope{Float64}}},
function reach_homog!(R::Vector{<:ReachSet{<:Zonotope}},
Ω0::Zonotope,
Φ::AbstractMatrix,
N::Int,
Expand All @@ -27,9 +27,9 @@ end
# Inhomogeneous case
# ==================

function reach_inhomog!(R::Vector{ReachSet{Zonotope{Float64}}},
function reach_inhomog!(R::Vector{<:ReachSet{<:Zonotope}},
Ω0::Zonotope,
U::ConstantInput,
V::Zonotope,
Φ::AbstractMatrix,
N::Int,
δ::Float64,
Expand All @@ -38,7 +38,6 @@ function reach_inhomog!(R::Vector{ReachSet{Zonotope{Float64}}},
t0, t1 = zero(δ), δ
R[1] = ReachSet(Ω0, t0, t1)

V = next_set(U)
Wk₊ = V
Φ_power_k = copy(Φ)
Φ_power_k_cache = similar(Φ)
Expand All @@ -47,6 +46,10 @@ function reach_inhomog!(R::Vector{ReachSet{Zonotope{Float64}}},
while k <= N
Rₖ = minkowski_sum(linear_map(Φ_power_k, Ω0), Wk₊)
Rₖ = reduce_order(Rₖ, max_order)
G = genmat(Rₖ)
if typeof(G) != Matrix{Float64}
Rₖ = Zonotope(center(Rₖ), Matrix(G))
end
t0 = t1
t1 += δ
R[k] = ReachSet(Rₖ, t0, t1)
Expand Down

0 comments on commit dc37595

Please sign in to comment.