Skip to content

Commit 810693b

Browse files
committed
add 'setops' option to 'FirstOrder'
1 parent c797854 commit 810693b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Discretization/FirstOrderModule.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
module FirstOrderModule
55

66
using ..DiscretizationModule
7-
using ..Exponentiation: _exp, BaseExp
7+
using ..Exponentiation: _exp, _alias, BaseExp
8+
using ..ApplySetops: _apply_setops
89
using LinearAlgebra
910
using MathematicalSystems
1011
using LazySets
@@ -35,18 +36,20 @@ The transformations are [LeGuernicG10](@cite):
3536
3637
where ``B_ε`` is the input ball of radius ``ε`` centered in the origin.
3738
"""
38-
struct FirstOrder{EM} <: AbstractApproximationModel
39+
struct FirstOrder{EM,SO} <: AbstractApproximationModel
3940
exp::EM
41+
setops::SO
4042
end
4143

4244
# convenience constructor
43-
function FirstOrder(; exp=BaseExp)
44-
return FirstOrder(exp)
45+
function FirstOrder(; exp=BaseExp, setops=:lazy)
46+
return FirstOrder(_alias(exp), _alias(setops))
4547
end
4648

4749
function Base.show(io::IO, alg::FirstOrder)
4850
print(io, "`FirstOrder` approximation model with:\n")
4951
print(io, " - exponentiation method: $(alg.exp)\n")
52+
print(io, " - set operations method: $(alg.setops)\n")
5053
return nothing
5154
end
5255

@@ -69,6 +72,7 @@ function discretize(ivp::IVP{<:CLCS,<:AbstractZonotope}, δ, alg::FirstOrder)
6972
= Φ * X0
7073
α = (exp(norm_A * δ) - 1 - norm_A * δ) * norm(X0, Inf)
7174
Ω0 = ConvexHull(X0, Xδ + BallInf(zeros(n), α))
75+
Ω0 = _apply_setops(Ω0, alg.setops)
7276

7377
# create result
7478
X = stateset(ivp)
@@ -96,10 +100,12 @@ function discretize(ivp::IVP{<:CLCCS,<:AbstractZonotope}, δ, alg::FirstOrder)
96100
norm_U_over_A = norm(U, Inf) / norm_A
97101
α = factor * (norm(X0, Inf) + norm_U_over_A)
98102
Ω0 = ConvexHull(X0, Xδ + δ * U + BallInf(zeros(n), α))
103+
Ω0 = _apply_setops(Ω0, alg.setops)
99104

100105
# discretize inputs
101106
β = factor * norm_U_over_A
102107
V = δ * U + BallInf(zeros(n), β)
108+
V = _apply_setops(V, alg.setops)
103109

104110
# create result
105111
B = IdentityMultiple(one(eltype(A)), size(A, 1))

0 commit comments

Comments
 (0)