Skip to main content

boa_star_anytime_basic

Function boa_star_anytime_basic 

Source
pub fn boa_star_anytime_basic<G, H, C, P>(
    graph: &G,
    heuristic: H,
    start: G::State,
    is_goal: P,
    d: u32,
    on_front: impl FnMut(&[Solution<G::State, [C; 2]>], ApproxFactor<C>),
    budget: impl Budget<Stats>,
) -> AnytimeFront<G::State, C>
where G: Graph<Weight = [C; 2]>, H: Heuristic<G::State, [C; 2]>, C: Cost + WideMul, P: Fn(&G::State) -> bool,
Expand description

Basic-A-BOA*ε, the paper’s baseline: boa_star_anytime without reuse.

Every iteration runs BOA*ε from scratch over the whole front with ε the current overall factor divided by d, and keeps its result. Same reports and guarantees as boa_star_anytime; slower, since every iteration repeats the work of the last. Mainly for comparison.

§Panics

Panics if d < 2.

§Examples

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

/// Two routes from 0 to 1.
struct Routes;

impl Graph for Routes {
    type State = u8;
    type Weight = [u32; 2];

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

let result =
    boa_star_anytime_basic(&Routes, ZeroHeuristic, 0, |s| *s == 1, 4, |_, _| {}, |_: &_| false);
assert_eq!(result.solutions.len(), 2);