pub fn ecbs<G: Graph>(
instance: &Instance<G>,
objective: Objective,
weight: Weight,
budget: impl Budget<Stats>,
) -> MapfResultExpand description
Finds a conflict-free plan whose objective value is at most weight times the optimum,
with enhanced conflict-based search.
budget is asked before every constraint-tree expansion; MapfResult::stats counts
expanded nodes in Stats::expanded and nodes with paths (the root included) in
Stats::generated. Low-level searches run to completion. Like CBS, ECBS can only
prove unsolvability when an agent has no path at all or the tree runs empty.
§Panics
Panics if weight is below 1.
§Examples
use mapf_search::{Agent, Grid, Instance, Limits, Objective, Weight, ecbs, first_conflict};
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 budget = Limits::expansions(1_000);
let result = ecbs(&instance, Objective::SumOfCosts, Weight::new(3, 2), budget);
let solution = result.solution().expect("solvable");
assert_eq!(first_conflict(&solution.paths), None);
assert!(2 * solution.sum_of_costs <= 3 * 5, "the optimum is 5");