Introduction
Generalized Planning (GP) represents a significant leap from classical planning. While classical planning seeks a specific sequence of actions for a single problem instance, GP aims to synthesize a single algorithm-like solution—a "generalized plan"—capable of solving an entire class of problems. This paper introduces the first native heuristic search approach for GP, representing solutions as planning programs and navigating the search space using the novel BFGP algorithm.
The Challenge of Generalized Planning
In classical planning, an AI finds a path from a specific initial state to a goal state. However, such plans are brittle; they fail if the number of objects changes or the environment is slightly altered. GP seeks a more robust solution, such as a program that can sort any list regardless of its length or content.
The primary difficulty lies in the search space. Standard planning techniques often rely on "grounding," which pre-calculates all possible states. This is infeasible for infinite domains or variables like integers. Furthermore, the space of possible programs is combinatorial and lacks the intuitive "distance-to-goal" metrics that guide classical heuristic search.
Methodology: RAM Extension and the BFGP Algorithm
The authors bridge the gap between planning and program synthesis through two key innovations:
1. The RAM Extension
To handle an unbounded number of objects without grounding, the authors augment classical planning with a Random-Access Machine (RAM) model. This model introduces pointers to index objects dynamically, FLAGS to store comparison results (e.g., Zero, Carry), and primitive operations like increment and decrement. This abstraction allows a "swap" operation on two pointers to function correctly whether a list contains five elements or five thousand.
2. The BFGP Algorithm
The Best-First Generalized Planning (BFGP) algorithm is designed specifically for the space of planning programs. It treats a program as a sequence of instructions (actions, gotos, or terminations).
- Successor Generation via $PC^{MAX}$: A critical optimization is the use of $PC^{MAX}$. Instead of exploring every possible instruction for every line, the algorithm only "programs" the line corresponding to the maximum program counter reached during the execution of current test instances. This drastically prunes the search space.
- Heuristic Guidance: The search is guided by structural heuristics (penalizing undefined lines or excessive gotos) and performance-based heuristics (measuring Euclidean distance to the goal state across all instances).
Experimental Evaluation
The approach was evaluated across eight diverse domains, including algorithmic tasks (T. Sum, Fibonacci, Sorting, Reverse) and navigation/manipulation tasks (Corridor, Select, Find, Gripper).
The results demonstrate that the BFGP algorithm successfully synthesized programs for all eight domains. Notably, it solved complex tasks like Sorting and Fibonacci, which are traditionally challenging for automated planners. The $f_2$ (undefined lines) and $h_5$ (goal distance) heuristics proved particularly effective, enabling the system to find solutions in seconds or minutes that would otherwise time out.
Key Insights and Conclusion
The success of BFGP stems from the synergy between structural and performance heuristics. While performance heuristics drive the program toward the goal, structural heuristics keep the program "clean," preventing the search from getting lost in overly complex code. Furthermore, the programs synthesized on small instances were validated to work on much larger instances, confirming the "generalized" nature of the solutions. Future work will focus on detecting infinite loops more efficiently and expanding the expressivity of conditional logic within the programs.
Summary updated