1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! # Multi-agent pathfinding
//!
//! Multi-agent pathfinding (MAPF): one path per agent on a shared graph, without
//! collisions, minimizing a joint objective.
//!
//! An [`Instance`] is a [`Graph`] (such as a [`Grid`] or an [`AdjacencyList`]) and a list
//! of [`Agent`]s with distinct starts and goals. Time is discrete; each step an agent moves
//! along an edge or waits, at cost 1. After its path ends, an agent stays at its goal and
//! keeps blocking it. Two agents [`Conflict`] if they share a vertex at the same time or
//! swap vertices along an edge.
//!
//! - [`cbs()`]: conflict-based search, optimal for [`sum_of_costs`] or [`makespan`]
//! ([`Objective`]), with prioritized conflicts, bypass, the CG, DG or WDG heuristic
//! ([`CbsHeuristic`]), a conflict
//! avoidance table and disjoint [`Splitting`]; [`cbs_with`] and [`CbsConfig`] switch
//! them individually.
//! - [`ecbs()`]: enhanced CBS, bounded-suboptimal within a [`Weight`] `w`, with focal search
//! at both levels.
//! - [`icts()`]: increasing cost tree search with pairwise pruning, optimal.
//! - [`mstar()`]: recursive M* with operator decomposition (subdimensional expansion),
//! optimal, and able to prove unsolvability; [`mstar_with`] and [`MStarConfig`] select
//! basic M*, recursive M* without operator decomposition, and OD-M*.
//! - [`pbs()`]: priority-based search, fast but neither optimal nor complete.
//! - `mo_cbs`, `mo_cbs_with` and `mo_cbs_per_agent`, with the `multi-objective` feature:
//! multi-objective CBS (MO-CBS and MO-CBS-t, over BOA* or NAMOA*dr), every
//! Pareto-optimal plan when moves and waits cost vectors, shared or per agent, with an
//! opt-in feasibility check, conflict prioritization, bypass and disjoint splitting.
//!
//! Every solver takes an [`Objective`]: sum of costs or makespan.
//! - [`space_time_astar`]: the single-agent low level under [`Constraint`]s, built on the
//! `heuristic-search` crate's A*.
//! - [`first_conflict`] and [`conflicts`]: conflict detection on any set of paths.
//! - [`parse_map`], [`parse_scenario`] and [`scenario_instance`]: Moving AI benchmarks.
//!
//! Every solver returns a [`MapfResult`]: an [`Outcome`] (with a [`Solution`] if solved)
//! and high-level [`Stats`]. [`Budget`], [`Limits`] and [`Stats`] are re-exported from
//! `heuristic-search`; they bound and count the high-level expansions. [`Weight`] is too.
//!
//! The crate is `no_std` and needs only `alloc`.
//!
//! ## Example
//!
//! ```
//! use mapf_search::{Agent, Grid, Instance, Limits, Objective, cbs, first_conflict};
//!
//! // Two agents swap the ends of a corridor that has one side pocket.
//! let grid = Grid::parse(&["...", "@.@"]);
//! let agents = vec![
//! Agent { start: grid.vertex(0, 0), goal: grid.vertex(2, 0) },
//! Agent { start: grid.vertex(2, 0), goal: grid.vertex(0, 0) },
//! ];
//! let instance = Instance::new(grid, agents)?;
//!
//! let result = cbs(&instance, Objective::SumOfCosts, Limits::expansions(1_000));
//! let solution = result.solution().expect("the pocket lets them pass");
//!
//! assert_eq!(first_conflict(&solution.paths), None);
//! assert_eq!(solution.sum_of_costs, 7);
//! # Ok::<(), mapf_search::InstanceError>(())
//! ```
//!
//! Not yet implemented: CBS-TA, MAPF-LNS2 and EPEA*.
//!
//! Repository: <https://github.com/sunsided/mapf-search>
extern crate alloc;
/// Doctests for the code examples in README.md (not part of the API).
pub use ;
pub use ;
pub use ;
pub use ecbs;
pub use ;
pub use ;
pub use icts;
pub use ;
pub use space_time_astar;
pub use ;
pub use ;
pub use ;
pub use ;
pub use pbs;
pub use ;