pub enum Cost {
Length,
WidthWeighted {
weight: f64,
},
}Expand description
How a planner prices one edge.
Both options are additive along a path and never below the nominal length, so a Euclidean distance stays an admissible heuristic for them and RRT* rewiring stays well-defined.
§Examples
use robust_planning::Cost;
use robust_planning::polyzonotope::{Interval, IntervalBox, SparsePolyZonotope, Zonotope};
let set = SparsePolyZonotope::from_zonotope(&Zonotope::from_box(&IntervalBox(vec![
Interval::new(0.0, 0.2),
Interval::new(0.0, 0.4),
])));
assert_eq!(Cost::Length.edge(1.5, &set), 1.5);
let weighted = Cost::WidthWeighted { weight: 2.0 }.edge(1.5, &set);
assert!((weighted - (1.5 + 2.0 * 0.4)).abs() < 1e-12);Variants§
Length
The nominal path length. The default.
WidthWeighted
The nominal length plus weight times the width of the edge’s end set.
The width is the largest side of the set’s interval hull, so a path that keeps its
sets narrow, and with them its distance to the obstacles that bounded the proof,
costs less. A robustness-weighted cost: weight is length per unit of width.
weight is finite and non-negative; 0 prices like Cost::Length up to the
added zero.
The width term is charged per edge, not per unit of length, so the same path cut into more edges costs more: the cost also prefers fewer, longer edges. Because of that, RRT*’s optimality argument does not carry over to this cost.
Implementations§
Source§impl Cost
impl Cost
Sourcepub fn edge(&self, length: f64, end: &SparsePolyZonotope) -> f64
pub fn edge(&self, length: f64, end: &SparsePolyZonotope) -> f64
The cost of an edge of nominal length that ends in end.
Cost::Length returns length unchanged, so costs summed from the root equal the
nominal path length bit for bit.
Trait Implementations§
impl Copy for Cost
impl StructuralPartialEq for Cost
Auto Trait Implementations§
impl Forget for Cost
impl Freeze for Cost
impl Move for Cost
impl RefUnwindSafe for Cost
impl Send for Cost
impl Sync for Cost
impl Unpin for Cost
impl UnsafeUnpin for Cost
impl UnwindSafe for Cost
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.