Graphplan
Graphplan
Alan Fern *
History
Before GraphPlan appeared in 1995, most planning researchers were
working under the framework of “plan-space search” (we will not cover
this topic)
GraphPlan outperformed those prior planners by orders of magnitude
GraphPlan started researchers thinking about fundamentally different
frameworks
2
Big Picture
A big source of inefficiency in search algorithms is the large
branching factor
GraphPlan reduces the branching factor by searching in a
special data structure
3
Layered Plans
Graphplan searches for layered plans (often called parallel plans)
?
A C B D
B D A C
A C B D
B D move(A,B,TABLE) B D A C move(B,TABLE,A) A C
move(C,D,TABLE) move(D,TABLE,C)
5
Planning Graph
A literal is just a positive or negative propositon
6
Planning Graph
state-level 0: state-level n: literals that action-level n: actions that
propositions true may possibly be true after may possibly be applicable
in s0 some n level plan after some n level plan
s0 sn an Sn+1
…
propositions
… …
…
… …
actions 7
Planning Graph
maintenance action (persistence actions)
represents what happens if no action affects the literal
include action with precondition c and effect c, for each literal c
…
propositions
… …
…
… …
actions 8
Graph expansion
Initial proposition layer
Just the propositions in the initial state
Action layer n
If all of an action’s preconditions are in proposition layer n,
then add action to layer n
Proposition layer n+1
For each action at layer n (including persistence actions)
Add all its effects (both positive and negative) at layer n+1
(Also allow propositions at layer n to persist to n+1)
Propagate mutex information
(we’ll talk about this in a moment)
9
Example
stack(A,B)
precondition: holding(A), clear(B)
effect: ~holding(A), ~clear(B), on(A,B), clear(B), handempty
s0 a0 s1
holding(A) holding(A)
~holding(A)
stack(A,B) handempty
~clear(B)
on(A,B)
clear(B) clear(B)
10
Example
stack(A,B)
precondition: holding(A), clear(B)
effect: ~holding(A), ~clear(B), on(A,B), clear(B), handempty
s0 a0 s1
holding(A) holding(A)
~holding(A)
stack(A,B) handempty
~clear(B)
on(A,B)
clear(B) clear(B)
Notice that not all literals in s1 can be made true simultaneously after 1 level:
e.g. holding(A), ~holding(A) and on(A,B), clear(B)
11
Mutual Exclusion (Mutex)
Mutex between pairs of actions at layer n means
no valid plan could contain both actions at layer n
E.g., stack(a,b), unstack(a,b)
12
Action Mutex: condition 1
Inconsistent effects
an effect of one negates an effect of the
other
13
Action Mutex: condition 2
Interference :
one deletes a precondition of the other
14
Action Mutex: condition 3
Competing needs:
they have mutually exclusive preconditions
Their preconditions can’t be true at the same
time
15
Literal Mutex: two conditions
Inconsistent support :
one is the negation of the other
E.g., handempty and ~handempty
16
Example – Dinner Date
17
Example – Plan Graph Construction
s0 a0
garbage
carry
cleanhands
dolly
quiet
cook
wrap
garbage garbage
carry ~garbage
cleanhands cleanhands
dolly ~cleanhands
quiet quiet
cook ~quiet
dinner
wrap
present
Add the literals that can be
achieved in first step
19
Example - continued
s0 a0 s1
Carry, dolly is mutex with maintenance actions
(inconsistent effects)
garbage garbage
carry ~garbage
cleanhands cleanhands
dolly ~cleanhands
quiet quiet
cook
~quiet
dinner
dolly is mutex with wrap wrap
Interference (about quiet) present
Cook is mutex with carry ~quiet is mutex with present,
about cleanhands ~cleanhands is mutex with dinner
inconsistent support
20
Do we have a solution?
The goal is: {dinner, present,~garbage}
All are possible in layer s1
None are mutex with each other
garbage garbage
carry ~garbage
cleanhands cleanhands
dolly ~cleanhands
quiet quiet
cook
~quiet
dinner
wrap
present
There is a chance that a plan exists
Now try to find it – solution extraction
21
Solution Extraction: Backward Search
Repeat until goal set is empty
If goals are present & non-mutex:
1) Choose set of non-mutex actions
to achieve each goal
2) Add preconditions to next goal set
22
Searching for a solution plan
Backward chain on the planning graph
23
Possible Solutions
• Two possible sets of actions for the goals at layer s1:
{wrap, cook, dolly} and {wrap, cook, carry}
• Neither set works -- both sets contain actions that are mutex
garbage garbage
carry ~garbage
cleanhands cleanhands
dolly ~cleanhands
quiet quiet
cook
~quiet
dinner
wrap
present
Add new layer…
Adding a layer provided new ways to achieve propositions
This may allow goals to be achieved with non-mutex actions
25
Do we have a solution?
Several action sets look OK at layer 2
Here’s one of them
We now need to satisfy their preconditions
26
Do we have a solution?
The action set {cook, quite} at layer 1 supports preconditions
Their preconditions are satisfied in initial state
So we have found a solution:
{cook} ; {carry, wrap}
27
Another solution:
{cook,wrap} ; {carry}
28
GraphPlan algorithm
Grow the planning graph (PG) to a level n such that all
goals are reachable and not mutex
necessary but insufficient condition for the existence of an n
level plan that achieves the goals
if PG levels off before non-mutex goals are achieved then fail
p p p p
A A A
¬q q q q
¬r ¬q ¬q ¬q
B B
¬r r r
¬r ¬r
30
Property 2
p p p p
A A A
¬q q q q
¬r ¬q ¬q ¬q
B B
¬r r r
¬r ¬r
31
Properties 3
p p p
q q q
A
r r r
… … …
A A A
p p p p
q q q q
B B B
… r r r
C C C
s s s
… … …
33
Properties 5
Planning Graph ‘levels off’.
After some time k all levels are identical
In terms of propositions, actions
34
Important Ideas
Plan graph construction is polynomial time
Though construction can be expensive when there are many
“objects” and hence many propositions
The plan graph captures important properties of the planning
problem
Necessarily unreachable literals and actions
Possibly reachable literals and actions
Mutually exclusive literals and actions
35
Planning Graphs for Heuristic Search
After GraphPlan was introduced, researchers
found other uses for planning graphs.
36
Planning as heuristic search
Use standard search techniques, e.g. A*,
best-first, hill-climbing etc.
Find a path from the initial state to a goal
Performance depends very much on the quality of
the “heuristic” state evaluator
39
Relaxed Plan Heuristics
Computing those heuristics requires “only”
polynomial time, but must be done many times
during search (think millions)
Mutex computation is quite expensive and adds up
Limits how many states can be searched
PutDown(A,B): PutDown(B,A):
PRE: { holding(A), clear(B) } PRE: { holding(B), clear(A) }
ADD: { on(A,B), handEmpty, clear(A)} ADD: { on(B,A), handEmpty, clear(B) }
DEL: { holding(A), clear(B) } DEL: { holding(B), clear(A) }
Problem Relaxation
PutDown(A,B): PutDown(B,A):
PRE: { holding(A), clear(B) } PRE: { holding(B), clear(A) }
ADD: { on(A,B), handEmpty, clear(A)} ADD: { on(B,A), handEmpty, clear(B) }
DEL: { } DEL: { }
41
Heuristic from Relaxed Problem
42
FF Planner: finding relaxed plans
Consider running Graphplan while ignoring the
delete lists
No mutexes (avoid computing these altogether)
Implies no backtracking during solution extraction search!
So we can find a relaxed solutions efficiently
43
Example: Finding Relaxed Plans
Relaxed plan graph
(no mutexes)
The value returned
depends on particular
choices made in the
backward extraction