# Flowpipes

## Abstract interface

`ReachabilityAnalysis.AbstractFlowpipe`

— Type`AbstractFlowpipe`

Abstract type representing a flowpipe.

**Notes**

A flowpipe is the set union of an array of reach-sets.

The following functions are available at the interface level.

`ReachabilityAnalysis.basetype`

— Method`basetype(T::Type{<:AbstractFlowpipe})`

Return the base type of the given flowpipe type (i.e., without type parameters).

**Input**

`T`

– flowpipe type, used for dispatch

**Output**

The base type of `T`

.

`LazySets.ρ`

— Method`LazySets.ρ(d::AbstractVector, fp::AbstractFlowpipe)`

**Input**

`d`

– direction`fp`

– flowpipe

**Output**

The support function of the flowpipe along the given direction `d`

.

**Notes**

In this fallback implementation, the flowpipe behaves like the union of the reach-sets, i.e. the implementation is analogue to that of a `LazySet.UnionSetArray`

.

`LazySets.σ`

— Method`LazySets.σ(d::AbstractVector, fp::AbstractFlowpipe)`

**Input**

`d`

– direction`fp`

– flowpipe

**Output**

The support vector of the flowpipe along the given direction `d`

.

**Notes**

In this fallback implementation, the flowpipe behaves like the union of the reach-sets, i.e. the implementation is analogue to that of a `LazySet.UnionSetArray`

.

`LazySets.dim`

— Method`LazySets.dim(fp::AbstractFlowpipe)`

**Input**

`fp`

– flowpipe

**Output**

An integer representing the ambient dimension of the flowpipe.

`LazySets.set`

— Method`set(fp::AbstractFlowpipe, ind::Integer)`

Return the geometric set represented by this flowpipe at the given index.

**Input**

`fp`

– flowpipe`ind`

– index (from`1`

to`length(flowpipe)`

)

**Output**

The set wrapped by the flowpipe at the given index.

`LazySets.set`

— Method`set(fp::AbstractFlowpipe, ind::AbstractVector)`

Return the union of set represented by this flowpipe at the given indices.

**Input**

`fp`

– flowpipe`ind`

– vector of indices

**Output**

The set union stored in the flowpipe at the given indices.

`LazySets.set`

— Method`set(fp::AbstractFlowpipe)`

Return the geometric set represented by this flowpipe as the union of reach-sets.

**Input**

`fp`

– flowpipe

**Output**

The set union of the array of reach-sets of the flowpipe.

**Notes**

To retrieve the array of sets stored in the flowpipe use `array(fp)`

. To get a set at a particular index, use `set(F[ind])`

or `set(F, ind)`

.

`ReachabilityAnalysis.tstart`

— Method`tstart(fp::AbstractFlowpipe)`

Return the initial time of this flowpipe.

**Input**

`fp`

– flowpipe

**Output**

A float representing the initial time of the given flowpipe. The fallback is computed by taking the initial time of the first reach-set.

`ReachabilityAnalysis.tend`

— Method`tend(fp::AbstractFlowpipe)`

Return the final time of this flowpipe.

**Input**

`fp`

– flowpipe

**Output**

A float representing the initial time of the given flowpipe. The fallback is computed by taking the final time of the last reach-set.

`ReachabilityAnalysis.tspan`

— Method`tspan(fp::AbstractFlowpipe)`

Return time span of this flowpipe.

**Input**

`fp`

– flowpipe

**Output**

The interval representing the time span of the given flowpipe. The fallback is computed as `(tstart(fp), tend(fp))`

, see `tstart(::AbstractFlowpipe)`

and `tend(::AbstractFlowpipe)`

for details.

`ReachabilityAnalysis.vars`

— Method`vars(fp::AbstractFlowpipe)`

Return the tuple of variable indices of the flowpipe.

**Input**

`fp`

– flowpipe

**Output**

Tuple of integers with the variable indices of the flowpipe, typically $1, 2, …, n$ where $n$ is the dimension of the flowpipe.

**Notes**

The fallback implementation assumes first reach-set is representative.

## Flowpipe

`ReachabilityAnalysis.Flowpipe`

— Type`Flowpipe{N, RT<:AbstractReachSet{N}, VRT<:AbstractVector{RT}} <: AbstractFlowpipe`

Type that wraps a flowpipe, which is an iterable collection of reach-sets that behaves like their set union.

**Fields**

`Xk`

– array of reach-sets`ext`

– extension dictionary; field used by extensions

**Notes**

The dimension of the flowpipe corresponds to the dimension of the underlying reach-sets; in this type, it is is assumed that the dimension is the same for the different reach-sets.

`ReachabilityAnalysis.location`

— Method`location(F::Flowpipe)`

Return the location of a flowpipe within a hybrid system, or `missing`

if it is not defined.

**Input**

`F`

– flowpipe

**Output**

The `:loc_id`

value of stored in the flowpipe's extension field.

The following methods are available.

`ReachabilityAnalysis.shift`

— Function`shift(R::AbstractReachSet, t0::Number)`

Perform a time-shift of the given reach-set.

**Input**

`R`

– reach-set`t0`

– number that corresponds to the time-shift

**Output**

A new reach-set of the same type of `R`

such that its time-span has been shifted by `t0`

.

`shift(fp::Flowpipe{N, <:AbstractReachSet}, t0::Number) where {N}`

Return the time-shifted flowpipe by the given number.

**Input**

`fp`

– flowpipe`t0`

– time shift

**Output**

A new flowpipe such that the time-span of each constituent reach-set has been shifted by `t0`

.

## Hybrid flowpipe

`ReachabilityAnalysis.HybridFlowpipe`

— Type`HybridFlowpipe{N, D, FT<:AbstractFlowpipe, VOA<:VectorOfArray{N, D, Vector{FT}}} <: AbstractFlowpipe`

Type that wraps a vector of flowpipes of the same type, such that they are contiguous in time.

**Fields**

`Fk`

– vector of flowpipes`ext`

– (optional, default: empty) dictionary for extensions

**Notes**

The evaluation functions (in time) for this type do not assume that the flowpipes are contiguous in time. That is, the final time of the `i`

-th flowpipe does not match the start time of the `i+1`

-th flowpipe.

## Mixed flowpipe

`ReachabilityAnalysis.MixedFlowpipe`

— Type`MixedFlowpipe{N, D, FT<:AbstractFlowpipe, VOA<:VectorOfArray{N, D, Vector{FT}}} <: AbstractFlowpipe`

Type that wraps a vector of flowpipes of the same time, such that they are not necessarily contiguous in time.

**Fields**

`Fk`

– vector of flowpipes`ext`

– (optional, default: empty) dictionary for extensions

**Notes**

This type does not assume that the flowpipes are contiguous in time.

## Shifted flowpipe

`ReachabilityAnalysis.ShiftedFlowpipe`

— Type`ShiftedFlowpipe{FT<:AbstractFlowpipe, NT<:Number} <: AbstractFlowpipe`

Type that lazily represents a flowpipe that has been shifted in time.

**Fields**

`F`

– original flowpipe`t0`

– time shift

**Notes**

This type can wrap any concrete subtype of `AbstractFlowpipe`

, and the extra field `t0`

is such that the time spans of each reach-set in `F`

are shifted by the amount `t0`

(which should be a subtype of `Number`

).

## Partitioned flowpipe

`ReachabilityAnalysis.PartitionedFlowpipe`

— Type`PartitionedFlowpipe{N, D, FT<:AbstractFlowpipe, VOA<:VectorOfArray{N, D, Vector{FT}}} <: AbstractFlowpipe`

Type that wraps a vector of flowpipes of possibly different types.

**Fields**

`Fk`

– vector of flowpipes`ext`

– (optional, default: empty) dictionary for extensions

**Notes**

## Mapped flowpipe

`ReachabilityAnalysis.MappedFlowpipe`

— Type`MappedFlowpipe{FT<:AbstractFlowpipe, ST} <: AbstractFlowpipe`

**Fields**

`F`

– flowpipe`func`

– function representing the map