Algorithm Search⌘K

Problemadvanced

Pebble motion on graphs

Also called Kornhauser-Miller-Spirakis problem.

Move pebbles on distinct vertices of a graph to target vertices one step at a time; feasibility is decidable in polynomial time.

Pebble motion on graphs asks whether labeled pebbles, one per vertex at most, can be moved from given start vertices to given goal vertices when a move slides one pebble along an edge into an empty vertex. It is the discrete core of multi-robot path planning: the sliding tile puzzle is the case of a grid with one empty vertex. Unlike multi-agent pathfinding, where many robots move at once and the plan should be short, pebble motion moves one pebble at a time and asks first whether a plan exists; Kornhauser, Miller and Spirakis (1984) showed that this is decidable in polynomial time, while finding a shortest plan is NP-hard.

In plain words

Think of a train yard drawn as dots and lines. Some dots hold a numbered wagon, and the others are empty. In one move you push one wagon along a line onto an empty dot. You want each wagon to end on its own dot.

Sometimes this is impossible: on a single straight track two wagons can never pass each other. With a side track they can. The question is which yards and which wagon orders allow a solution, and how many moves it takes. The answer can be found quickly, and when a solution exists, the number of moves is never more than about the cube of the number of dots.

Definition

Let G=(V,E)G = (V, E) be a connected undirected graph with nn vertices, and let there be k<nk < n pebbles with distinct labels. A placement puts the pebbles on distinct vertices. A move takes a pebble on vertex uu to an adjacent empty vertex vv. Given a start placement SS and a goal placement TT:

  • Feasibility. Is there a sequence of moves from SS to TT?
  • Plan. If yes, output such a sequence.
  • Shortest plan. Output a sequence with the fewest moves.

Each pebble stands for a robot, each vertex for a place a robot can be, and each edge for a short motion. Moves are sequential: one robot moves at a time.

Variants

  • One empty vertex (k=n−1k = n - 1). The setting of Wilson (1974) and of the sliding tile puzzle.
  • Trees. The graph is a tree; feasibility has a special linear-time algorithm.
  • Unlabeled pebbles. Pebbles are interchangeable, so only the set of goal vertices matters. This is much easier.
  • Colored pebbles. Pebbles of the same color are interchangeable; Goraly and Hassin (2010) studied feasibility in this setting.
  • Parallel moves. Several pebbles move in the same step, and pebbles may follow each other along a path or rotate along a cycle. This is the model of multi-agent pathfinding, where the goal is usually the smallest makespan or the smallest total path length.
  • Robots with obstacles. Some vertices hold fixed obstacles, which is the same as deleting them from the graph.

Examples

A path. On a path of 3 vertices with pebbles aa at one end and bb in the middle, and the goal with aa and bb swapped, there is no plan: pebbles on a path keep their order.

A star. On a star with a center cc and leaves 1,2,31, 2, 3, put aa on leaf 1 and bb on leaf 2, and ask to swap them. A plan with 6 moves: aa from 1 to cc to 3, then bb from 2 to cc to 1, then aa from 3 to cc to 2. The third leaf is the side track.

A cycle. On a cycle with one empty vertex, a pebble can only follow the others around, so the reachable placements are the rotations of the start, and two pebbles cannot be swapped.

The 15-puzzle. On the 4×44 \times 4 grid with 15 pebbles, Wilson's theorem and the parity argument of the sliding puzzle solvability page say that exactly half of the placements with the empty vertex in a fixed corner can be reached.

Known algorithms

  • Kornhauser, Miller and Spirakis (1984). Decides feasibility in polynomial time and builds a plan with O(n3)O(n^3) moves when one exists, for any connected graph and any k<nk < n (theorem).
  • Wilson (1974). For one empty vertex on a 2-connected graph, gives the group of reachable permutations: all of them if the graph is not bipartite and not a cycle, the even ones if it is bipartite and not a cycle, the rotations on a cycle, with one exception, a special graph on 7 vertices (theorem).
  • Auletta, Monti, Parente and Persiano (1999). Feasibility on trees in linear time (theorem).
  • Linear-time feasibility on general graphs. Yu (2013, arXiv 1301.2342) gives a linear-time feasibility test for general graphs; the result is a preprint and is cited here as claimed.
  • Search. For shortest plans on small instances, A* over placements, or conflict-based search in the parallel model.

Bounds

  • Moves (theorem). O(n3)O(n^3) moves always suffice when a plan exists, and some instances need Ω(n3)\Omega(n^3) moves, so the bound is tight (Kornhauser, Miller and Spirakis 1984).
  • Feasibility (theorem). Polynomial time, and linear time on trees.
  • Shortest plans (theorem). Finding a shortest plan is NP-hard already for the (n2−1)(n^2 - 1)-puzzle on grids (Ratner and Warmuth 1990).
  • Parallel optimal plans (theorem). In the parallel model, minimizing the makespan or the total distance is NP-hard, as Yu and LaValle (2013) showed.
  • Continuous versions. Moving many rectangles in a box is PSPACE-hard (Hopcroft, Schwartz and Sharir 1984), so the graph abstraction hides hard geometry.

Reductions

  • The sliding tile puzzle is pebble motion on a grid graph with k=n−1k = n - 1.
  • Multi-agent pathfinding on a graph with sequential moves is pebble motion; with parallel moves it is a relaxation that allows more plans, such as rotations along a full cycle.
  • Pebble motion with one empty vertex reduces to the study of a permutation group generated by the moves around cycles of the graph, which links feasibility to permutation parity. Wilson's paper (Journal of Combinatorial Theory, Series B 16(1), 1974, pages 86 to 96) is the source of this view.

Applications

Pebble motion models warehouse robots on a grid of storage cells, trains in a yard with sidings, data packets in buffers with limited space, and automated parking systems. It gives the existence test that a complete multi-robot planner on a graph needs, and the O(n3)O(n^3) bound tells how long a feasible plan can be in the worst case.

References

  1. Daniel Kornhauser, Gary Miller and Paul Spirakis, Coordinating pebble motion on graphs, the diameter of permutation groups, and applications, 25th Annual Symposium on Foundations of Computer Science (FOCS), 1984, pages 241 to 250 (polynomial-time feasibility, the O(n^3) bound on moves and its tightness)
  2. Vincenzo Auletta, Angelo Monti, Mimmo Parente and Pino Persiano, A linear-time algorithm for the feasibility of pebble motion on trees, Algorithmica 23(3), 1999, pages 223 to 245 (feasibility on trees in linear time)
  3. Daniel Ratner and Manfred Warmuth, The (n^2 - 1)-puzzle and related relocation problems, Journal of Symbolic Computation 10(2), 1990, pages 111 to 137 (finding a shortest solution is NP-hard)

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 proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a known algorithm
  • a contract.yaml