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
@@ -36,18 +37,20 @@ The transformations are [LeGuernicG10](@cite):
3637
3738where ``B_ε`` is the input ball of radius ``ε`` centered in the origin.
3839"""
39- struct FirstOrder{EM} <: AbstractApproximationModel
40+ struct FirstOrder{EM,SO } <: AbstractApproximationModel
4041 exp:: EM
42+ setops:: SO
4143end
4244
4345# convenience constructor
44- function FirstOrder (; exp= BaseExp)
45- return FirstOrder (exp)
46+ function FirstOrder (; exp= BaseExp, setops = :lazy )
47+ return FirstOrder (_alias ( exp), _alias (setops) )
4648end
4749
4850function Base. show (io:: IO , alg:: FirstOrder )
4951 print (io, " `FirstOrder` approximation model with:\n " )
5052 print (io, " - exponentiation method: $(alg. exp) \n " )
53+ print (io, " - set operations method: $(alg. setops) \n " )
5154 return nothing
5255end
5356
@@ -70,6 +73,7 @@ function discretize(ivp::IVP{<:CLCS,<:AbstractZonotope}, δ, alg::FirstOrder)
7073 Xδ = Φ * X0
7174 α = (exp (norm_A * δ) - 1 - norm_A * δ) * norm (X0, Inf )
7275 Ω0 = ConvexHull (X0, Xδ + BallInf (zeros (n), α))
76+ Ω0 = _apply_setops (Ω0, alg. setops)
7377
7478 # create result
7579 X = stateset (ivp)
@@ -97,10 +101,12 @@ function discretize(ivp::IVP{<:CLCCS,<:AbstractZonotope}, δ, alg::FirstOrder)
97101 norm_U_over_A = isapproxzero (norm_A) ? 0 : norm (U, Inf ) / norm_A
98102 α = factor * (norm (X0, Inf ) + norm_U_over_A)
99103 Ω0 = ConvexHull (X0, Xδ + δ * U + BallInf (zeros (n), α))
104+ Ω0 = _apply_setops (Ω0, alg. setops)
100105
101106 # discretize inputs
102107 β = factor * norm_U_over_A
103108 V = δ * U + BallInf (zeros (n), β)
109+ V = _apply_setops (V, alg. setops)
104110
105111 # create result
106112 B = IdentityMultiple (one (eltype (A)), size (A, 1 ))
0 commit comments