polyzonotope
Sparse polynomial zonotopes, zonotopes and interval boxes for set-based reachability analysis, no_std and optionally with outward rounding
cargo add polyzonotope Who it is for
This crate does set-based reachability analysis with sparse polynomial zonotopes: rather than simulating one state at a time, it pushes a whole set of possible states through a model, and the result always encloses every state the system can actually reach. This is useful whenever the state is not known exactly. A drone, a robot arm or a cruise controller has sensors that are slightly off, a payload somewhere between 2 and 3 kg, and wind acting on it; a simulation with the best guess yields one trajectory, while the question for safety is where the system could possibly end up, for every value the uncertain parts might take. If none of those states lies inside the wall, the system cannot hit it; if one does, it is better to find out on paper.
This is the counterpart to sampling-based planners such as rapidly-exploring random trees (RRT). An RRT grows a tree of single trajectories until one of them reaches the goal, so it finds a way there, assuming everything happens exactly as computed. Reachability asks the opposite question: whether any of the possible outcomes is unsafe. The two combine well, since the planner proposes a path and the reachable set of the system following it shows that the path stays safe under the uncertainty.
How well that works depends on how the set is described. This crate has three descriptions, from coarse to fine:
- An interval box is one range per axis ("x between 1 and 2, y between 0 and 5"). It is cheap, but it loses shape quickly: rotate a box and you have to wrap the rotated box in a new, bigger one; repeated over many steps, this wrapping effect makes the box far larger than the set inside it.
- A zonotope is a center plus a few direction vectors, each stretched by some amount between -1 and 1. It can be skewed and stays exact under rotations, scaling and sums, so linear models don't blow it up.
- A sparse polynomial zonotope also allows those amounts to be multiplied with each other and raised to powers. That gives curved shapes (the parabola in the example below is one), and it keeps track of which uncertain quantity is which: two sets derived from the same sensor reading stay linked, instead of each pretending the other could take any value.
The crate is no_std with alloc, forbids unsafe, and with the sound feature rounds every enclosure outward, so its proofs hold in floating point too. Its main operations are cross-checked against CORA, the MATLAB toolbox for reachability analysis.
Algorithms 2
- Girard reduction Girard order reduction
Order reduction that drops the generators with the smallest 1-norm minus infinity-norm and encloses them in an axis-aligned box.
- PCA reduction PCA order reduction
Order reduction that encloses the dropped generators in a box aligned with their principal axes, the eigenvectors of G G^T.