Algorithm Search⌘K

Algorithmcore

Prioritized multi-robot planning

Also called Erdmann-Lozano-Perez prioritized planning.

Plan robots one at a time in a fixed priority order, each one treating the paths of the robots before it as moving obstacles in space-time.

Time
O(r g H log(g H)) total
Space
O(g H + r H) extra
Counts
messages O(r) total
Where
H = the time horizon in steps; g = the number of free grid cells; r = the number of robots
Properties
not completedeterministicofflinenot randomized
Origin
Michael Erdmann, Tomas Lozano Perez, 1987

Prioritized planning finds collision-free paths for several robots by planning them one at a time in a fixed order. Each robot searches in space-time and treats the planned paths of all robots before it as moving obstacles, so it never has to search the joint space of the team. It is the simplest decoupled method on the coupled and decoupled planning page: it is fast and usually good, but unlike conflict-based search or a search of the joint space for multi-agent pathfinding, it is incomplete and can fail on instances that have a solution.

In plain words

The robots take turns, by rank. The first robot plans the shortest route to its goal as if it were alone. The second robot plans its route while it keeps out of the way of the first, and it may wait or step aside to let the first robot pass. The third one keeps out of the way of both, and so on. Each robot writes down where it will be at each moment, and the later robots read this list.

This is quick, because each robot plans only for itself. The weak point is that a robot with a high rank never makes room for the robots after it. If the first robot parks in the only doorway, the others can never get through, even if a better plan for the whole team exists.

The problem

The model. The workspace is a 4-connected grid with gg free cells. Time is discrete and synchronous: in each step every robot moves to a neighbor cell or waits. There are rr robots, each with a start cell and a goal cell. Two robots must never be in the same cell at the same time (a vertex conflict) and must never swap cells in one step (a swap conflict). A robot that reaches its goal stays there. The plans are computed by one planner, or by the robots in turn: robot kk receives the plans of robots 11 to k−1k - 1 and broadcasts its own, so the team sends rr plan messages in rr sequential rounds over any graph that can broadcast.

Input. The grid, the starts and goals, a priority order of the robots, and a time horizon HH.

Output. One path per robot with no vertex or swap conflicts, or the answer "no plan found".

How it differs from close pages. Multi-agent pathfinding is the problem on a general graph, and conflict-based search solves it optimally and completely by splitting on conflicts. A coupled search over the joint space is complete but grows exponentially with rr; the coupled and decoupled planning page compares the two families. Pebble motion on graphs asks only whether the robots can reach their goals, one move at a time, and is decidable in polynomial time. Prioritized planning is the greedy end of this range.

The algorithm

  1. PRIORITIZED-PLANNING(grid, starts, goals, order, H)
  2. 1R ← an empty reservation table of (cell, time) and (move, time)
  3. 2for each robot k in order do
  4. 3π_k ← space-time A* from (s_k, 0) to g_k that avoids every entry of R, up to time H
  5. 4if π_k = none then return none
  6. 5add every (cell, time) and every move of π_k to R, and hold g_k from the arrival time on
  7. 6return π_1, ..., π_r

Line L3 runs A* on states (c,t)(c, t), a cell and a time, with the Manhattan distance to the goal as the heuristic. A state is blocked if an earlier robot is in cell cc at time tt, also when it has parked there; a move from cc to c′c' is forbidden if an earlier robot moves from c′c' to cc in the same step. The search may end at the goal only at a time after which no earlier robot passes the goal, since the robot will park there. The waiting move keeps the robot in place, so a robot can let others pass. Line L5 writes the plan into the table, and parks the robot at its goal for ever.

In the code the default horizon is H=g(r+1)H = g (r + 1), a design choice, not a bound from the paper.

Example

The pocket grid has 2 rows and 4 columns, with a single free cell in row 0 above column 1:

row 0:  #  .  #  #
row 1:  .  .  .  .

Robot 0 starts at (1,0)(1, 0) and must reach (1,3)(1, 3). Robot 1 starts at (1,3)(1, 3) and must reach (1,0)(1, 0). They must pass each other in the corridor.

Order 0, then 1. Robot 0 takes its shortest path along row 1 and reaches (1,3)(1, 3) at time 3. Robot 1 now needs to step into the pocket (0,1)(0, 1), but it cannot get there before robot 0 passes, and it cannot swap with robot 0. The search returns no plan.

Order 1, then 0. Robot 1 takes (1,3),(1,2),(1,1),(1,0)(1, 3), (1, 2), (1, 1), (1, 0). Robot 0 plans around it: (1,0),(1,1),(0,1),(1,1),(1,2),(1,3)(1, 0), (1, 1), (0, 1), (1, 1), (1, 2), (1, 3). It steps into the pocket at time 2, while robot 1 passes below, and arrives at time 5. A search of the joint space also finds makespan 5, so this order is optimal here.

No order works. On the grid with rows .... and ..##, robot 0 starts at (0,2)(0, 2) with goal (0,1)(0, 1), and robot 1 starts at (0,0)(0, 0) with goal (0,3)(0, 3). Prioritized planning fails for both orders, but a joint plan with makespan 4 exists: robot 0 moves to (0,1)(0, 1), steps down to (1,1)(1, 1) to let robot 1 pass, and steps back. In each order, the first robot takes its shortest path and blocks the other.

Correctness

The proof shows three theorems. Soundness: if line L6 returns plans, no two of them have a vertex or swap conflict, also after the robots park. Greedy optimality per robot: robot kk gets the earliest arrival time among all plans that avoid robots 11 to k−1k - 1, because A* with a consistent heuristic finds the earliest final goal state. Incompleteness: the 2-robot instance above has a plan with makespan 4, and prioritized planning fails for both orders and every horizon.

Proof: Prioritized planning returns only conflict-free plans, each robot gets the earliest arrival that the robots before it allow, and the method is incompletefull

The workspace is a grid of gg free cells. Time is discrete. In each step a robot moves to one of the 4 neighbor cells or waits. A plan for robot ii is a path πi(0),πi(1),…,πi(Ti)\pi_i(0), \pi_i(1), \dots, \pi_i(T_i) with πi(0)=si\pi_i(0) = s_i and πi(Ti)=gi\pi_i(T_i) = g_i, and the robot stays at gig_i for all t≥Tit \ge T_i. Write πi(t)=gi\pi_i(t) = g_i for t>Tit > T_i. Two plans have a vertex conflict if πi(t)=πk(t)\pi_i(t) = \pi_k(t) for some tt, and a swap conflict if πi(t)=πk(t+1)\pi_i(t) = \pi_k(t + 1) and πk(t)=πi(t+1)≠πi(t)\pi_k(t) = \pi_i(t + 1) \ne \pi_i(t) for some tt. A robot may move into a cell that another robot leaves in the same step. Lines L1 to L6 refer to the pseudocode on the prioritized multi-robot planning page.

The reservation table after robots 1,…,k1, \dots, k (in priority order) holds the pairs (πi(t),t)(\pi_i(t), t) for t≤Tit \le T_i, the moves (πi(t),πi(t+1),t)(\pi_i(t), \pi_i(t+1), t), and for each goal gig_i the time TiT_i from which it is held for ever. A space-time state (c,t)(c, t) is blocked if some earlier robot is at cc at time tt, counting the parked robots. A move from (c,t)(c, t) to (c′,t+1)(c', t + 1) is forbidden if (c′,t+1)(c', t+1) is blocked or an earlier robot moves from c′c' to cc at time tt. A goal state (gk,t)(g_k, t) is final if no earlier robot is at gkg_k at any time ≥t\ge t.

Lemma 1 (the search). If there is a path in space-time from (sk,0)(s_k, 0) to a final goal state that uses no blocked state and no forbidden move, and its arrival time is at most the horizon HH, then the search of line L3 returns such a path with the smallest arrival time. Otherwise it returns nothing.

Proof. The search is A* on the graph of states (c,t)(c, t) with unit cost per step, so the cost of a state is its time tt. The heuristic h(c)=∣cr−gr∣+∣cc−gc∣h(c) = |c_r - g_r| + |c_c - g_c| changes by at most 1 per step, and a step costs 1, so it is consistent, and h(gk)=0h(g_k) = 0. With a consistent heuristic, A* pops states in nondecreasing order of f=t+hf = t + h, and each state is reached first by a shortest path. A goal state has f=tf = t, so the first final goal state that is popped has the smallest time among all reachable final goal states. States are expanded only up to time HH, so a path is found exactly when one with arrival time at most HH exists. The state graph is finite, g(H+1)g (H + 1) states, so the search ends. □\square

Theorem 1 (soundness). If line L6 returns plans, no two of them have a vertex conflict or a swap conflict.

Proof. Take robots ii before kk in the order. The plan of kk was found when the plan of ii was in the table. For t≤Tkt \le T_k, the state (πk(t),t)(\pi_k(t), t) is not blocked, so πk(t)≠πi(t)\pi_k(t) \ne \pi_i(t), both while ii moves and after ii parks. For t>Tkt > T_k, robot kk is at gkg_k, and the goal state (gk,Tk)(g_k, T_k) was final, so πi(t)≠gk\pi_i(t) \ne g_k for t≥Tkt \ge T_k. So there is no vertex conflict. A swap needs both robots to move in the same step. If t<Tkt < T_k, the move of kk at time tt is not forbidden, so ii does not move the other way at time tt. If t≥Tkt \ge T_k, robot kk does not move. So there is no swap conflict. □\square

Theorem 2 (what each robot gets). Robot kk gets a plan with the earliest arrival time among all plans that avoid the plans of robots 1,…,k−11, \dots, k - 1 and arrive by time HH. The robots after kk have no effect on it.

Proof. This is Lemma 1 for robot kk; the table holds only the plans of the robots before kk. □\square

So the method is greedy over robots. A robot with high priority takes its shortest path and ignores everyone after it, which can leave no room for them.

Theorem 3 (incompleteness). There is an instance with 2 robots that has a conflict-free plan, while prioritized planning returns nothing for both orders, for every horizon.

Proof. Take the grid of 2 rows and 4 columns with walls at (1,2)(1, 2) and (1,3)(1, 3):

row 0:  .  .  .  .
row 1:  .  .  #  #

Robot 0 starts at (0,2)(0, 2) with goal (0,1)(0, 1). Robot 1 starts at (0,0)(0, 0) with goal (0,3)(0, 3). The cell (0,1)(0, 1) is the only link between the part {(0,0),(1,0),(1,1)}\{(0, 0), (1, 0), (1, 1)\} and the dead end {(0,2),(0,3)}\{(0, 2), (0, 3)\}.

Order 0 then 1. Robot 0 moves to (0,1)(0, 1) at time 1 and parks there for ever. Robot 1 is at (0,0)(0, 0) at time 0, and it must pass (0,1)(0, 1) to reach (0,3)(0, 3). The state ((0,1),t)((0,1), t) is blocked for every t≥1t \ge 1. So there is no plan for robot 1.

Order 1 then 0. The only shortest path of robot 1 is (0,0),(0,1),(0,2),(0,3)(0, 0), (0, 1), (0, 2), (0, 3), so by Lemma 1 it takes it and parks at (0,3)(0, 3) from time 3. Robot 0 starts in the dead end. It cannot be at (0,1)(0, 1) at time 1, because robot 1 is there. It cannot move from (0,2)(0, 2) to (0,1)(0, 1) between times 1 and 2, because robot 1 moves from (0,1)(0, 1) to (0,2)(0, 2) then, which is a swap. From (0,3)(0, 3) it cannot reach (0,1)(0, 1) in one step. So robot 0 is in the dead end at time 2. Robot 1 is at (0,2)(0, 2) at time 2, so robot 0 is at (0,3)(0, 3). Between times 2 and 3 robot 1 moves into (0,3)(0, 3) and stays, so robot 0 must leave (0,3)(0, 3), and its only free neighbor is (0,2)(0, 2), which is a swap with robot 1. So there is no plan for robot 0.

A plan exists. At time 1 robot 0 moves to (0,1)(0, 1) and robot 1 waits. At time 2 robot 0 moves down to (1,1)(1, 1) and robot 1 follows into (0,1)(0, 1). At time 3 robot 1 moves to (0,2)(0, 2) and robot 0 moves back to (0,1)(0, 1). At time 4 robot 1 reaches (0,3)(0, 3). There is no vertex conflict and no swap, and the makespan is 4. □\square

The test test_every_order_has_no_plan_but_a_plan_exists checks both orders and finds the makespan 4 with a breadth-first search over the joint states of both robots. The search over joint states is complete, which is the difference described on the coupled and decoupled planning page.

Running time. With gg free cells and horizon HH, one search visits at most g(H+1)g (H + 1) states with at most 5 moves each, so it costs O(gHlog⁡(gH))O(g H \log(g H)) with a binary heap, and the whole method costs O(rgHlog⁡(gH))O(r g H \log(g H)) for rr robots. The reservation table holds one entry per step of every plan, O(rH)O(r H) entries. The default horizon in the code is H=g(r+1)H = g (r + 1), which is a design choice and not a bound from the paper.

Complexity

  • Time (theorem). One space-time search visits at most g(H+1)g (H + 1) states with 5 moves each, so it costs O(gHlog⁡(gH))O(g H \log(g H)) with a binary heap. The whole method costs O(rgHlog⁡(gH))O(r g H \log(g H)) in the word RAM model.
  • Memory. The reservation table holds one entry per step of every plan, O(rH)O(r H), and one search holds O(gH)O(g H) states.
  • Messages. If the robots plan in turn, each one broadcasts one plan of O(H)O(H) cells, rr messages in rr sequential rounds.
  • Compared with coupled search. A search of the joint space has up to grg^r states per time step, which is the price of completeness.

Properties

  • Sound (theorem). Returned plans never collide.
  • Incomplete (theorem). It can fail when a plan exists, for every order.
  • Not optimal for the team. Each robot is optimal given the robots before it, but the makespan or the sum of path lengths can be far from the best.
  • Order dependent. The pocket example succeeds in one order and fails in the other.
  • Scales well (measurement). In the tests, with 2 or 3 robots on random grids of up to 3 by 4 cells, it solved more than 50 of 250 instances and failed on some that the joint search solved; it never returned a conflicting plan.

Variants and improvements

  • Cooperative A.* Silver (2005) reserved space-time cells in a shared table for game characters, which is this method with a window of limited length.
  • Choosing the order. Heuristics give priority to the robot with the longest path, or to robots whose start or goal blocks others. Searching over orders, or restarting with a random order after a failure, solves more instances (heuristic).
  • Priority-based search. Later work searches over pairwise priorities instead of a fixed order, which is still incomplete but solves more instances.
  • Path coordination. Another decoupled method fixes the paths and plans only the timing along them, in a coordination space of dimension rr.
  • Continuous spaces. The same idea works with sampling planners such as probabilistic roadmaps, where each robot plans in configuration space-time.

When to use it

Use prioritized planning when there are many robots, the space is not crowded, and a quick plan matters more than a guarantee: warehouses with wide aisles, or game characters. Use conflict-based search or a coupled planner when the space has narrow passages, when optimal plans are needed, or when a failure is not acceptable.

Pitfalls

  • Parking robots. A robot that has arrived blocks its goal for ever. If its goal lies on the path of a later robot, the later robot fails, as in the siding example. Give such robots a lower priority, or let them move away.
  • Horizon too short. A robot may need to wait a long time for others. If HH is short, the search fails although a plan exists.
  • Swap conflicts. Checking only cells, and not moves, lets two robots pass through each other on an edge.
  • Goal test. The search must not stop at the goal at a time when an earlier robot will pass the goal later.
  • Treating failure as proof. "No plan found" does not mean that no plan exists.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

prioritized_multi_robot_planning.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/prioritized-multi-robot-planning/. The authors are listed in prov/9VT1PP.jsonl.

"""Prioritized multi-robot planning on a grid (Erdmann and Lozano-Perez 1987).

The grid is a list of strings; '#' is an obstacle and any other character is a
free cell. Cells are (row, col). Time is discrete: in each step a robot moves to
one of the 4 neighbor cells or waits. Two robots must never be in the same cell
at the same time (vertex conflict) and must never swap cells in one step (edge
conflict). A robot that reaches its goal stays there for ever.

The robots are planned one at a time in priority order. Robot i runs a
space-time A* search that treats the plans of robots planned before it as moving
obstacles. The method is not complete: it can report no plan for an instance
that has one.
"""

import heapq
from typing import Optional, Sequence

Cell = tuple
MOVES = ((0, 0), (-1, 0), (1, 0), (0, -1), (0, 1))


def free_cells(grid: Sequence[str]) -> list:
    return [(r, c) for r, row in enumerate(grid) for c, ch in enumerate(row) if ch != "#"]


def neighbors(grid: Sequence[str], cell: Cell) -> list:
    """The cells a robot can be in after one step: wait, or move by one cell."""
    out = []
    for dr, dc in MOVES:
        r, c = cell[0] + dr, cell[1] + dc
        if 0 <= r < len(grid) and 0 <= c < len(grid[r]) and grid[r][c] != "#":
            out.append((r, c))
    return out


class Reservations:
    """The space-time cells and moves used by the robots planned so far."""

    def __init__(self):
        self.vertex = {}  # (cell, t) -> robot
        self.moves = set()  # (from cell, to cell, t): a move from time t to t + 1
        self.parked = {}  # cell -> first time from which a robot stays there
        self.last_use = {}  # cell -> last time t with a vertex reservation

    def add(self, path: list) -> None:
        for t, cell in enumerate(path):
            self.vertex[(cell, t)] = True
            self.last_use[cell] = max(self.last_use.get(cell, -1), t)
            if t > 0:
                self.moves.add((path[t - 1], cell, t - 1))
        self.parked[path[-1]] = len(path) - 1

    def blocked(self, cell: Cell, t: int) -> bool:
        if (cell, t) in self.vertex:
            return True
        p = self.parked.get(cell)
        return p is not None and t >= p

    def swap(self, a: Cell, b: Cell, t: int) -> bool:
        """True if an earlier robot moves from b to a while we move from a to b."""
        return (b, a, t) in self.moves

    def free_after(self, cell: Cell, t: int) -> bool:
        """True if no earlier robot uses the cell at time t or later."""
        if cell in self.parked:
            return False
        return self.last_use.get(cell, -1) < t


def space_time_astar(grid, start, goal, res: Reservations, horizon: int) -> Optional[list]:
    """Shortest path in (cell, time) that avoids the reservations, or None."""
    if res.blocked(start, 0):
        return None

    def h(cell):
        return abs(cell[0] - goal[0]) + abs(cell[1] - goal[1])

    heap = [(h(start), 0, start)]
    parent = {(start, 0): None}
    while heap:
        f, t, cell = heapq.heappop(heap)
        if cell == goal and res.free_after(goal, t):
            path = []
            node = (cell, t)
            while node is not None:
                path.append(node[0])
                node = parent[node]
            return path[::-1]
        if t >= horizon:
            continue
        for nxt in neighbors(grid, cell):
            state = (nxt, t + 1)
            if state in parent or res.blocked(nxt, t + 1) or res.swap(cell, nxt, t):
                continue
            parent[state] = (cell, t)
            heapq.heappush(heap, (t + 1 + h(nxt), t + 1, nxt))
    return None


def prioritized_planning(
    grid: Sequence[str],
    starts: Sequence[Cell],
    goals: Sequence[Cell],
    order: Optional[Sequence[int]] = None,
    horizon: Optional[int] = None,
) -> Optional[list]:
    """Plan the robots in the given priority order.

    Returns one path per robot (path[t] is the cell at time t, and the robot
    stays at path[-1] afterwards), or None if some robot finds no path.
    """
    r = len(starts)
    order = list(range(r)) if order is None else list(order)
    if horizon is None:
        horizon = len(free_cells(grid)) * (r + 1)
    res = Reservations()  # @line L1
    paths = [None] * r
    for i in order:  # @line L2
        path = space_time_astar(grid, starts[i], goals[i], res, horizon)  # @line L3
        if path is None:  # @line L4
            return None
        res.add(path)  # @line L5
        paths[i] = path
    return paths  # @line L6


def position(path: list, t: int) -> Cell:
    return path[t] if t < len(path) else path[-1]


def check_plan(grid, starts, goals, paths) -> bool:
    """True if the paths are valid: moves to free neighbor cells, no conflicts."""
    r = len(paths)
    for i in range(r):
        if paths[i][0] != starts[i] or paths[i][-1] != goals[i]:
            return False
        for t in range(1, len(paths[i])):
            if paths[i][t] not in neighbors(grid, paths[i][t - 1]):
                return False
    end = max(len(p) for p in paths)
    for t in range(end):
        cells = [position(p, t) for p in paths]
        if len(set(cells)) < r:
            return False
        for i in range(r):
            for k in range(i + 1, r):
                if position(paths[i], t + 1) == position(paths[k], t) and position(paths[k], t + 1) == position(paths[i], t) and position(paths[i], t) != position(paths[i], t + 1):
                    return False
    return True
test_prioritized_multi_robot_planning.py 121 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/prioritized-multi-robot-planning/. The authors are listed in prov/9VT1PP.jsonl.

import itertools
import random
from collections import deque

from prioritized_multi_robot_planning import (
    check_plan,
    free_cells,
    neighbors,
    prioritized_planning,
)


def coupled_makespan(grid, starts, goals):
    """Brute force: BFS over the joint states of all robots (complete and optimal)."""
    starts, goals = tuple(starts), tuple(goals)
    dist = {starts: 0}
    queue = deque([starts])
    while queue:
        state = queue.popleft()
        if state == goals:
            return dist[state]
        for nxt in itertools.product(*[neighbors(grid, c) for c in state]):
            if len(set(nxt)) < len(nxt):
                continue
            swap = any(
                nxt[i] == state[k] and nxt[k] == state[i] and nxt[i] != state[i]
                for i in range(len(state))
                for k in range(i + 1, len(state))
            )
            if not swap and nxt not in dist:
                dist[nxt] = dist[state] + 1
                queue.append(nxt)
    return None


def bfs_length(grid, start, goal):
    dist = {start: 0}
    queue = deque([start])
    while queue:
        cell = queue.popleft()
        for nxt in neighbors(grid, cell):
            if nxt not in dist:
                dist[nxt] = dist[cell] + 1
                queue.append(nxt)
    return dist.get(goal)


POCKET = ["#.##", "...."]
POCKET_STARTS = [(1, 0), (1, 3)]
POCKET_GOALS = [(1, 3), (1, 0)]

SIDING = ["....", "..##"]
SIDING_STARTS = [(0, 2), (0, 0)]
SIDING_GOALS = [(0, 1), (0, 3)]


def test_order_matters_in_the_pocket():
    assert prioritized_planning(POCKET, POCKET_STARTS, POCKET_GOALS, [0, 1]) is None
    paths = prioritized_planning(POCKET, POCKET_STARTS, POCKET_GOALS, [1, 0])
    assert paths is not None
    assert check_plan(POCKET, POCKET_STARTS, POCKET_GOALS, paths)
    assert paths[1] == [(1, 3), (1, 2), (1, 1), (1, 0)]
    assert paths[0] == [(1, 0), (1, 1), (0, 1), (1, 1), (1, 2), (1, 3)]
    assert coupled_makespan(POCKET, POCKET_STARTS, POCKET_GOALS) == 5


def test_every_order_has_no_plan_but_a_plan_exists():
    for order in ([0, 1], [1, 0]):
        assert prioritized_planning(SIDING, SIDING_STARTS, SIDING_GOALS, order) is None
    assert coupled_makespan(SIDING, SIDING_STARTS, SIDING_GOALS) == 4


def test_one_robot_is_a_shortest_path():
    rng = random.Random(8)
    for _ in range(100):
        rows, cols = rng.randint(1, 6), rng.randint(1, 6)
        grid = ["".join("#" if rng.random() < 0.25 else "." for _ in range(cols)) for _ in range(rows)]
        cells = free_cells(grid)
        if len(cells) < 2:
            continue
        s, g = rng.sample(cells, 2)
        paths = prioritized_planning(grid, [s], [g])
        length = bfs_length(grid, s, g)
        if length is None:
            assert paths is None
        else:
            assert len(paths[0]) - 1 == length


def test_against_coupled_search():
    rng = random.Random(21)
    solved = unsolved = 0
    for _ in range(250):
        rows, cols = rng.randint(1, 3), rng.randint(2, 4)
        grid = ["".join("#" if rng.random() < 0.25 else "." for _ in range(cols)) for _ in range(rows)]
        cells = free_cells(grid)
        r = rng.randint(2, 3)
        if len(cells) < 2 * r:
            continue
        pick = rng.sample(cells, 2 * r)
        starts, goals = pick[:r], pick[r:]
        best = coupled_makespan(grid, starts, goals)
        paths = prioritized_planning(grid, starts, goals)
        if paths is None:
            unsolved += 1
            continue
        solved += 1
        assert check_plan(grid, starts, goals, paths)
        assert best is not None
        assert max(len(p) for p in paths) - 1 >= best
    assert solved > 50 and unsolved > 0


def test_conflict_checker_rejects_swaps_and_collisions():
    grid = ["..."]
    starts, goals = [(0, 0), (0, 1)], [(0, 1), (0, 0)]
    assert not check_plan(grid, starts, goals, [[(0, 0), (0, 1)], [(0, 1), (0, 0)]])
    assert not check_plan(grid, [(0, 0), (0, 2)], [(0, 1), (0, 1)], [[(0, 0), (0, 1)], [(0, 2), (0, 1)]])

History

Erdmann and Lozano-Pérez (1987) studied several objects moving in the same space. They gave the objects priorities and planned each object in configuration space-time among the objects with higher priority, which is the prioritized method. LaValle's book (2006) presents it as a decoupled method next to path coordination. Silver (2005) used reservation tables for cooperative pathfinding in games, and the method is now a standard baseline for multi-agent pathfinding.

References

  1. Michael Erdmann and Tomas Lozano-Perez, On multiple moving objects, Algorithmica 2, 1987, pages 477 to 521 (priorities, configuration space-time and planning among moving obstacles)
  2. Steven M. LaValle, Planning Algorithms, Cambridge University Press, 2006, Chapter 7, the section on multiple robots (decoupled planning and prioritized planning)
  3. Bruno Siciliano and Oussama Khatib (editors), Springer Handbook of Robotics, 2nd edition, Springer, 2016, the chapter on multiple mobile robot systems (path coordination and priorities)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.total
  • a full proof of space.extra
  • a full proof of messages.total
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example