Reset map (ResetMap)
LazySets.ResetMap
— Type.ResetMap{N<:Real, S<:LazySet{N}} <: LazySet{N}
Type that represents a lazy reset map. A reset map is a special case of an affine map $A x + b, x ∈ X$ where the linear map $A$ is the identity matrix with zero entries in all reset dimensions, and the translation vector $b$ is zero in all other dimensions.
Fields
X
– convex setresets
– resets (a mapping from an index to a new value)
Examples
julia> X = BallInf([2.0, 2.0, 2.0], 1.0);
julia> r = Dict(1 => 4.0, 3 => 0.0);
julia> rm = ResetMap(X, r);
Here rm
modifies the set X
such that x1
is reset to 4 and x3
is reset to 0, while x2
is not modified. Hence rm
is equivalent to the set Hyperrectangle([4.0, 2.0, 0.0], [0.0, 1.0, 0.0])
, i.e., an axis-aligned line segment embedded in 3D.
The corresponding affine map $A x + b$ would be:
Use the function get_A
(resp. get_b
) to create the matrix A
(resp. vector b
) corresponding to a given reset map.
julia> get_A(rm)
3×3 LinearAlgebra.Diagonal{Float64,Array{Float64,1}}:
0.0 ⋅ ⋅
⋅ 1.0 ⋅
⋅ ⋅ 0.0
julia> get_b(rm)
3-element SparseArrays.SparseVector{Float64,Int64} with 1 stored entry:
[1] = 4.0
The application of a ResetMap
to a ZeroSet
or an EmptySet
is simplified automatically.
julia> ResetMap(ZeroSet(3), r)
Singleton{Float64,SparseArrays.SparseVector{Float64,Int64}}( [1] = 4.0)
julia> ResetMap(EmptySet(), r)
EmptySet{Float64}()
The (in this case unique) support vector of rm
in direction ones(3)
is:
julia> σ(ones(3), rm)
3-element Array{Float64,1}:
4.0
3.0
0.0
LazySets.dim
— Method.dim(rm::ResetMap)
Return the dimension of a reset map.
Input
rm
– reset map
Output
The dimension of a reset map.
LazySets.ρ
— Method.ρ(d::AbstractVector{N}, rm::ResetMap{N}) where {N<:Real}
Return the support function of a reset map.
Input
d
– directionrm
– reset map
Output
The support function in the given direction.
Notes
We use the usual dot-product definition, but for unbounded sets we redefine the product between $0$ and $±∞$ as $0$; Julia returns NaN
here.
julia> Inf * 0.0
NaN
See the discussion here.
LazySets.σ
— Method.σ(d::AbstractVector{N}, rm::ResetMap{N}) where {N<:Real}
Return the support vector of a reset map.
Input
d
– directionrm
– reset map
Output
The support vector in the given direction. If the direction has norm zero, the result depends on the wrapped set.
LazySets.an_element
— Method.an_element(rm::ResetMap)
Return some element of a reset map.
Input
rm
– reset map
Output
An element in the reset map. It relies on the an_element
function of the wrapped set.
Base.isempty
— Method.isempty(rm::ResetMap)
Return if a reset map is empty or not.
Input
rm
– reset map
Output
true
iff the wrapped set is empty.
LazySets.get_A
— Method.get_A(rm::ResetMap{N}) where {N<:Real}
Return the $A$ matrix of the affine map $A x + b, x ∈ X$ represented by a reset map.
Input
rm
– reset map
Output
The (diagonal) matrix for the affine map $A x + b, x ∈ X$ represented by the reset map.
Algorithm
We construct the identity matrix and set all entries in the reset dimensions to zero.
LazySets.get_b
— Method.get_b(rm::ResetMap{N}) where {N<:Real}
Return the $b$ vector of the affine map $A x + b, x ∈ X$ represented by a reset map.
Input
rm
– reset map
Output
The (sparse) vector for the affine map $A x + b, x ∈ X$ represented by the reset map. The vector contains the reset value for all reset dimensions, and is zero for all other dimensions.
LazySets.constraints_list
— Method.constraints_list(rm::ResetMap{N}) where {N<:Real}
Return the list of constraints of a polytopic reset map.
Input
rm
– reset map of a polytope
Output
The list of constraints of the reset map.
Notes
We assume that the underlying set X
is a polytope, i.e., is bounded and offers a method constraints_list(X)
.
Algorithm
We fall back to constraints_list
of a LinearMap
of the A
-matrix in the affine-map view of a reset map. Each reset dimension $i$ is projected to zero, expressed by two constraints for each reset dimension. Then it remains to shift these constraints to the new value.
For instance, if the dimension $5$ was reset to $4$, then there will be constraints $x₅ ≤ 0$ and $-x₅ ≤ 0$. We then modify the right-hand side of these constraints to $x₅ ≤ 4$ and $-x₅ ≤ -4$, respectively.
LazySets.constraints_list
— Method.constraints_list(rm::ResetMap{N, S}) where
{N<:Real, S<:AbstractHyperrectangle}
Return the list of constraints of a hyperrectangular reset map.
Input
rm
– reset map of a hyperrectangular set
Output
The list of constraints of the reset map.
Algorithm
We iterate through all dimensions. If there is a reset, we construct the corresponding (flat) constraints. Otherwise, we construct the corresponding constraints of the underlying set.
Inherited from LazySet
: