Approximations
This section of the manual describes the Cartesian decomposition algorithms and the approximation of high-dimensional convex sets using projections.
LazySets.Approximations
— Module.Module Approximations.jl
– polygonal approximation of convex sets through support vectors.
Cartesian Decomposition
LazySets.Approximations.decompose
— Function.decompose(S::LazySet{N}, set_type::Type=HPolygon
)::CartesianProductArray where {N<:Real}
Compute an overapproximation of the projections of the given convex set over each two-dimensional subspace.
Input
S
– convex setset_type
– (optional, default:HPolygon
) type of set approximation in 2D
Output
A CartesianProductArray
corresponding to the Cartesian product of two-dimensional sets of type set_type
.
Algorithm
For each 2D block a specific decompose_2D
method is called, dispatched on the set_type
argument.
decompose(S::LazySet{N}, ɛi::Vector{<:Real})::CartesianProductArray where {N<:Real}
Compute an overapproximation of the projections of the given convex set over each two-dimensional subspace with a certified error bound.
Input
S
– convex setɛi
– array with the error bound for each projection (different error bounds can be passed for different blocks)
Output
A CartesianProductArray
corresponding to the Cartesian product of $2 × 2$ polygons.
Algorithm
This algorithm assumes a decomposition into two-dimensional subspaces only, i.e., partitions of the form $[2, 2, …, 2]$. In particular, if S
is a CartesianProductArray
, no check is performed to verify that assumption.
The algorithm proceeds as follows:
Project the set
S
into each partition, withM⋅S
, where M is the identity matrix in the block coordinates and zero otherwise.Overapproximate the set with a given error bound,
ɛi[i]
, for $i = 1, …, b$,Return the result as a
CartesianProductArray
.
decompose(S::LazySet, ɛ::Real, [set_type]::Type=HPolygon
)::CartesianProductArray
Compute an overapproximation of the projections of the given convex set over each two-dimensional subspace with a certified error bound.
Input
S
– convex setɛ
– error boundset_type
– (optional, default:HPolygon
) type of set approximation in 2D
Output
A CartesianProductArray
corresponding to the Cartesian product of two-dimensional sets of type set_type
.
Notes
This function is a particular case of decompose(S, ɛi)
, where the same error bound for each block is assumed.
The set_type
argument is ignored if $ɛ ≠ \text{Inf}$.
LazySets.Approximations.overapproximate
— Function.overapproximate(S::LazySet{N}, ::Type{<:HPolygon})::HPolygon where {N<:Real}
Return an approximation of a given 2D convex set as a box-shaped polygon.
Input
S
– convex set, assumed to be two-dimensionalHPolygon
for dispatch
Output
A box-shaped polygon in constraint representation.
overapproximate(S::LazySet)::HPolygon
Alias for overapproximate(S, HPolygon)
.
overapproximate(S::LazySet, Type{<:Hyperrectangle})::Hyperrectangle
Return an approximation of a given 2D convex set as a hyperrectangle.
Input
S
– convex set, assumed to be two-dimensionalHyperrectangle
for dispatch
Output
A hyperrectangle.
overapproximate(S::LazySet, ɛ::Real)::HPolygon
Return an ɛ-close approximation of the given 2D set (in terms of Hausdorff distance) as a polygon.
Input
S
– convex set, assumed to be two-dimensionalɛ
– error bound
Output
A polygon in constraint representation.
Box Approximations
LazySets.Approximations.ballinf_approximation
— Function.ballinf_approximation(S::LazySet{N})::BallInf{N} where {N<:Real}
Overapproximate a convex set by a tight ball in the infinity norm.
Input
S
– convex set
Output
A tight ball in the infinity norm.
Algorithm
The center and radius of the box are obtained by evaluating the support function of the given convex set along the canonical directions.
LazySets.Approximations.box_approximation
— Function.box_approximation(S::LazySet)::Hyperrectangle
Overapproximate a convex set by a tight hyperrectangle.
Input
S
– convex set
Output
A tight hyperrectangle.
Algorithm
The center of the hyperrectangle is obtained by averaging the support function of the given set in the canonical directions, and the lengths of the sides can be recovered from the distance among support functions in the same directions.
LazySets.Approximations.interval_hull
— Function.interval_hull
Alias for box_approximation
.
box_approximation_symmetric(S::LazySet{N})::Hyperrectangle{N} where {N<:Real}
Overapproximate a convex set by a tight hyperrectangle centered in the origin.
Input
S
– convex set
Output
A tight hyperrectangle centered in the origin.
Algorithm
The center of the box is the origin, and the radius is obtained by computing the maximum value of the support function evaluated at the canonical directions.
LazySets.Approximations.symmetric_interval_hull
— Function.symmetric_interval_hull
Alias for box_approximation_symmetric
.
LazySets.Approximations.box_approximation_helper
— Function.box_approximation_helper(S::LazySet)
Common code of box_approximation
and box_approximation_symmetric
.
Input
S
– convex set
Output
A tuple containing the data that is needed to construct a tightly overapproximating hyperrectangle.
c
– centerr
– radius
Algorithm
The center of the hyperrectangle is obtained by averaging the support function of the given convex set in the canonical directions. The lengths of the sides can be recovered from the distance among support functions in the same directions.
Metric properties of sets
Base.LinAlg.norm
— Method.norm(S::LazySet, [p]::Real=Inf)
Return the norm of a convex set. It is the norm of the enclosing ball (of the given $p$-norm) of minimal volume that is centered in the origin.
Input
S
– convex setp
– (optional, default:Inf
) norm
Output
A real number representing the norm.
LazySets.radius
— Method.radius(S::LazySet, [p]::Real=Inf)
Return the radius of a convex set. It is the radius of the enclosing ball (of the given $p$-norm) of minimal volume with the same center.
Input
S
– convex setp
– (optional, default:Inf
) norm
Output
A real number representing the radius.
LazySets.diameter
— Method.diameter(S::LazySet, [p]::Real=Inf)
Return the diameter of a convex set. It is the maximum distance between any two elements of the set, or, equivalently, the diameter of the enclosing ball (of the given $p$-norm) of minimal volume with the same center.
Input
S
– convex setp
– (optional, default:Inf
) norm
Output
A real number representing the diameter.
Iterative refinement
LocalApproximation{N<:Real}
Type that represents a local approximation in 2D.
Fields
p1
– first inner pointd1
– first directionp2
– second inner pointd2
– second directionq
– intersection of the lines l1 ⟂ d1 at p1 and l2 ⟂ d2 at p2refinable
– states if this approximation is refinableerr
– error upper bound
Notes
The criteria for refinable are determined in the method new_approx
.
PolygonalOverapproximation{N<:Real}
Type that represents the polygonal approximation of a convex set.
Fields
S
– convex setapprox_list
– vector of local approximations
LazySets.Approximations.new_approx
— Method.new_approx(S::LazySet, p1::Vector{N}, d1::Vector{N}, p2::Vector{N}, d2::Vector{N}) where {N<:Real}
Input
S
– convex setp1
– first inner pointd1
– first directionp2
– second inner pointd2
– second direction
Output
A local approximation of S
in the given directions.
addapproximation!(Ω::PolygonalOverapproximation,
p1::Vector{N}, d1::Vector{N}, p2::Vector{N}, d2::Vector{N}) where {N<:Real}
Input
Ω
– polygonal overapproximation of a convex setp1
– first inner pointd1
– first directionp2
– second inner pointd2
– second direction
Output
The list of local approximations in Ω
of the set Ω.S
is updated in-place and the new approximation is returned by this function.
LazySets.Approximations.refine
— Method.refine(Ω::PolygonalOverapproximation, i::Int)::Tuple{LocalApproximation, LocalApproximation}
Refine a given local approximation of the polygonal approximation of a convex set, by splitting along the normal direction to the approximation.
Input
Ω
– polygonal overapproximation of a convex seti
– integer index for the local approximation to be refined
Output
The tuple consisting of the refined right and left local approximations.
LazySets.Approximations.tohrep
— Method.tohrep(Ω::PolygonalOverapproximation{N})::AbstractHPolygon where {N<:Real}
Convert a polygonal overapproximation into a concrete polygon.
Input
Ω
– polygonal overapproximation of a convex set
Output
A polygon in constraint representation.
LazySets.Approximations.approximate
— Method.approximate(S::LazySet{N},
ɛ::N)::PolygonalOverapproximation{N} where {N<:Real}
Return an ɛ-close approximation of the given 2D convex set (in terms of Hausdorff distance) as an inner and an outer approximation composed by sorted local Approximation2D
.
Input
S
– 2D convex setɛ
– error bound
Output
An ɛ-close approximation of the given 2D convex set.
See Iterative Refinement for more details.