Conversion between set representations

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

Base.convertMethod
convert(::Type{Interval}, X::LazySet)

Convert a one-dimensional convex set to an interval.

Input

  • Interval – interval target type
  • X – one-dimensional convex set

Output

An interval.

Examples

julia> convert(Interval, Hyperrectangle([0.5], [0.5]))
Interval{Float64}([0, 1])
source
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{Interval}, x::IntervalArithmetic.Interval)

Convert an Interval from IntervalArithmetic to an Interval in LazySets.

Input

  • Interval – target type
  • x – interval (IntervalArithmetic.Interval)

Output

A LazySets.Interval.

source
Base.convertMethod
convert(::Type{IntervalArithmetic.Interval}, X::LazySet)

Convert a convex set to an Interval from IntervalArithmetic.

Input

  • Interval – target type, from IntervalArithmetic
  • X – convex set

Output

An IntervalArithmetic.Interval.

source
Base.convertMethod
convert(::Type{IntervalArithmetic.IntervalBox}, H::AbstractHyperrectangle)

Convert a hyperrectangular set to an IntervalBox from IntervalArithmetic.

Input

  • IntervalBox – target type
  • H – hyperrectangular set

Output

An IntervalBox.

source
Base.convertMethod
convert(::Type{Hyperrectangle}, IB::IntervalArithmetic.IntervalBox)

Convert an IntervalBox from IntervalArithmetic to a hyperrectangular set.

Input

  • Hyperrectangle – target type
  • IB – interval box

Output

A Hyperrectangle.

Notes

IntervalArithmetic.IntervalBox uses static vectors to store each component interval; hence the resulting Hyperrectangle has its center and radius represented as a static vector (SArray).

source
Base.convertMethod
convert(::Type{Hyperrectangle}, H::AbstractHyperrectangle)

Convert a hyperrectangular set to a hyperrectangle.

Input

  • Hyperrectangle – hyperrectangle target type
  • H – hyperrectangular set

Output

A hyperrectangle.

Examples

julia> convert(Hyperrectangle, Interval(0.0, 1.0))
Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}([0.5], [0.5])
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{HPolyhedron}, X::LazySet)

Convert a polyhedral set to a polyhedron in constraint representation.

Input

  • HPolyhedron – target type
  • X – polyhedral set

Output

The given set represented as a polyhedron in constraint representation.

Algorithm

This method uses constraints_list.

source
Base.convertMethod
 convert(::Type{HPolyhedron}, P::HRep{N}) where {N}

Convert an HRep polyhedron from Polyhedra.jl to a polyhedron in constraint representation .

Input

  • HPolyhedron – target type
  • PHRep polyhedron

Output

An HPolyhedron.

source
Base.convertMethod
convert(::Type{HPolytope}, X::LazySet)

Convert a polytopic set to a polytope in constraint representation.

Input

  • HPolytope – target type
  • X – polytopic set

Output

The given polytope represented as a polytope in constraint representation.

Algorithm

This method uses constraints_list.

source
Base.convertMethod
convert(::Type{VPolygon}, X::LazySet)

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

Input

  • VPolygon – target type
  • X – two-dimensional polytopic set

Output

The 2D set represented as a polygon.

Algorithm

This method uses vertices_list.

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{VPolytope}, X::LazySet; [prune]::Bool=true)

Convert a polytopic set to a polytope in vertex representation.

Input

  • VPolytope – target type
  • X – polytopic set
  • prune – (optional, default: true) option to remove redundant vertices

Output

The given set represented as a polytope in vertex representation.

Algorithm

This method uses vertices_list. Use the option prune to select whether to remove redundant vertices before constructing the polytope.

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

Convert a zonotopic set to a zonotope.

Input

  • Zonotope – target type
  • H – zonotopic set

Output

A zonotope.

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{HParallelotope}, Z::AbstractZonotope{N}) where {N}

Convert a zonotopic set of order one to a parallelotope in constraint representation.

Input

  • HParallelotope – target type
  • Z – zonotopic set of order one

Output

A parallelotope in constraint representation.

Notes

This function requires that the list of constraints of Z are obtained in the particular order returned from the constraints_list function of a Zonotope. Hence it first converts Z to a Zonotope.

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{Star}, P::AbstractPolyhedron{N}) where {N}

Convert a polyhedral set to a star set.

Input

  • Star – target type
  • P – polyhedral 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.

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.

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