Planning Heuristics and GraphPlan
Every relaxation heuristic can be inaccurate, and none can tell how far apart subgoals sit. The planning graph is a polynomial-size structure that does better: leveled off the problem, it yields admissible distance estimates and a record of which actions and fluents cannot coexist.
╌╌╌╌
This builds on Classical Planning, which set up the PDDL representation, forward and backward search, and the relaxation heuristics that ignore preconditions or delete lists. Here we build the data structure that sharpens those heuristics and can be searched for a plan directly.
The planning graph and GraphPlan
Every heuristic so far can be inaccurate. A planning graph is a data structure that gives better estimates, and can also be searched directly for a plan by the GraphPlan algorithm. It is a polynomial-size approximation to the exponential tree of all possible action sequences: it cannot say for certain whether the goal is reachable, but it estimates how many steps it takes, and it never overestimates — so the estimate is admissible.1
A planning graph is a directed graph of alternating levels: a state level for the initial state, an action level of every action that might apply in , then , , and so on. Roughly, holds every literal that could hold at time , and every action that could have its preconditions met at time . Planning graphs work only for propositional (variable-free) problems, so the schemas are propositionalized first.
Two devices make the levels work. A persistence action (or no-op), drawn as a small square, carries every literal forward unchanged — for each literal we add an action with precondition and effect , so a literal can persist if no action negates it. And mutex (mutual-exclusion) links, drawn as curved lines, record pairs that cannot co-occur. Constructing the graph never requires choosing among actions — it just records which choices are impossible — so it stays polynomial.
The graph is built until it levels off — two consecutive levels are identical. For a problem with literals and actions each has at most nodes and at most (counting no-ops), so a graph of levels has size , and building it takes the same time.
Expanding the graph, level by level
Work through the have cake and eat cake too
problem in full. Two fluents are in
play, and , and there are two real actions:
The initial state is , and the goal is — have your cake and have eaten it too. Build the graph:
- holds the two initial literals: and .
- holds every action whose preconditions are present and non-mutex in . qualifies (its precondition is in ); does not, since its precondition is absent. Two persistence actions also appear, one for each literal.
- holds every literal any action can produce. adds and ; the persistence actions carry and forward. So — all four literals now appear.
- adds , whose precondition is now present, alongside and the four persistence actions.
- again holds all four literals. Because carries the same literals as with the same mutex structure, the graph has leveled off after .
The mutexes are what make the graph accurate, and each of the five rules can be shown firing on this small instance.
Reading the five rules off this graph:
- Inconsistent effects. has effect ; the -persistence no-op has effect . One negates the other, so the two actions are mutex in .
- Interference. deletes , which is the precondition of the
-persistence no-op. An effect of one negates a precondition of the other, so
they are mutex (the pair marked
interfere
above). - Competing needs. In a later level, needs while needs ; those preconditions are themselves a mutex literal pair, so the two actions are mutex by competing needs.
- Negation (literals). In , and are trivially mutex — one is the negation of the other.
- Inconsistent support (literals). In , and are mutex: the only way to have at this level is , whose companion effect is , and the only way to keep is the no-op, which is mutex with by interference. Every pair of producers conflicts, so the literals are mutex. This is why the goal cannot be read as achieved at — the search must expand to , where has broken the support conflict and the pair is no longer mutex.
Heuristics from the planning graph
Once built, the graph supplies several estimates. If any goal literal never appears in the graph, the problem is unsolvable. Otherwise the level cost of a goal literal — the first level at which it appears — estimates the cost of achieving it. Because a level may host several actions at once, a serial planning graph (one that adds mutexes between every pair of non-persistence actions, forcing one real action per level) gives level costs closer to the true action count.
To estimate the cost of a conjunction of goals, three heuristics build on level costs. Max-level takes the maximum level cost over the goals: admissible, but often loose. Level-sum adds the level costs (the subgoal-independence assumption): inadmissible in general but accurate for largely decomposable problems. Set-level finds the first level at which all goal literals appear with no pair mutex: admissible, dominates max-level, and works very well when subgoals interact, because the mutexes capture the interaction the other two ignore.
Serial versus parallel graphs, and a worked level cost
A plain planning graph is parallel: level may hold several non-mutex actions at once, and a level index counts rounds of simultaneous action, not individual steps. A serial planning graph adds a mutex between every pair of real (non-persistence) actions in a level, so at most one real action can be chosen per level. A serial graph therefore counts steps the way a totally ordered plan does, and its level costs track the true plan length more closely, at the price of more levels and a larger graph.
The difference shows up numerically on the cake problem. Take the two goal literals and read their level costs off the parallel graph built above:
- appears already at , so its level cost is .
- first appears at (produced by in ), so its level cost is .
Now compute the three conjunction heuristics for the goal :
Max-level says : at least one action is needed, which is true but weak — one action cannot achieve the goal, because makes true only by making false. Level-sum says , treating the two subgoals as independent. Set-level looks for the first level where both literals appear and are non-mutex; at they are mutex by inconsistent support, so set-level must go to , giving . The true optimal plan is of length , so here set-level is exact while max-level underestimates. Set-level's extra accuracy comes entirely from consulting the mutex that max-level and level-sum discard.
The GraphPlan algorithm
GraphPlan extracts a plan directly from the graph rather than merely reading a heuristic off it. It alternates two operations. adds one level. When all goals appear non-mutex in the current state level, searches backward through the graph for a conflict-free plan; if that fails, GraphPlan expands another level and tries again.
- 1
- 2
- 3an empty hash table
- 4for to do
- 5if all non-mutex in of then
- 6
- 7if then
- 8return
- 9if and have both leveled off then
- 10return
- 11
can be cast as a Boolean CSP (variables are actions at
each level, values are in or out of the plan, constraints are the mutexes and
goals) or, equivalently, as a backward search: start at the last level with the
problem's goals, and at each state pick a conflict-free subset of the previous
action level whose effects cover the current goals, taking the selected actions'
preconditions as the next set of goals. Conflict-free
means no two chosen actions
are mutex and no two of their preconditions are mutex. The search succeeds when it
reaches with all goals satisfied. When it fails for a set of goals at a level,
that pair is recorded as a no-good and reused, both to prune and
in the termination test.
Extracting the cake plan
Follow on the cake graph, which has leveled off with a solution appearing at . The goal set is , both non-mutex at , so extraction begins there and works backward.
At , cover with from and cover with the -persistence no-op. These two are conflict-free, so their preconditions become the goals at : needs and the no-op needs . At , both are covered by choosing in (it produces and together), whose single precondition is the goal — and holds in . Extraction reaches with all goals met, so it succeeds. Reading the chosen real actions from forward gives the plan . Had a level's goal set failed to extract, that pair would be cached as a no-good so no later search revisits it.
GraphPlan is guaranteed to terminate. Literals and actions increase monotonically (persistence actions keep literals around; an action reappears once its preconditions do), while mutexes and no-goods decrease monotonically. Since neither count can pass its finite bound or drop below zero, the graph and its no-goods must both level off; once they have, if a goal is still missing or mutex with another, GraphPlan can stop and return failure — no later level could add a solution.
Other approaches
Three families dominate fully automated classical planning today: forward search with strong heuristics (above), search over a planning graph (GraphPlan and its descendants), and translation to Boolean satisfiability. The last, and two logic-flavored alternatives, are covered below.
SATPlan. Planning as satisfiability translates a PDDL problem into a propositional formula that a SAT solver decides, following the same encoding as propositional logic inference. Propositionalize the actions, assert for each initial-state fluent and for the rest, expand the goal into a disjunction over constants, and add three families of axioms: successor-state axioms tying each fluent to the actions that make it true or false, precondition axioms , and action-exclusion axioms making every action distinct. The result is handed to a SAT solver, which searches for a satisfying assignment — a plan — up to a bounded horizon.
For example, instantiate the successor-state schema for the fluent in the cake problem. Only makes it true and only makes it false, so at time the axiom reads
holds at exactly when was applied at , or it held at and was not applied to remove it. This single biconditional encodes both the effect (the disjunct) and the frame axiom (the persistence disjunct) for that fluent in one line, which is why the encoding grows only linearly in fluents times horizon rather than quadratically. The companion precondition axiom forbids eating a cake that is not there, and an action-exclusion axiom forbids doing both at once. With a horizon of two steps the solver finds a satisfying assignment that sets and true and the rest false — the same two-step plan the planning graph extracted.
Constraint satisfaction. A bounded planning problem encodes naturally as a CSP, much like the SAT encoding but with a single variable per time step whose domain is the set of possible actions — no per-action variables, no exclusion axioms. Planning graphs themselves can be compiled into a CSP.
Partial-order planning. Every approach so far produces a totally ordered plan: a strict linear sequence. That over-commits — loading 30 packages onto one plane and 50 onto another are independent, yet a total order arbitrarily interleaves them. A partial-order plan is instead a set of actions plus ordering constraints , imposed only where genuinely required.
Partial-order plans are built by searching the space of plans rather than the space of states: begin with the empty plan (just Start and Finish), find a flaw (an unachieved precondition), and fix it by adding an action or an ordering constraint, always making the least commitment that resolves the flaw and no more. Through the 1980s and 90s this was the leading way to handle independent subproblems, because it represents branches of a plan explicitly. By 2000 forward-search planners had developed heuristics good enough to find those independent subproblems on their own, so partial-order planning is no longer competitive on general classical problems — but it remains the technology of choice for tasks like operations scheduling, and for domains where a human must read and verify the plan, such as spacecraft operations.
PDDL and modern planning heuristics
The relaxations in this lesson started a line of research that turned domain-independent planning into a competitive field with a common benchmark and steadily better heuristics.
A shared language came first. McDermott and colleagues introduced PDDL, the Planning Domain Definition Language, in 1998 as the input format for the first International Planning Competition (IPC), held at the AIPS conference.2 A common syntax meant planners could be run head to head on the same domains, and the competition has recurred since, driving successive extensions of the language for numeric fluents, durative actions, and preferences.
Then came sharper heuristics built on the relaxations here. Bonet and Geffner cast planning as heuristic search and defined the additive and max heuristics and from the delete relaxation, estimating a conjunction's cost by summing or maximizing over the subgoals' relaxed costs.3 In the same period, Hoffmann and Nebel's FF (FastForward) planner extracted a relaxed plan from a delete-relaxed planning graph and used its length as the heuristic, paired with an enforced-hill-climbing search; FF won the 2000 IPC and its relaxed-plan heuristic became a standard baseline.4
Hoffmann, Porteous, and Sebastia formalized a complementary signal, landmarks —
facts that must hold at some point in every plan — and showed how to
extract them and order them, turning which subgoals are unavoidable
into a
heuristic.5 Richter and Westphal combined a landmark-count heuristic with
FF's relaxed-plan heuristic in the LAMA planner, which won the sequential
satisficing track of the 2008 IPC.6 The connection to AIMA's chapter is
direct: every one of these systems reads its heuristic off a mechanically relaxed
version of the schemas, exactly as this lesson develops.
The takeaway
Classical planning makes a single trade. By committing to a factored representation — states as sets of fluents, actions as schemas that name only what changes — it gives up the opacity of atomic search states, and in return a program gains the ability to read the problem's structure. That structure lets forward search regress and lift, lets a relaxation drop a precondition or a delete list mechanically, and lets a planning graph bound the distance to the goal. The hand-built heuristics of informed search came one insight at a time; here, the same accuracy is derived automatically, because the representation itself is something the planner can inspect.
Footnotes
- AIMA, §10.3 — Planning Graphs: leveled literal/action structure, persistence actions, the three action-mutex and two literal-mutex conditions, level-cost / max-level / level-sum / set-level heuristics, and the GraphPlan expand-extract loop with its monotonic termination argument. ↩
- McDermott, D., Ghallab, M., Howe, A., Knoblock, C., Ram, A., Veloso, M., Weld, D., and Wilkins, D. (1998). PDDL — The Planning Domain Definition Language. Technical Report, AIPS-98 Planning Competition Committee. Defined the shared input language for the first International Planning Competition. ↩
- Bonet, B. and Geffner, H. (2001). Planning as heuristic search. Artificial Intelligence, 129(1–2), 5–33. Introduced the and delete-relaxation heuristics and the HSP planners. ↩
- Hoffmann, J. and Nebel, B. (2001). The FF planning system: fast plan generation through heuristic search. Journal of Artificial Intelligence Research, 14, 253–302. The FF planner, its relaxed-plan heuristic from a delete-relaxed planning graph, and enforced hill-climbing. ↩
- Hoffmann, J., Porteous, J., and Sebastia, L. (2004). Ordered landmarks in planning. Journal of Artificial Intelligence Research, 22, 215–278. Formalized landmarks and their orderings and used them as a source of heuristic guidance. ↩
- Richter, S. and Westphal, M. (2010). The LAMA planner: guiding cost-based anytime planning with landmarks. Journal of Artificial Intelligence Research, 39, 127–177. The LAMA planner, combining a landmark-count heuristic with the FF heuristic; winner of the sequential satisficing track of IPC 2008. ↩
╌╌ END ╌╌