Space-Time A*
search mapf-search
Space-time A* plans the path of one agent when some vertices and moves are forbidden at given times (constraints). It runs A* over states (vertex, time): from (v, t) the agent waits or moves to a neighbour at cost 1, unless a constraint forbids the vertex at t + 1 or the move at t. The heuristic is the exact distance to the goal from a backward breadth-first search, raised so that the agent cannot arrive before the last constraint on its goal; it is admissible, so the path is the cheapest one under the constraints. Successors later than the last constraint plus the number of vertices are cut, so an empty open list proves that no path exists. CBS and PBS in the crate use it as their low level, and with a conflict avoidance table it prefers, among the cheapest paths, the one with the fewest conflicts.
Pseudocode
algorithm Space-Time-A*(start, goal, CONSTRAINTS)input: start and goal vertices, the agent's vertex and edge constraintsoutput: a cheapest path from start to goal under the constraints, or failuredist ← backward-bfs(goal) ▷ exact distances, computed once per agentτ ← blocked-until(CONSTRAINTS, goal) ▷ last time the goal is forbiddenT ← latest-step(CONSTRAINTS) + |V| ▷ horizong[(start, 0)] ← 0OPEN ← {(start, 0)} ▷ ordered by f = g + h, ties to larger gwhile OPEN ≠ ∅ do(v, t) ← extract-min(OPEN)if v = goal and t > τ thenreturn path-to((v, t)) ▷ the agent stays at its goal for goodif t < T thenfor each u in {v} ∪ neighbors(v) do ▷ wait or move, at cost 1if allows(CONSTRAINTS, v, u, t) and dist[u] < ∞ thenif g[(v, t)] + 1 < g[(u, t + 1)] theng[(u, t + 1)] ← g[(v, t)] + 1parent[(u, t + 1)] ← (v, t)insert-or-update(OPEN, (u, t + 1), g[(u, t + 1)] + h(u, t + 1))return failure ▷ a proof: every path fits in the horizonfunction h(u, t)return max(dist[u], τ + 1 − t)In the crates
mapf-searchThe single-agent low level under constraints, built on the heuristic-search crate's A*.
Lineage
Papers
- Cooperative Pathfinding David Silver · 2005· Proceedings of the AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment (AIIDE 2005)
- Conflict-based search for optimal multi-agent pathfinding Guni Sharon, Roni Stern, Ariel Felner, Nathan R. Sturtevant · 2015· Artificial Intelligence