Skip to main content

PolytopeGoal

Struct PolytopeGoal 

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

A convex polytope goal in H-representation, { x | aᵢᵀ x <= dᵢ for every facet i }.

Containment is decided by SparsePolyZonotope::containment with a split budget of PolytopeGoal::max_splits. It is a proof with the sound feature, and up to floating-point rounding without it.

§Examples

use robust_planning::{Goal, PolytopeGoal};
use robust_planning::polyzonotope::{
    Containment, Interval, IntervalBox, SparsePolyZonotope, Zonotope,
};

let square = |lo: f64, hi: f64| IntervalBox(vec![Interval::new(lo, hi); 2]);
let goal = PolytopeGoal::<2>::from_box(&square(0.0, 4.0), 8);
let set = |b| SparsePolyZonotope::from_zonotope(&Zonotope::from_box(&b));

assert_eq!(goal.center(), [2.0, 2.0]);
assert_eq!(goal.containment(&set(square(1.0, 2.0))), Containment::Inside);
assert_ne!(goal.containment(&set(square(3.0, 5.0))), Containment::Inside);

Implementations§

Source§

impl<const N: usize> PolytopeGoal<N>

Source

pub fn new(polytope: Polytope, center: [f64; N], max_splits: usize) -> Self

Creates a goal from its facets, the state for goal-biased samples and a split budget.

§Panics

Panics if a facet normal does not have N entries, or if a normal entry or an offset is not finite. A NaN facet would never refute containment, so it is rejected here instead of silently proving every set inside.

Source

pub fn from_box(b: &IntervalBox, max_splits: usize) -> Self

Creates a box goal, centered for goal-biased samples at the box midpoint.

§Panics

Panics if the box does not have N dimensions or has an infinite bound.

Source

pub const fn polytope(&self) -> &Polytope

The goal region.

Source

pub const fn max_splits(&self) -> usize

Split budget for proving a set inside.

Trait Implementations§

Source§

impl<const N: usize> Clone for PolytopeGoal<N>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for PolytopeGoal<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Goal<N> for PolytopeGoal<N>

Source§

fn radius(&self) -> Option<f64>

The distance from the center to the farthest corner of the box that the polytope’s axis-aligned facets bound, or None if some axis is not bounded on both sides by such a facet.

Facets with other normals only cut the polytope further, so the box contains it and the radius is an upper bound. It is widened by a few ULPs against rounding.

Source§

fn containment(&self, set: &SparsePolyZonotope) -> Containment

Delegates to SparsePolyZonotope::containment within the split budget.

§Panics

Panics if set does not have N dimensions.

Source§

fn center(&self) -> [f64; N]

The state drawn for goal-biased samples, usually inside the goal.
Source§

impl<const N: usize> PartialEq for PolytopeGoal<N>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const N: usize> StructuralPartialEq for PolytopeGoal<N>

Auto Trait Implementations§

§

impl<const N: usize> Forget for PolytopeGoal<N>

§

impl<const N: usize> Freeze for PolytopeGoal<N>
where [f64; N]: Freeze,

§

impl<const N: usize> Move for PolytopeGoal<N>

§

impl<const N: usize> RefUnwindSafe for PolytopeGoal<N>
where [f64; N]: RefUnwindSafe,

§

impl<const N: usize> Send for PolytopeGoal<N>
where [f64; N]: Send,

§

impl<const N: usize> Sync for PolytopeGoal<N>
where [f64; N]: Sync,

§

impl<const N: usize> Unpin for PolytopeGoal<N>
where [f64; N]: Unpin,

§

impl<const N: usize> UnsafeUnpin for PolytopeGoal<N>
where [f64; N]: UnsafeUnpin,

§

impl<const N: usize> UnwindSafe for PolytopeGoal<N>
where [f64; N]: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.