Skip to content

Commit 4292e76

Browse files
authored
Merge pull request #931 from JuliaReach/test_rem_gens
Add reachability algorithm `HLBS25` for linear parametrix systems
2 parents 3aa3d3d + fbb79a9 commit 4292e76

File tree

19 files changed

+373
-5
lines changed

19 files changed

+373
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ IntervalArithmetic = "0.16 - 0.20, =0.20.9" # new versions require updates and
3131
IntervalMatrices = "0.11"
3232
LazySets = "2.14, 3, 4, 5"
3333
LinearAlgebra = "<0.0.1, 1.6"
34-
MathematicalSystems = "0.11 - 0.14"
34+
MathematicalSystems = "0.14.1"
3535
Parameters = "0.10 - 0.12"
3636
Random = "<0.0.1, 1.6"
3737
ReachabilityBase = "0.3.1"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ JLD2 = "0.4 - 0.6"
2424
LaTeXStrings = "1"
2525
LazySets = "2.14, 3, 4, 5"
2626
Literate = "2"
27-
MathematicalSystems = "0.11 - 0.14"
27+
MathematicalSystems = "0.14.1"
2828
OrdinaryDiffEq = "6"
2929
Plots = "1"
3030
ReachabilityBase = "0.2.3 - 0.3"

docs/make.jl

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ TAYLOR_METHODS = ["Taylor methods" => [
7777
# #
7878
# ]]
7979

80+
PARAMETRIC_SYSTEMS = ["Parametric systems" => [
81+
#
82+
"Parametric reachability" => "man/parametric.md"
83+
#
84+
]]
85+
8086
HYBRID_SYSTEMS = ["Hybrid systems" => [
8187
#
8288
#"Introduction" => "tutorials/hybrid_systems/introduction.md",
@@ -153,6 +159,18 @@ NONLINEAR_SOLVERS_API = [
153159
#
154160
]
155161

162+
PARAMETRIC_SOLVERS = [
163+
#
164+
"HLBS25" => "man/algorithms/HLBS25.md"
165+
#
166+
]
167+
168+
PARAMETRIC_SOLVERS_API = [
169+
#
170+
"HLBS25" => "lib/algorithms/HLBS25.md"
171+
#
172+
]
173+
156174
# ========================
157175
# Docs contents
158176
# ========================
@@ -173,7 +191,7 @@ makedocs(; sitename="ReachabilityAnalysis.jl",
173191
LINEAR_METHODS,
174192
UNCERTAIN_INPUTS,
175193
TAYLOR_METHODS,
176-
#UNCERTAIN_PARAMETERS,
194+
PARAMETRIC_SYSTEMS,
177195
#LINEAR_PDE,
178196
HYBRID_SYSTEMS,
179197
CLOCKED_SYSTEMS
@@ -184,7 +202,8 @@ makedocs(; sitename="ReachabilityAnalysis.jl",
184202
"Systems" => "man/systems.md",
185203
#"Reach-sets" => "man/reachsets.md",
186204
#"Flowpipes" => "man/flowpipes.md",
187-
"Linear solvers" => LINEAR_SOLVERS
205+
"Linear solvers" => LINEAR_SOLVERS,
206+
"Parametric solvers" => PARAMETRIC_SOLVERS
188207
#"Nonlinear solvers" => NONLINEAR_SOLVERS,
189208
#"Solutions" => "man/solutions.md",
190209
#"Invariants" => "man/invariants.md",
@@ -221,6 +240,7 @@ makedocs(; sitename="ReachabilityAnalysis.jl",
221240
"Flowpipes" => "lib/flowpipes.md",
222241
"Linear solvers" => LINEAR_SOLVERS_API,
223242
"Nonlinear solvers" => NONLINEAR_SOLVERS_API,
243+
"Parametric solvers" => PARAMETRIC_SOLVERS_API,
224244
"Solutions" => "lib/solutions.md",
225245
"Discretization" => "lib/discretize.md",
226246
"Projections" => "lib/projections.md",

docs/src/lib/algorithms/HLBS25.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# HLBS25
2+
```@docs
3+
HLBS25
4+
```

docs/src/lib/discretize.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ FirstOrderZonotope
2929
SecondOrderddt
3030
CorrectionHull
3131
StepIntersect
32+
CorrectionHullMatrixZonotope
3233
```
3334

3435
## Exponentiation

docs/src/man/algorithms/HLBS25.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reachability of parametric linear systems (HLBS25)
2+
3+
## Method
4+
5+
This method computes the reachability analysis of linear systems with parametric uncertainty. The method is based on matrix zonotopes to represent the uncertain parameters of the system.

docs/src/man/parametric.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,15 @@ CurrentModule = ReachabilityAnalysis
44
```
55

66
# Parametric reachability
7+
8+
The reachability analysis of parametric systems is performed by the `solve` function.
9+
The following algorithms are available:
10+
11+
```@contents
12+
Pages = ["HLBS25.md"]
13+
Depth = 3
14+
```
15+
16+
```@meta
17+
CurrentModule = ReachabilityAnalysis
18+
```

docs/src/refs.bib

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,3 +687,18 @@ @inproceedings{ForetsS22
687687
url = {https://doi.org/10.1007/978-3-031-07727-2_9},
688688
doi = {10.1007/978-3-031-07727-2_9}
689689
}
690+
691+
@article{HuangLBS2025,
692+
author = {Yushen Huang and
693+
Ertai Luo and
694+
Stanley Bak and
695+
Yifan Sun},
696+
title = {Reachability analysis for linear systems with uncertain parameters using polynomial zonotopes},
697+
journal = {Nonlinear Analysis: Hybrid Systems},
698+
volume = {56},
699+
pages = {101571},
700+
year = {2025},
701+
issn = {1751-570X},
702+
url = {https://www.sciencedirect.com/science/article/pii/S1751570X24001080},
703+
doi = {10.1016/j.nahs.2024.101571}
704+
}

src/Algorithms/HLBS25/HLBS25.jl

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import IntervalArithmetic as IA
2+
3+
"""
4+
HLBS25{N, AM, RM, R} <: AbstractContinuousPost
5+
6+
Implementation of the reachability algorithm for linear systems with parametric
7+
uncertainty using matrix zonotopes by [HuangLBS25](@citet).
8+
9+
### Fields
10+
11+
- `δ` -- step-size of the discretization
12+
- `approx_model` -- (optional, default: `CorrectionHullMatrixZonotope`)
13+
model for the discretization of the initial value problem
14+
- `taylor_order` -- (optional, default: `5`) order of the Taylor series
15+
expansion of the matrix exponential for each step
16+
- `max_order` -- (optional, default: `5`) maximum order of the reach set
17+
- `reduction_method` -- (optional, default: `LazySets.GIR05()` zonotope
18+
order reduction method used
19+
- `recursive` -- (optional, default: `false`) if `true`, compute the
20+
Taylor series expansion of the matrix zonotope
21+
exponential map recursively
22+
23+
### Notes
24+
25+
The `recursive` option is used to compute the Taylor expansion of the matrix zonotope exponential map.
26+
If `recursive == true`, each term of the Taylor expansion is computed recursively (e.g., ``A^2 P = A (A P)``).
27+
28+
If `recursive == false`, the Taylor expansion is computed by overapproximating the matrix zonotope exponential
29+
map, producing a single matrix that represents the exponential.
30+
"""
31+
struct HLBS25{N,AM,RM,R} <: AbstractContinuousPost
32+
δ::N
33+
approx_model::AM
34+
taylor_order::Int
35+
max_order::Int
36+
reduction_method::RM
37+
recursive::R
38+
end
39+
40+
function HLBS25(; δ::N,
41+
approx_model::AM=CorrectionHullMatrixZonotope(),
42+
taylor_order::Int=5,
43+
max_order::Int=5,
44+
reduction_method::RM=LazySets.GIR05(),
45+
recursive::Bool=false) where {N,AM,RM}
46+
return HLBS25{N,AM,RM,Val{recursive}}(δ, approx_model, taylor_order, max_order,
47+
reduction_method, Val(recursive))
48+
end
49+
50+
step_size(alg::HLBS25) = alg.δ
51+
numtype(::HLBS25{N}) where {N} = N
52+
53+
function rsetrep(::HLBS25{N}) where {N}
54+
return ReachSet{N,SparsePolynomialZonotope{N,Matrix{N},Matrix{N},Matrix{Int},Vector{Int}}}
55+
end
56+
57+
include("post.jl")
58+
include("reach_homog.jl")

src/Algorithms/HLBS25/post.jl

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# continuous post
2+
function post(alg::HLBS25, ivp::IVP{<:AbstractContinuousSystem}, tspan;
3+
Δt0::TimeInterval=zeroI, kwargs...)
4+
δ = alg.δ
5+
NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))
6+
7+
# discretize system
8+
ivp_discr = discretize(ivp, δ, alg.approx_model)
9+
10+
return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
11+
end
12+
13+
# discrete post
14+
function post(alg::HLBS25{N}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
15+
Δt0::TimeInterval=zeroI, kwargs...) where {N}
16+
@unpack δ, approx_model, taylor_order, max_order, reduction_method, recursive = alg
17+
18+
if isnothing(NSTEPS)
19+
if haskey(kwargs, :NSTEPS)
20+
NSTEPS = kwargs[:NSTEPS]
21+
else
22+
throw(ArgumentError("`NSTEPS` not specified"))
23+
end
24+
end
25+
26+
Φ = state_matrix(ivp)
27+
Ω0 = initial_state(ivp)
28+
29+
# true <=> there is no input, i.e. the system is of the form x' = Ax, x ∈ X
30+
got_homogeneous = !hasinput(ivp)
31+
32+
# preallocate output flowpipe
33+
ZT = typeof(Ω0)
34+
F = Vector{ReachSet{N,ZT}}(undef, NSTEPS)
35+
36+
if got_homogeneous
37+
reach_homog_HLBS25!(F, Ω0, Φ, NSTEPS, δ, taylor_order, recursive, max_order,
38+
reduction_method, Δt0)
39+
else
40+
error("inhomogeneous algorithm not implemented yet")
41+
end
42+
43+
return Flowpipe(F)
44+
end

0 commit comments

Comments
 (0)