44module FirstOrderModule
55
66using .. DiscretizationModule
7- using .. Exponentiation: _exp, BaseExp
7+ using .. Exponentiation: _exp, _alias, BaseExp
8+ using .. ApplySetops: _apply_setops
89using LinearAlgebra
910using MathematicalSystems
1011using LazySets
@@ -35,18 +36,20 @@ The transformations are [LeGuernicG10](@cite):
3536
3637where ``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
4042end
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) )
4547end
4648
4749function 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
5154end
5255
@@ -69,6 +72,7 @@ function discretize(ivp::IVP{<:CLCS,<:AbstractZonotope}, δ, alg::FirstOrder)
6972 Xδ = Φ * 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