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>
impl<C: Cost, const N: usize> IndexedFront<C, N>
Sourcepub fn new(points: Vec<[C; N]>, index: FrontIndex) -> Self
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.
Sourcepub fn with_block_size(
points: Vec<[C; N]>,
index: FrontIndex,
block: usize,
) -> Self
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.
Sourcepub fn weakly_dominates(&self, q: &[C; N]) -> bool
pub fn weakly_dominates(&self, q: &[C; N]) -> bool
Returns true if some vector is no worse than q in every
objective.