pub fn cbs<G: Graph>(
instance: &Instance<G>,
objective: Objective,
budget: impl Budget<Stats>,
) -> MapfResultExpand description
Finds a conflict-free plan that is optimal for objective with conflict-based search,
with every improvement of CbsConfig::improved.
See cbs_with for the budget and the tie-breaking.
ยงExamples
use mapf_search::{Agent, Grid, Instance, Limits, Objective, cbs};
// Two agents cross on a plus-shaped map; one has to wait.
let grid = Grid::parse(&["@.@", "...", "@.@"]);
let agents = vec![
Agent { start: grid.vertex(0, 1), goal: grid.vertex(2, 1) },
Agent { start: grid.vertex(1, 0), goal: grid.vertex(1, 2) },
];
let instance = Instance::new(grid, agents)?;
let result = cbs(&instance, Objective::SumOfCosts, Limits::expansions(1_000));
let solution = result.solution().expect("solvable");
assert_eq!(solution.sum_of_costs, 5);
assert_eq!(solution.makespan, 3);