Skip to main content

multiobjective_search/
output.rs

1//! Search results shared by all algorithms.
2
3use alloc::vec::Vec;
4
5/// One Pareto-optimal path.
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct Solution<S, W> {
8    /// Total cost vector of [`Solution::path`].
9    pub cost: W,
10    /// States from the start to a goal, both included. Never empty.
11    pub path: Vec<S>,
12}
13
14/// Counters collected during a search.
15#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
16pub struct Stats {
17    /// Labels taken from the open list and expanded (goal labels excluded).
18    pub expanded: usize,
19    /// Labels that survived pruning at generation and entered the open list,
20    /// the start label included.
21    pub generated: usize,
22}
23
24/// The result of a multi-objective search.
25#[derive(Debug, Clone, PartialEq, Eq)]
26pub struct Output<S, W> {
27    /// One solution per Pareto-optimal cost vector, sorted by cost
28    /// lexicographically ascending (for two objectives: first strictly
29    /// ascending, second strictly descending). Empty when no goal is
30    /// reachable. [`boa_star_approx`](crate::boa_star_approx) and
31    /// [`boa_star_eps`](crate::boa_star_eps) return a covering subset of the
32    /// Pareto-optimal solutions instead, and [`pp_a_star`](crate::pp_a_star)
33    /// a covering set of mutually non-dominated solutions that need not be
34    /// Pareto-optimal.
35    pub solutions: Vec<Solution<S, W>>,
36    /// Search effort counters.
37    pub stats: Stats,
38}