# Clustering

## Abstract interface

`ReachabilityAnalysis.AbstractClusteringMethod`

— Type`AbstractClusteringMethod{P}`

Abstract supertype for all clustering types, with partition of type `P`

.

**Notes**

A clustering method defines a function which maps reach-sets to one or several reach-sets. The mapping can possibly be over-approximative, i.e. such that the set union of the input reach-sets is included in the set union of the output reach-sets.

By taking the convex hull of the input reach-sets one can reduce the number of outputs sets to a single one, overapproximately. This is the method that corresponds to the `LazyClustering`

type. However, in some cases it is convenient to do other types of transformations, such as:

- Return several reach-sets that are obtained by grouping the input in a way defined by a partition. For example, a vector of ten input sets can be clustered in two groups of five sets each, or five groups of two sets each, etc.
- Use different set representations such as boxes or zonotopes.
- Further post-process the output of the convexification by splitting into smaller sets, eg. box splitting.

Each concrete subtype of `AbstractClusteringMethod`

has a parameter `P`

that defines what type of clustering strategy is applied. The method should be accessed with the `partition`

getter function.

The following strategies are implemented at the interface level:

- If
`P`

is of type`Missing`

: no partition is applied - If
`P`

is of type integer: the partition corresponds to grouping the into the given integer number of sets (or as close as possible) - If
`P`

is of type vector of vectors: the given partition is applied

**Examples**

`LazyClustering([1:2, 3:10])`

groups the first two reach-sets in one cluster and the third to tenth reach-sets in another cluster.

## No clustering

`ReachabilityAnalysis.NoClustering`

— Type`NoClustering{P} <: AbstractClusteringMethod{P}`

No-op clustering method.

The following methods are available.

## Lazy convexification

`ReachabilityAnalysis.LazyClustering`

— Type`LazyClustering{P} <: AbstractClusteringMethod{P}`

Cluster according to the given partition by applying a lazy representation of the convex hull.

## Box clustering

`ReachabilityAnalysis.BoxClustering`

— Type`BoxClustering{PI, PO} <: AbstractClusteringMethod{P}`

**Notes**

This method first takes a lazy convex hull for the given partition, then computes a tight hyperrectangular approximation for each element in the partition.

## Zonotope clustering

`ReachabilityAnalysis.ZonotopeClustering`

— Type`ZonotopeClustering{P} <: AbstractClusteringMethod{P}`

**Notes**

This method first takes a lazy convex hull for the given partition, then computes a zonotope overapproximation of the convex hull.

## Lazy union

`ReachabilityAnalysis.UnionClustering`

— Type`UnionClustering{P} <: AbstractClusteringMethod{P}`

Cluster according to the given partition by applying a lazy representation of the set union.