Skip to main content

Linear

Struct Linear 

Source
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>

Source

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>

Source§

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>

§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>>

Certifies a state the real system reaches in set that lies inside obstacle. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.