Skip to main content

Nonlinear

Struct Nonlinear 

Source
pub struct Nonlinear<D, const N: usize> { /* private fields */ }
Expand description

A Reach model of the nonlinear system x' = f(x, u) with N states.

The control of an edge is one input set U_k per time step of NonlinearSettings::step; see the module docs. Each step linearizes or polynomializes f around the current set (NonlinearSettings::method) and encloses the abstraction error. A step polyzonotope-reach cannot prove (the set or the step is too large for the abstraction, or the step for the Taylor bound) makes Reach::propagate return None, so the edge is Indeterminate, never Safe.

Sets are stepped whole: NonlinearSettings::max_pieces, splitting, merge_tolerance and adaptive do not apply, since a split set has no single end set to hand to the next edge.

§Examples

use robust_planning::models::Nonlinear;
use nalgebra::{DMatrix, DVector};
use robust_planning::polyzonotope::{SparsePolyZonotope, Zonotope};
use robust_planning::polyzonotope_reach::{NonlinearSettings, Polynomial};
use robust_planning::Reach;

// `x' = u - x³` per axis, from the box `[-0.1, 0.1]²` under inputs `u ∈ [0.9, 1.1]²`.
let drag = Polynomial::new(2, 2)
    .term(0, 1.0, &[0, 0, 1, 0])
    .term(0, -1.0, &[3, 0, 0, 0])
    .term(1, 1.0, &[0, 0, 0, 1])
    .term(1, -1.0, &[0, 3, 0, 0]);
let model = Nonlinear::<_, 2>::new(drag, NonlinearSettings::new(0.1));
let start = SparsePolyZonotope::from_zonotope(&Zonotope::new(
    DVector::zeros(2),
    DMatrix::identity(2, 2) * 0.1,
));
let input = Zonotope::new(DVector::from_element(2, 1.0), DMatrix::identity(2, 2) * 0.1);

let mut cover = Vec::new();
let end = model.propagate(&start, &vec![input; 5], &mut cover).expect("short steps are proven");

assert_eq!(cover.len(), 5);
assert!(end.interval_hull().0[0].lo > 0.0);

Implementations§

Source§

impl<D: Dynamics, const N: usize> Nonlinear<D, N>

Source

pub fn new(dynamics: D, settings: NonlinearSettings) -> Self

The model of dynamics, stepped with settings.

§Panics

Panics if dynamics does not have N states, or if settings are out of range; see NonlinearReach::new.

Trait Implementations§

Source§

impl<D: Dynamics, const N: usize> Reach<N> for Nonlinear<D, N>

Source§

type Control = Vec<Zonotope>

One input set per time step, each with one dimension per input of the dynamics.

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 input of the dynamics.

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<D, const N: usize> Forget for Nonlinear<D, N>

§

impl<D, const N: usize> Freeze for Nonlinear<D, N>

§

impl<D, const N: usize> Move for Nonlinear<D, N>

§

impl<D, const N: usize> RefUnwindSafe for Nonlinear<D, N>

§

impl<D, const N: usize> Send for Nonlinear<D, N>
where NonlinearReach<D>: Send,

§

impl<D, const N: usize> Sync for Nonlinear<D, N>
where NonlinearReach<D>: Sync,

§

impl<D, const N: usize> Unpin for Nonlinear<D, N>

§

impl<D, const N: usize> UnsafeUnpin for Nonlinear<D, N>

§

impl<D, const N: usize> UnwindSafe for Nonlinear<D, 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.