Conversion between set representations

This section of the manual lists the conversion functions between set representations.

Base.convertMethod
convert(::Type{Interval}, r::Rectification{N, IN}) where {N, IN<:Interval}

Convert a rectification of an interval to an interval.

Input

  • Interval – target type
  • r – rectification of an interval

Output

An Interval.

source
Base.convertMethod
convert(::Type{Interval}, ms::MinkowskiSum{N, IT, IT}) where {N, IT<:Interval}

Convert the Minkowski sum of two intervals to an interval.

Input

  • Interval – target type
  • ms – Minkowski sum of two intervals

Output

An interval.

source
Base.convertMethod
convert(::Type{Hyperrectangle}, cp::CartesianProduct{N, HN1, HN2})
    where {N, HN1<:AbstractHyperrectangle, HN2<:AbstractHyperrectangle}

Convert the Cartesian product of two hyperrectangular sets to a single hyperrectangle.

Input

  • Hyperrectangle – target type
  • S – Cartesian product of two hyperrectangular sets

Output

A hyperrectangle.

Algorithm

The result is obtained by concatenating the center and radius of each hyperrectangle. This implementation uses the center and radius_hyperrectangle methods.

source
Base.convertMethod
convert(::Type{Hyperrectangle}, cpa::CartesianProductArray{N, HN})
    where {N, HN<:AbstractHyperrectangle}

Convert the Cartesian product of a finite number of hyperrectangular sets to a single hyperrectangle.

Input

  • Hyperrectangle – target type
  • S – Cartesian product array of hyperrectangular set

Output

A hyperrectangle.

Algorithm

This implementation uses the center and radius_hyperrectangle methods of AbstractHyperrectangle.

source
Base.convertMethod
convert(::Type{Hyperrectangle},
        cpa::CartesianProductArray{N, IN}) where {N, IN<:Interval}

Convert the Cartesian product of a finite number of intervals to a single hyperrectangle.

Input

  • Hyperrectangle – target type
  • S – Cartesian product array of intervals

Output

A hyperrectangle.

Algorithm

This implementation uses the min and max methods of Interval to reduce the allocations and improve performance (see LazySets#1143).

source
Base.convertMethod
convert(::Type{Hyperrectangle}, r::Rectification{N, AH})
    where {N, AH<:AbstractHyperrectangle}

Convert a rectification of a hyperrectangle to a hyperrectangle.

Input

  • Hyperrectangle – target type
  • r – rectification of a hyperrectangle

Output

A Hyperrectangle.

source
Base.convertMethod
convert(::Type{HPolygon}, X::LazySet; [check_boundedness]::Bool=true,
        prune::Bool=true)

Convert a two-dimensional polytopic set to a polygon in constraint representation.

Input

  • HPolygon – target type
  • X – two-dimensional polytopic set
  • check_boundedness – (optional, default !isboundedtype(typeof(X))) if true check whether the set X is bounded before creating the polygon
  • prune – (optional, default: true) flag for removing redundant constraints in the end

Output

A polygon in constraint representation.

Algorithm

We compute the list of constraints of X, then instantiate the polygon.

source
Base.convertMethod
convert(T::Type{HPolygon}, P::VPolygon)

Convert a polygon in vertex representation to a polygon in constraint representation.

Input

  • HPolygon – target type
  • P – polygon in vertex representation

Output

A polygon in constraint representation.

source
Base.convertMethod
convert(::Type{HPolygon}, L::LineSegment{N}) where {N}

Convert a line segment to a polygon in constraint representation.

Input

  • HPolygon – target type
  • L – line segment
  • prune – (optional, default: false) flag for removing redundant constraints in the end

Output

A flat polygon in constraint representation with the minimal number of constraints (four).

source
Base.convertMethod
convert(::Type{HPolygon}, S::AbstractSingleton{N}) where {N}

Convert a singleton to a polygon in constraint representation.

Input

  • HPolygon – target type
  • S – singleton

Output

A polygon in constraint representation with the minimal number of constraints (three).

source
Base.convertMethod
convert(::Type{HPolygonOpt}, X::LazySet; [check_boundedness]::Bool=true,
        prune::Bool=true)

Convert a two-dimensional polytopic set to a polygon in constraint representation.

Input

  • HPolygonOpt – target type
  • X – two-dimensional polytopic set
  • check_boundedness – (optional, default !isboundedtype(typeof(X))) if true check whether the set X is bounded before creating the polygon
  • prune – (optional, default: true) flag for removing redundant constraints in the end

Output

A polygon in constraint representation.

Algorithm

We compute the list of constraints of X, then instantiate the polygon.

source
Base.convertMethod
convert(T::Type{HPolygonOpt}, P::VPolygon)

Convert a polygon in vertex representation to a polygon in constraint representation.

Input

  • HPolygonOpt – target type
  • P – polygon in vertex representation

Output

A polygon in constraint representation.

source
Base.convertMethod
convert(::Type{HPolygonOpt}, L::LineSegment{N}) where {N}

Convert a line segment to a polygon in constraint representation.

Input

  • HPolygonOpt – target type
  • L – line segment
  • prune – (optional, default: false) flag for removing redundant constraints in the end

Output

A flat polygon in constraint representation with the minimal number of constraints (four).

source
Base.convertMethod
convert(::Type{HPolygonOpt}, S::AbstractSingleton{N}) where {N}

Convert a singleton to a polygon in constraint representation.

Input

  • HPolygonOpt – target type
  • S – singleton

Output

A polygon in constraint representation with the minimal number of constraints (three).

source
Base.convertMethod
convert(::Type{VPolygon}, P::AbstractHPolygon)

Convert a polygon in constraint representation to a polygon in vertex representation.

Input

  • VPolygon – target type
  • P – polygon in constraint representation

Output

A polygon in vertex representation.

source
Base.convertMethod
convert(::Type{Zonotope}, S::LinearMap{N, ZN})
    where {N, ZN<:AbstractZonotope}

Convert the lazy linear map of a zonotopic set to a zonotope.

Input

  • Zonotope – target type
  • S – linear map of a zonotopic set

Output

A zonotope.

Algorithm

This method first applies the (concrete) linear map to the zonotopic set and then converts the result to a Zonotope type.

source
Base.convertMethod
convert(::Type{Zonotope}, S::LinearMap{N, CartesianProduct{N, HN1, HN2}}
       ) where {N, HN1<:AbstractHyperrectangle,
                HN2<:AbstractHyperrectangle}

Convert the lazy linear map of the Cartesian product of two hyperrectangular sets to a zonotope.

Input

  • Zonotope – target type
  • S – linear map of the Cartesian product of hyperrectangular sets

Output

A zonotope.

Algorithm

This method first converts the Cartesian product to a zonotope, and then applies the (concrete) linear map to the zonotope.

source
Base.convertMethod
convert(::Type{Zonotope},S::LinearMap{N, CartesianProductArray{N, HN}})
    where {N, HN<:AbstractHyperrectangle}

Convert the lazy linear map of the Cartesian product of a finite number of hyperrectangular sets to a zonotope.

Input

  • Zonotope – target type
  • S – linear map of a CartesianProductArray of hyperrectangular sets

Output

A zonotope.

Algorithm

This method first converts the Cartesian product array to a zonotope, and then applies the (concrete) linear map to the zonotope.

source
Base.convertMethod
convert(::Type{Zonotope}, cp::CartesianProduct{N, ZN1, ZN2}
       ) where {N, ZN1<:AbstractZonotope, ZN2<:AbstractZonotope}

Convert the Cartesian product of two zonotopic sets to a new zonotope.

Input

  • Zonotope – target type
  • S – Cartesian product of two zonotopic sets

Output

A zonotope.

Algorithm

The Cartesian product is obtained by:

  • Concatenating the centers of each input zonotope.
  • Arranging the generators in block-diagonal fashion, and filled with zeros in the off-diagonal; for this reason, the generator matrix of the returned zonotope is built as a sparse matrix.
source
Base.convertMethod
convert(::Type{Zonotope}, cp::CartesianProduct{N, HN1, HN2}) where {N,
        HN1<:AbstractHyperrectangle, HN2<:AbstractHyperrectangle}

Convert the Cartesian product of two hyperrectangular sets to a zonotope.

Input

  • Zonotope – target type
  • cp – Cartesian product of two hyperrectangular sets

Output

This method falls back to the conversion of the Cartesian product to a single hyperrectangle, and then from a hyperrectangle to a zonotope.

source
Base.convertMethod
convert(::Type{Zonotope}, cpa::CartesianProductArray{N, AZ})
    where {N, AZ<:AbstractZonotope}

Convert a Cartesian product array of zonotopic sets to a zonotope.

Input

  • Zonotope – target type
  • cpa – Cartesian product array of zonotopic sets

Output

A zonotope with sparse matrix representation.

source
Base.convertMethod
convert(::Type{Zonotope}, cpa::CartesianProductArray{N, HN})
    where {N, HN<:AbstractHyperrectangle}

Convert the Cartesian product array of hyperrectangular sets to a zonotope.

Input

  • Zonotope – target type
  • cpa – Cartesian product array of hyperrectangular sets

Output

A zonotope.

Algorithm

This method falls back to the conversion of the Cartesian product to a single hyperrectangle, and then from a hyperrectangle to a zonotope.

source
Base.convertMethod
convert(::Type{CartesianProduct{N, Interval{N}, Interval{N}}},
        H::AbstractHyperrectangle{N}) where {N}

Convert a two-dimensional hyperrectangle to the Cartesian product of two intervals.

Input

  • CartesianProduct – target type
  • H – hyperrectangle

Output

The Cartesian product of two intervals.

source
Base.convertMethod
convert(::Type{CartesianProductArray{N, Interval{N}}},
        H::AbstractHyperrectangle{N}) where {N}

Convert a hyperrectangle to the Cartesian product array of intervals.

Input

  • CartesianProductArray – target type
  • H – hyperrectangle

Output

The Cartesian product of a finite number of intervals.

source
Base.convertMethod
convert(::Type{MinkowskiSumArray},
        X::MinkowskiSum{N, ST, MinkowskiSumArray{N, ST}}) where {N, ST}

Convert the Minkowski sum of a Minkowski sum array to a Minkowski sum array.

Input

  • MinkowskiSumArray – target type
  • X – Minkowski sum of a Minkowski sum array

Output

A Minkowski sum array.

source
Base.convertMethod
convert(::Type{STAR}, P::AbstractPolyhedron{N}) where {N}

Convert a polyhedral set to a star set represented as a lazy affine map.

Input

  • STAR – target type
  • P – polyhedral set

Output

A star set.

source
Base.convertMethod
convert(::Type{STAR}, X::Star)

Convert a star set to its equivalent representation as a lazy affine map.

Input

  • STAR – target type
  • X – star set

Output

A star set.

source
Base.convertMethod
convert(::Type{SimpleSparsePolynomialZonotope}, Z::AbstractZonotope)

Convert a zonotope to a simple sparse polynomial zonotope.

Input

  • SimpleSparsePolynomialZonotope – target type
  • Z – zonotopic set

Output

A simple sparse polynomial zonotope.

Algorithm

This method implements Proposition 3 in [1].

[1] Kochdumper, Althoff. Sparse polynomial zonotopes - a novel set representation for reachability analysis. 2021

source
Base.convertMethod
convert(::Type{SimpleSparsePolynomialZonotope}, SPZ::SparsePolynomialZonotope)

Convert a sparse polynomial zonotope to simple sparse polynomial zonotope.

Input

  • SimpleSparsePolynomialZonotope – target type
  • SPZ – sparse polynomial zonotope

Output

A simple sparse polynomial zonotope.

Algorithm

The method implements Proposition 3.1.4 from [1].

[1] Kochdumper, Niklas. Extensions of polynomial zonotopes and their application to verification of cyber-physical systems. PhD diss., Technische Universität München, 2022.

source
Base.convertMethod
convert(::Type{SparsePolynomialZonotope}, Z::AbstractZonotope{N}) where {N}

Convert a zonotope to sparse polynomial zonotope.

Input

  • SparsePolynomialZonotope – target type
  • Z – zonotopic set

Output

A sparse polynomial zonotope.

Algorithm

The method implements Proposition 3.1.9 from [1].

[1] Kochdumper, Niklas. Extensions of polynomial zonotopes and their application to verification of cyber-physical systems. PhD diss., Technische Universität München, 2022.

source
Base.convertMethod
convert(::Type{SparsePolynomialZonotope}, SSPZ::SimpleSparsePolynomialZonotope)

Convert a simple sparse polynomial zonotope to a sparse polynomial zonotope.

Input

  • SparsePolynomialZonotope – target type
  • SSPZ – simple sparse polynomial zonotope

Output

A sparse polynomial zonotope.

source