pub struct Linear<const N: usize> { /* private fields */ }Expand description
A Reach model of the linear system x' = A x + B u with N states.
The control of an edge is one input set U_k per time step of the configured length;
see the module docs. Every step is proven, so Reach::propagate always
returns an end set. The carried time-point set is reduced to the configured order after
each step (Girard), so the sets stay small along long edges.
§Examples
use robust_planning::models::Linear;
use robust_planning::polyzonotope::{SparsePolyZonotope, Zonotope};
use robust_planning::polyzonotope_reach::LinearSystem;
use robust_planning::Reach;
use nalgebra::{DMatrix, DVector};
// A single integrator `x' = u` with inputs `u ∈ [0.9, 1.1]²`, 4 steps of 0.25.
let system = LinearSystem { a: DMatrix::zeros(2, 2), b: DMatrix::identity(2, 2) };
let model = Linear::<2>::new(system, 0.25, 4, 8.0)?;
let input = Zonotope::new(DVector::from_element(2, 1.0), DMatrix::identity(2, 2) * 0.1);
let start = SparsePolyZonotope::from_zonotope(&Zonotope::new(
DVector::zeros(2),
DMatrix::zeros(2, 0),
));
let mut cover = Vec::new();
let end = model.propagate(&start, &vec![input; 4], &mut cover).expect("linear steps are proven");
let hull = end.interval_hull();
assert_eq!(cover.len(), 4);
assert!(hull.0[0].lo <= 0.9 && hull.0[0].hi >= 1.1);Implementations§
Source§impl<const N: usize> Linear<N>
impl<const N: usize> Linear<N>
Sourcepub fn new(
system: LinearSystem,
step: f64,
taylor_terms: usize,
order: f64,
) -> Result<Self, ReachError>
pub fn new( system: LinearSystem, step: f64, taylor_terms: usize, order: f64, ) -> Result<Self, ReachError>
The model of system in steps of step, with taylor_terms terms of the matrix
exponential after the first, reducing to zonotope order order after every step.
§Errors
ReachError::InvalidStep if step is negative, infinite or NaN, and
ReachError::StepTooLarge if the Taylor remainder bound does not hold for this step
and term count; see LinearReach::new.
§Panics
Panics if A is not N × N, if B does not have N rows, or if order is below 1
or NaN.
Trait Implementations§
Source§impl<const N: usize> Reach<N> for Linear<N>
impl<const N: usize> Reach<N> for Linear<N>
Source§type Control = Vec<Zonotope>
type Control = Vec<Zonotope>
One input set per time step, each with one dimension per column of B.
Source§fn propagate(
&self,
initial: &SparsePolyZonotope,
control: &Self::Control,
cover: &mut Vec<SparsePolyZonotope>,
) -> Option<SparsePolyZonotope>
fn propagate( &self, initial: &SparsePolyZonotope, control: &Self::Control, cover: &mut Vec<SparsePolyZonotope>, ) -> Option<SparsePolyZonotope>
§Panics
Panics if initial does not have N dimensions or an input set does not have one
per column of B.
Source§fn certify_collision(
&self,
initial: &SparsePolyZonotope,
control: &Self::Control,
set: &SparsePolyZonotope,
obstacle: &Polytope,
) -> Option<Vec<f64>>
fn certify_collision( &self, initial: &SparsePolyZonotope, control: &Self::Control, set: &SparsePolyZonotope, obstacle: &Polytope, ) -> Option<Vec<f64>>
Auto Trait Implementations§
impl<const N: usize> Forget for Linear<N>
impl<const N: usize> Freeze for Linear<N>
impl<const N: usize> Move for Linear<N>
impl<const N: usize> RefUnwindSafe for Linear<N>
impl<const N: usize> Send for Linear<N>
impl<const N: usize> Sync for Linear<N>
impl<const N: usize> Unpin for Linear<N>
impl<const N: usize> UnsafeUnpin for Linear<N>
impl<const N: usize> UnwindSafe for Linear<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.