The Role of Macros in Tractable Planning

Anders Jonsson · DOI

Abstract

This paper presents several new tractability results for planning based on macros. We describe an algorithm that optimally solves planning problems in a class that we call inverted tree reducible, and is provably tractable for several subclasses of this class. By using macros to store partial plans that recur frequently in the solution, the algorithm is polynomial in time and space even for exponentially long plans. We generalize the inverted tree reducible class in several ways and describe modifications of the algorithm to deal with these new classes. Theoretical results are validated in experiments.

Introduction

Automated planning is a fundamental challenge in artificial intelligence, typically classified as PSPACE-complete. Most interesting planning problems are computationally "hard," requiring impractical amounts of time as they scale. To overcome this, researchers seek "tractable" subclasses—islands of efficiency where problems can be solved in polynomial time.

A significant gap in existing research is the complexity of plan length; many tractable classes only function if the resulting plan is short. However, problems like the Tower of Hanoi have simple structures but require a massive number of steps. This paper introduces the MacroPlanner algorithm and the Inverted Tree Reducible (IR) class of problems, which leverage hierarchical macros to represent and generate plans of exponential length using only polynomial time and space.

The Inverted Tree Reducible (IR) Class

The IR class is defined by the structure of a problem's causal graph, which maps the dependencies between state variables. A problem belongs to the IR class if its causal graph, after undergoing transitive reduction, forms an inverted tree where each node has at most one outgoing edge.

Figure 1: Illustration of transitive reduction. The process removes redundant edges from the causal graph (left) to reveal the essential inverted tree structure (right).

Transitive reduction simplifies dependencies without losing reachability. This structural property allows for a recursive decomposition of the planning problem, which is the foundation of the MacroPlanner approach.

The MacroPlanner Algorithm

MacroPlanner operates by recursively solving subproblems for each variable in the reduced causal graph. Instead of generating a flat sequence of actions, it stores solutions as hierarchical macros. These macros can embed other macros, acting as a compression scheme that allows a plan with $2^n$ steps to be represented using only $O(n)$ space. This is the "secret sauce" that enables the algorithm to handle exponentially long plans efficiently.

Algorithm 1: The MacroPlanner procedure. It identifies the root variable of the reduced causal graph and recursively generates hierarchical macros to solve the planning problem.

The algorithm is provably optimal for the IR class and can be extended to handle more complex scenarios:

  • RIR (Root Inverted Tree Reducible): Accommodates actions that affect multiple variables.
  • AR (Acyclic Reversible): Handles "reversible" variables that can always be returned to their initial state, simplifying dependency constraints.
  • AOR (Acyclic Optional Reversible): A further generalization for complex subplan interleaving.

Experimental Evaluation

The theoretical efficiency of MacroPlanner was validated through several classic planning benchmarks:

  • Tower of Hanoi: The algorithm solved a 60-disc instance in just 701 milliseconds. The resulting plan, containing over $10^{18}$ steps, is represented compactly as a hierarchy of macros—a feat impossible for standard planners that would struggle even to store the plan.
  • Extended Gripper: In a maze-like environment with 967 rooms, MacroPlanner demonstrated the benefit of macro reuse. Once a navigation path was found and stored as a macro, it was applied instantly for subsequent tasks, significantly reducing computation time compared to standard search methods.
  • Logistics: The algorithm also showed strong performance on standard logistics benchmarks by effectively decomposing them into tractable sub-components.

Conclusion

MacroPlanner provides a powerful framework for solving planning problems with complex dependency structures. By leveraging hierarchical macros and the properties of the IR class, it achieves tractability for problems that were previously considered computationally prohibitive. These results offer a promising foundation for generating more accurate heuristics in general-purpose planners. Future work will focus on handling cyclic causal graphs and further optimizing subplan interleaving.

Summary updated

BibTeX
@article{jonsson2009role,
  author = {Anders Jonsson},
  title = {{The Role of Macros in Tractable Planning}},
  journal = {J. Artif. Intell. Res.},
  year = {2009},
  doi = {10.1613/jair.2891},
}
Figure