Package: continuoussets
The Python librarycontinuoussetsprovides classes for the representation of continuous sets and the evaluation of set operations on them.InstallationSet RepresentationsIntervalsZonotopesSet OperationsReferencesInstallationThe librarycontinuoussetsrequires Python 3.9 or higher.
The only direct dependencies arenumpy,scipy, andmatplotlib.
Installation via PyPI is recommended:pipinstallcontinuoussetsProficient users may choose their own installation path.Set RepresentationsThe implemented classes inherit from the abstract base classConvexSet.
They represent continuous sets of n-dimensional vectors.[!TIP]
Many operations, notably including the constructors, also support scalar types, such asintandfloat, as well as vectors defined using the typelist. However, these are internally converted to numpy arrays, which may slow down the computation.[!IMPORTANT]
The usage of keyword arguments for constructors ismandatory.IntervalsAn intervalIis defined using a lower boundlband an upper boundub:I = { x | lb <= x <= ub }wherelbandubare vectors of equal length, and the inequality holds elementwise.TheIntervalclass allows to instantiate such objects:I=Interval(lb=numpy.array([-2.,0.]),ub=numpy.array([2.,1.]))ZonotopesA zonotopesZis defined using a centercand a generator matrixG:Z = { c + sum_i G_i a_i | -1 <= a_i <= 1 }whereG_iare the columns ofG.
In contrast to intervals, zonotopes can represent dependencies between different dimensions.TheZonotopeclass allows to instantiate such objects:Z=Zonotope(c=numpy.array([1.,0.]),G=numpy.array([[1.,0.,2.],[-1.,1.,1.]]))Set OperationsMany standard set operations are implemented:boundary_point: Computation of boundary pointscartesian_product: Cartesian productcompact: Reduction to the minimal set representation size without changing the setconvex_hull: Convex hullmatmul: Linear mapminkowski_sum: Minkowski summinkowski_difference: Minkowski/Pontryagin differenceproject: Projection of the set onto an axis-aligned subspacereduce: Reduction of the set representation size, possibly incurring enlargementsupport_function: Support function evaluationvertices: Vertex enumerationvolume: Volume computation[!IMPORTANT]
All operations returnnew class instances.[!NOTE]
Operands for binary operations can also be vectors, represented by 1D numpy arrays.[!TIP]
Many operations supportvarious evaluation modesvia the keyword argumentmode. These detail whether an exact solution, an outer approximation or an inner approximation should be computed. Not all modes are supported for each operation, some operations cannot be evaluated exactly, and runtime may differ strongly between modes.Furthermore, the following checks are supported:contains: Containment of one set or vector in another setintersects: Intersection between a set and another set or vector__eq__: Equality of a set and another set or vectorrepresents: Equivalent representation of a set by another set representationTheIntervalclass additionally supportsinterval arithmeticfor range bounding purposes. This includesbasic operations: addition (__add__), subtraction (__sub__), multiplication (__mul__), division (__truediv__), exponentiation (__pow__)trigonometric functions:sin,cos,tan,arcsin,arccos,arctanother standard functions:sqrt,log,log10ReferencesThis library is heavily inspired by the MATLAB toolboxCORA.
However, this implementation is based on original sources, e.g.,G. Alefeld and G. Mayer. “Interval analysis: Theory and applications”.
In: Computational and Applied Mathematics 121.1-2 (2000), pp. 421–464. doi: 10.1016/S0377-0427(00)00342-3M. Althoff. “Reachability analysis and its application to the safety assessment of autonomous cars”.
Dissertation. Technische Universität München, 2010.