Skip to main content

minsum_maxmin_multi

Function minsum_maxmin_multi 

Source
pub fn minsum_maxmin_multi<G, H, C, K, P, const N: usize, const M: usize>(
    graph: &G,
    heuristic: H,
    start: G::State,
    is_goal: P,
) -> Output<G::State, SumsAndWidths<C, K, N, M>>
where G: Graph<Weight = ([C; N], [K; M])>, H: Heuristic<G::State, [C; N]>, C: Cost, K: Copy + Ord, P: Fn(&G::State) -> bool,
Expand description

Finds one path for every Pareto-optimal cost from start to a state that satisfies is_goal, with N additive costs to minimize and M bottleneck capacities to maximize (edge weights (sums, capacities)).

This generalizes minsum_maxmin to the problems with several maxmin objectives surveyed by Craveirinha et al. (Algorithms 17(6):222, 2024; Pinto et al. 2009, Gandibleux et al. 2006, Bornstein et al. 2012). Labels leave the open list in lexicographic f order, wider bottlenecks first among equal ones, and are dropped when an earlier label at their state, or an earlier solution against f, is no worse in every sum and every bottleneck. That keeps one path per non-dominated cost (the minimal complete set): with bottlenecks, an efficient path may run through a weakly efficient sub-path, which is why the dominance test compares whole labels rather than truncated ones.

Requirements, not checked at run time: non-negative costs and a heuristic on the sums that is consistent and zero on every goal.

Solutions are sorted lexicographically by their sums.

ยงExamples

use multiobjective_search::{Graph, ZeroHeuristic, minsum_maxmin_multi};

/// Two links from 0 to 1: one wide in bandwidth, one in reliability.
struct Links;

impl Graph for Links {
    type State = u8;
    type Weight = ([u32; 1], [u32; 2]);

    fn successors(&self, state: &u8, out: &mut Vec<(u8, ([u32; 1], [u32; 2]))>) {
        if *state == 0 {
            out.extend([(1, ([5], [100, 1])), (1, ([5], [1, 100])), (1, ([9], [1, 1]))]);
        }
    }
}

let out = minsum_maxmin_multi(&Links, ZeroHeuristic, 0, |s| *s == 1);
assert_eq!(out.solutions.len(), 2); // the third link is dominated