pub struct Front<C, const N: usize> { /* private fields */ }Expand description
A Pareto frontier of N-objective cost vectors.
Holds mutually non-dominated points, at most one per distinct vector, sorted lexicographically ascending. For two objectives that means the first objective strictly ascending and the second strictly descending.
Only points that are lexicographically no greater than a probe can weakly dominate it, so queries binary-search that prefix first:
| Operation | N <= 2 | N > 2 |
|---|---|---|
Front::weakly_dominates | O(log n) | O(log n + k), k the prefix length |
Front::insert | O(log n) plus a tail shift | O(n) |
§Examples
use multiobjective_search::Front;
let mut front = Front::new();
assert!(front.insert([1_u32, 2, 3]));
assert!(front.insert([3, 2, 1]));
assert!(!front.insert([3, 3, 3])); // dominated by both
assert!(front.insert([1, 2, 2])); // replaces [1, 2, 3]
assert_eq!(front.as_slice(), &[[1, 2, 2], [3, 2, 1]]);Implementations§
Source§impl<C: Cost, const N: usize> Front<C, N>
impl<C: Cost, const N: usize> Front<C, N>
Sourcepub fn weakly_dominates(&self, point: &[C; N]) -> bool
pub fn weakly_dominates(&self, point: &[C; N]) -> bool
Returns true if some point on the frontier is no worse than point
in every objective, equality included.
Trait Implementations§
impl<C: Eq, const N: usize> Eq for Front<C, N>
impl<C: PartialEq, const N: usize> StructuralPartialEq for Front<C, N>
Auto Trait Implementations§
impl<C, const N: usize> Forget for Front<C, N>
impl<C, const N: usize> Freeze for Front<C, N>
impl<C, const N: usize> Move for Front<C, N>
impl<C, const N: usize> RefUnwindSafe for Front<C, N>
impl<C, const N: usize> Send for Front<C, N>
impl<C, const N: usize> Sync for Front<C, N>
impl<C, const N: usize> Unpin for Front<C, N>
impl<C, const N: usize> UnsafeUnpin for Front<C, N>
impl<C, const N: usize> UnwindSafe for Front<C, 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
Mutably borrows from an owned value. Read more