Skip to main content

IndexedFront

Struct IndexedFront 

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

An immutable set of N-objective cost vectors, sorted lexicographically, with a range-minimum index (Xu et al., “Asynchronous Parallel Search for Exact Multi-Objective Shortest Paths with Versioned Frontier Snapshots and Indexed Dominance Pruning”, arXiv 2609.11944, Algorithms 4 and 5).

A query q first binary-searches the prefix of vectors that are lexicographically no greater than q, since only those can weakly dominate it. The index then discards every block or tree range whose component-wise minimum exceeds q in some objective; the vectors that survive are compared exactly, so the answer is the plain dominance test. The index pays off when the prefix is long and the vectors spread across objectives; its worst case stays linear.

The vectors need not be mutually non-dominated.

§Examples

use multiobjective_search::{FrontIndex, IndexedFront};

// The base of the paper's Figure 2.
let base = vec![
    [4_u32, 9, 9], [5, 8, 7], [6, 4, 9], [6, 7, 8],
    [7, 3, 7], [7, 5, 5], [8, 1, 1], [9, 0, 0],
];
for index in [FrontIndex::None, FrontIndex::Blocks, FrontIndex::Tree] {
    let front = IndexedFront::new(base.clone(), index);
    assert!(front.weakly_dominates(&[7, 6, 6])); // by [7, 5, 5]
    assert!(!front.weakly_dominates(&[6, 6, 6]));
}

Implementations§

Source§

impl<C: Cost, const N: usize> IndexedFront<C, N>

Source

pub fn new(points: Vec<[C; N]>, index: FrontIndex) -> Self

Sorts points and builds the chosen index over them, with blocks of 16 vectors for FrontIndex::Blocks.

Source

pub fn with_block_size( points: Vec<[C; N]>, index: FrontIndex, block: usize, ) -> Self

IndexedFront::new with block vectors per block of FrontIndex::Blocks (ignored by the other indexes).

§Panics

Panics if block is zero.

Source

pub fn as_slice(&self) -> &[[C; N]]

The vectors, sorted lexicographically ascending.

Source

pub fn len(&self) -> usize

The number of vectors.

Source

pub fn is_empty(&self) -> bool

Returns true if the set is empty.

Source

pub fn weakly_dominates(&self, q: &[C; N]) -> bool

Returns true if some vector is no worse than q in every objective.

Trait Implementations§

Source§

impl<C: Clone, const N: usize> Clone for IndexedFront<C, 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<C: Debug, const N: usize> Debug for IndexedFront<C, N>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C, const N: usize> Forget for IndexedFront<C, N>

§

impl<C, const N: usize> Freeze for IndexedFront<C, N>
where Vec<[C; N]>: Freeze, Summary<C, N>: Freeze,

§

impl<C, const N: usize> Move for IndexedFront<C, N>

§

impl<C, const N: usize> RefUnwindSafe for IndexedFront<C, N>
where Vec<[C; N]>: RefUnwindSafe, Summary<C, N>: RefUnwindSafe,

§

impl<C, const N: usize> Send for IndexedFront<C, N>
where Vec<[C; N]>: Send, Summary<C, N>: Send,

§

impl<C, const N: usize> Sync for IndexedFront<C, N>
where Vec<[C; N]>: Sync, Summary<C, N>: Sync,

§

impl<C, const N: usize> Unpin for IndexedFront<C, N>
where Vec<[C; N]>: Unpin, Summary<C, N>: Unpin,

§

impl<C, const N: usize> UnsafeUnpin for IndexedFront<C, N>
where Vec<[C; N]>: UnsafeUnpin, Summary<C, N>: UnsafeUnpin,

§

impl<C, const N: usize> UnwindSafe for IndexedFront<C, N>
where Vec<[C; N]>: UnwindSafe, Summary<C, 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> 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.