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>
impl<const N: usize> PolytopeGoal<N>
Sourcepub fn new(polytope: Polytope, center: [f64; N], max_splits: usize) -> Self
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.
Sourcepub fn from_box(b: &IntervalBox, max_splits: usize) -> Self
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.
Sourcepub const fn max_splits(&self) -> usize
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>
impl<const N: usize> Clone for PolytopeGoal<N>
Source§impl<const N: usize> Debug for PolytopeGoal<N>
impl<const N: usize> Debug for PolytopeGoal<N>
Source§impl<const N: usize> Goal<N> for PolytopeGoal<N>
impl<const N: usize> Goal<N> for PolytopeGoal<N>
Source§fn radius(&self) -> Option<f64>
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
fn containment(&self, set: &SparsePolyZonotope) -> Containment
Delegates to SparsePolyZonotope::containment within the split budget.
§Panics
Panics if set does not have N dimensions.
Source§impl<const N: usize> PartialEq for PolytopeGoal<N>
impl<const N: usize> PartialEq for PolytopeGoal<N>
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>
impl<const N: usize> Move for PolytopeGoal<N>
impl<const N: usize> RefUnwindSafe for PolytopeGoal<N>
impl<const N: usize> Send for PolytopeGoal<N>
impl<const N: usize> Sync for PolytopeGoal<N>
impl<const N: usize> Unpin for PolytopeGoal<N>
impl<const N: usize> UnsafeUnpin for PolytopeGoal<N>
impl<const N: usize> UnwindSafe for PolytopeGoal<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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for 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.