Title: Graphplan
1Graphplan
- Joe Souto
- CSE 497 AI Planning
- Sources
- Ch. 6
- Fast Planning through Planning Graph Analysis,
A. Blum M. Furst
2Classical Planning
- Every node is a partial plan
Initial plan
complete plan for goals
3Neoclassical Planning
- Every node in search space is a set of several
partial plans - So not every action in a node appears in the
solution
4Planning Graph
- State-space plan is sequence of actions
- Plan-space plan is partially ordered set of
actions - ?Planning graph sequence of sets of parallel
actions - ex ( a1, a2, a3, a4, a5, a6, a7 )
5Velosos Rocket Problem
C1
R1
C2
San Francisco
R2
C3
R3
St. Louis
Seattle
- Solution can be generalized in 3 steps
6Velosos Rocket Problem
C1
R1
C2
San Francisco
R2
C3
R3
St. Louis
Seattle
7Velosos Rocket Problem
San Francisco
St. Louis
Seattle
8Velosos Rocket Problem
San Francisco
St. Louis
Seattle
- Step 3 Launch all rockets
9What does Graphplan do?
- Explores the problem with a planning graph
before trying to find a solution plan - Uses STRIPS operators, except no negated literals
allowed in preconditions or goals - Plan-space used least commitment, but Graphplan
uses strong commitments - Requires reachability analysis can a state be
reached from a given state? - Requires disjunctive refinement method of
addressing flaws since multiple conflicting
propositions can exist in each state - Well start with the reachability concept
10Reachability
- Reachability metric necessary since you have to
know if a solution state can be reached from s0 - Can be computed w/ reachability graphs, but
computing them is intractable - Can be approximated w/ planning graph, but this
is tractable
11Reachability Trees
- Consider a simple Blocks World Domain
S0
B
C
A
- Move(x, y, z)
- Precond On(y, x), Clear(x), Clear(z), etc.
- Effects On(z, x), On(y, x), Clear(y), etc.
12Reachability Trees
B
S0
C
A
Move(B,C,A)
Move(A,table,B)
Move(B,C,table)
etc
A
B
C
A
B
etc
C
Move(A,table,B)
Move(B,table,A)
Move(C,table,A)
Move(A,B,table)
A
B
C
B
B
C
C
A
A
B
C
A
etc
13Reachability Trees
- Note that a reachability tree down to depth d
solves all planning problems with s0 and A, for
every goal that is reachable in d or fewer
actions - This blows up into O(kd) nodes where k valid
actions, thus we move on to finding reachability
with planning graphs - Could be improved by making a graph rather than
tree, but still intractable since nodes
states
14Planning Graphs
- What if all the states reachable from s0 were
modeled as a single state?
B
C
A
Move(A,table,B)
Move(B,C,table)
Move(B,C,A)
A
B
C
A
B
B
C
A
C
15Planning Graph Idea
B
C
A
Move(B,C,table)
A
B
Move(A,table,B)
B
C
A
C
Move(B,C,A)
B
C
A
16Planning Graphs
- Planning graph considers an inclusive disjunction
of actions from one node to next that contains
all the effects of these actions - Goal is considered reachable from s0 only if it
appears in some node of the planning graph - Graph is of polynomial size and can be built in
polynomial time in size of input - Since some actions in a disjunction may
interfere, we must keep track of incompatible
propositions for each set of propositions and
incompatible actions for each disjunction of
actions
17Planning Graphs
- Planning graph directed layered graph with
alternating levels of propositions (P) and
actions (A) - P0 initial state
- An set of actions whose preconditions are in Pn
- Pn set of propositions that can be true after n
actions have been performed ie Pn-1 ?
effects(A1)
18Planning Graphs
Delete edges
- Precondition arcs go from preconditions in Pn to
associated actions in An - Add edges indicate positive effects of actions
- Delete edges mark negative effects of actions
- Also define a no-op operator ?pprecond(?p)
effects(?p) p and effects-(?p) ? - Note that negative effects are not removed, just
marked. - Pn-1 ? Pn persistence principle
?b2
Precondition arcs
Add edges
19P0
A1
P1
B
B
C
A
C
A
Clear(C) On(B, table) On(B, C) On(A,
B) On(A,table) Clear(B) On(B, A) Clear(A) On(C,t
able)
Move(B,C,table)
A
Clear(B) On(B, C) Clear(A) On(A,
table) On(C,table)
B
C
Move(A,table,B)
Move(B,C,A)
B
C
A
20Definitions
- 1) Two actions(a,b) are independent iff
- effects-(a) ? precond(b) ? effects(b) ?
- effects-(b) ? precond(a) ? effects(a) ?
Precond clear(A), clear(B) Effects
on(B,A) Effects- clear(B)
A
Move(A,table,B)
B
B
C
C
A
Precond clear(B) Effects on(table,B),
clear(C) Effects- none
Move(B,C,table)
B
C
A
21Definitions
- 2) A set of independent actions, ?, is applicable
to a state iff precond(?) ? s - 3) A layered plan is a sequence of sets of
actions. A valid plan, ? lt?1, , ?ngt, is
solution to problem iff - Each set ?i ? ? is independent
- ?n is applicable to sn
- g ? ?(?(?(s0, ?1), ?2) ?n)
22Note
- Since planning graph explores results of all
possible actions to level n - If a valid plan exists within n steps, that plan
is a subgraph of the planning graph - Allows you to find plan w/ min number of actions
23Mutual Exclusion
- Cant have 2 simultaneous actions in one level
that are dependent - Two actions at a given level in planning graph
are mutually exclusive (mutex) if no valid plan
can contain both, or no plan could make both
true, ie they are dependent or they have
incompatible preconditions - µAi mutually exclusive actions in level i
- µPi mutually exclusive propositions in level i
24Finding Mutex relationships
- Two rules
- Interference if one action deletes a
precondition of another or deletes a positive
effect - Competing Needs if actions a and b have
preconditions that are marked as mutex in
previous proposition level
25Mutex Example
Precond clear(A), clear(B) Effects
on(B,A) Effects- clear(B)
A
Move(A,table,B)
B
B
C
C
A
Precond clear(B) Effects on(table,B),
clear(C) Effects- none
Move(B,C,table)
B
C
A
26Mutex Example
A) Load(R1, C2, St Louis) B) Load(R2, C2,
Seattle) ?Mutex because C2 cannot be in St Louis
and Seattle at same time
R1
R2
C2
Seattle
St. Louis
27 28Graphplan Algorithm
- Input Proposition level P0 containing initial
conditions - Output valid plan or states no valid plan exists
- Algorithm
- while (!done)
-
- Expansion Phase Expand planning graph to next
action and proposition level - Search/Extraction Phase Search graph for a
valid plan - if (valid plan exists)
- return successful plan
- else
- continue
-
- ? Graphplan is sound and complete
29Expanding Planning Graphs
- Create next Action level by iterating through
each possible action for each possible
instantiation given the preconditions in the
previous proposition level, then insert no-ops
and precondition edges - Create next Proposition level from the
Add-Effects of the actions just generated - Associated with each action is a list of actions
it is mutex with
30Expansion Algorithm
31P0
A1
P1
B
B
C
A
Mutex list for Move(B,C,table) -Move(A,table,B) -
Move(B,C,A)
C
A
Clear(C) On(B, table) On(B, C) On(A,
B) On(A,table) Clear(B) On(B, A) Clear(A) On(C,t
able)
Move(B,C,table)
A
Clear(B) On(B, C) Clear(A) On(A,
table) On(C,table)
Mutex list for Move(A,table,B) -Move(B,C,table) -
Move(B,C,A)
B
?
C
Move(A,table,B)
Mutex list for Move(B,C,A) -Move(B,C,table) -Move
(A,table,B)
?
?
?
?
Move(B,C,A)
B
C
A
32Finding Graphplan Solution
- Solution found via backward chaining
- Select one goal at time t, find an action at t
1 achieving this goal - Continue recursively with next goal at time t
- Preconditions of actions in At become the new
goals - Repeat above steps until reaching P0
- Performance improved w/ forward checking after
each action is considered, Graphplan checks that
no goal becomes cut off by this action
33Planning Graph Solution
34Extraction Algorithm
- Optimization Actions that failed to satisfy
certain goals at certain levels are saved in
nogood hash table (?), indexed by level, so
when you backtrack you can prevented wasting time
examining actions that were not helpful earlier
35Graphplan Algorithm
36Algorithm Example
B
D
C
A
E
On(A, table) On(B, A) On(D, B) Clear(D) On(E,
table) On(C, E) Clear(C)
D
B
C
A
E
37P0
P1
A1
A2
P2
Solution (Move(B,C,A),Move(D,E,table),
(Move(C,table,E),Move(D,table,B))
B
D
C
A
E
Clear(A) On(B, A) Clear(C) Clear(D) On(C,table) On
(B, table) On(B, C) On(E,table) On(A,
B) On(A,table) Clear(B) On(D,E) Clear(E) On(D,tabl
e)
On(E,table) On(B, A) Clear(C) On(C,E) On(C,table)
On(B, table) On(B, C) Clear(D) On(A,
B) On(A,table) Clear(B) On(D,E) Clear(E) On(D,tabl
e) On(D,B)
?
Move(B,C,D)
Clear(B) On(B, C) Clear(A) On(A,
table) On(C,table) On(E, table) On(D,E) Clear(D)
Move(C,table,E)
Move(B,C,A)
?
?
?
?
?
Move(B,C,table)
?
Move(D,table,B)
Move(D,E,table)
Move(D,E,A)
38Monotonicity Property
- Recall persistence principle Since negative
effects are never removed, and for ?
precond(?p) effects(?p) p? Pn-1 ? Pn,
propositions monotonically increase - ? Similarly, An-1 ? An, actions monotonically
increase
39Unsolvable problems
- Due to monotonic property of planning graphs,
Pn-1 ? Pn, and An-1 ? An - At some point, all possible propositions will
have been explored, thus PnPnk for all kgt0 - Graph has leveled off (also called Fixedpoint
in book) - If you reach a proposition level thats identical
to the previous level, and all goal conditions
are not present and non-mutex, problem is
unsolvable - Thus Graphplan is complete
40Graphplan Planning System
- Two files required to specify a domain
- Facts file describe objects in the problem,
initial state, and goal state - Operations file describe valid operations in
that domain
41Sample Facts File
General Syntax
- (blockA OBJECT)
- (blockB OBJECT)
- (blockC OBJECT)
- (blockD OBJECT)
- (preconds
- (on-table blockA)
- (on blockB blockA)
- (on blockC blockB)
- (on blockD blockC)
- (clear blockD)
- (arm-empty))
- (effects
- (on blockB blockA)
- (on blockC blockB)
- (on blockA blockD))
(variable_name variable_type) () (preconds
(literal_name variable_name1 variable_name2
) () ) (effects (literal_name
variable_name1 variable_name2 ) () )
Things (operands) in the domain
Initial state
Goal State
42Sample Operations File
- (operator
- PICK-UP
- (params (ltob1gt OBJECT))
- (preconds
- (clear ltob1gt) (on-table ltob1gt) (arm-empty))
- (effects
- (holding ltob1gt)))
- (operator
- STACK
- (params (ltobgt OBJECT) (ltunderobgt OBJECT))
- (preconds
- (clear ltunderobgt) (holding ltobgt))
- (effects
- (arm-empty) (clear ltobgt) (on ltobgt
ltunderobgt)))
(operator Operator_name (params (ltop1gt
ltop_typegt)) (preconds (literal ltop1gt ltop2gt
) () ) (effects (literal ltop1gt ltop2gt
) () ) )
General Syntax
43More Samples Rocket Facts
(London PLACE) (Paris PLACE) (JFK PLACE) (r1
ROCKET) (r2 ROCKET) (alex CARGO) (jason
CARGO) (pencil CARGO) (paper CARGO) (preconds (at
r1 London) (at r2 London) (at alex London) (at
jason London) (at pencil London)
(at paper London) (has-fuel r1) (has-fuel
r2)) (effects (at alex Paris) (at jason
JFK) (at pencil Paris) (at paper JFK))
44More Samples Rocket Ops
- (operator
- LOAD
- (params
- (ltobjectgt CARGO) (ltrocketgt ROCKET) (ltplacegt
PLACE)) - (preconds
- (at ltrocketgt ltplacegt) (at ltobjectgt ltplacegt))
- (effects
- (in ltobjectgt ltrocketgt) (del at ltobjectgt
ltplacegt))) - (operator
- UNLOAD
- (params
- (ltobjectgt CARGO) (ltrocketgt ROCKET) (ltplacegt
PLACE)) - (preconds
- (at ltrocketgt ltplacegt) (in ltobjectgt ltrocketgt))
- (effects
- (at ltobjectgt ltplacegt) (del in ltobjectgt
ltrocketgt)))
(operator MOVE (params (ltrocketgt ROCKET)
(ltfromgt PLACE) (lttogt PLACE)) (preconds
(has-fuel ltrocketgt) (at ltrocketgt ltfromgt))
(effects (at ltrocketgt lttogt) (del has-fuel
ltrocketgt) (del at ltrocketgt ltfromgt)))
45Important
- Graphplan has no concept of negation. Use
propositions with equivalent meaning - Ex ?inhand(B) ? not-inhand(B)
- Cannot use _ in any token. Use instead.
- Comments Begin line with
- See README file for more details
46Running Graphplan
- Access in my home directory on Suns/home/jhs4/gr
aphplan - Contains executable and sample facts/operations
files - Execute with ./graphplan.sparc
- Program prompts for names of operations and fact
files at runtime - Source for Solaris and Linux in ./solaris-src and
./linux-src respectively
47- Graphplan System Live Demo
48Contact
- Trouble running Graphplan? Email me
- jhs4(at)lehigh.edu