A package for set-based computing.
Project description
The Python library continuoussets provides classes for the representation of continuous sets and the evaluation of set operations on them.
Installation
The library continuoussets
requires Python 3.9 or higher.
The only direct dependencies are numpy, scipy, and matplotlib.
Installation via PyPI is recommended:
pip install continuoussets
Proficient users may choose their own installation path.
Set Representations
The implemented classes inherit from the abstract base class ConvexSet
.
They represent continuous sets of n-dimensional vectors.
[!TIP] Many operations, notably including the constructors, also support scalar types, such as
int
andfloat
, 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 is mandatory.
Intervals
An interval I
is defined using a lower bound lb
and an upper bound ub
:
I = { x | lb <= x <= ub }
where lb
and ub
are vectors of equal length, and the inequality holds elementwise.
The Interval
class allows to instantiate such objects:
I = Interval(lb = numpy.array([-2., 0.]), ub = numpy.array([2., 1.]))
Zonotopes
A zonotopes Z
is defined using a center c
and a generator matrix G
:
Z = { c + sum_i G_i a_i | -1 <= a_i <= 1 }
where G_i
are the columns of G
.
In contrast to intervals, zonotopes can represent dependencies between different dimensions.
The Zonotope
class allows to instantiate such objects:
Z = Zonotope(c = numpy.array([1., 0.]), G = numpy.array([[1., 0., 2.], [-1., 1., 1.]]))
Set Operations
Many 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 return new class instances.
[!NOTE] Operands for binary operations can also be vectors, represented by 1D numpy arrays.
[!TIP] Many operations support various evaluation modes via the keyword argument
mode
. 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 representation
The Interval
class additionally supports interval arithmetic for range bounding purposes. This includes
- basic operations: addition (
__add__
), subtraction (__sub__
), multiplication (__mul__
), division (__truediv__
), exponentiation (__pow__
) - trigonometric functions:
sin
,cos
,tan
,arcsin
,arccos
,arctan
- other standard functions:
sqrt
,log
,log10
References
This library is heavily inspired by the MATLAB toolbox CORA. 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-3
- M. Althoff. “Reachability analysis and its application to the safety assessment of autonomous cars”. Dissertation. Technische Universität München, 2010.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file continuoussets-0.0.0.tar.gz
.
File metadata
- Download URL: continuoussets-0.0.0.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c1ade5413d21d3aa99b54560fd9d8539415e6b252bb81d4ba6a16819b9db5ea |
|
MD5 | 5e6a3d5aa58714f112812989da7f615a |
|
BLAKE2b-256 | 322c58ac32945ef84254c77955d1be894455917de62ae4ef1d028502e2955e7c |
File details
Details for the file continuoussets-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: continuoussets-0.0.0-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e1384c3370b1a538008f4699b0d848b82882afb9f4cfa9ccdbb46d4ace6f5b |
|
MD5 | 941d46dd814fea5200e7968e22112afc |
|
BLAKE2b-256 | 0b48cac03f2ec0f90cc6fa3bbf9f12608c48224407dc7c3db292d03268bc11ec |