410 likes | 539 Views
An Introduction to Planning Graph. Chang, Han-Wen. A. Blum and M. Furst, " Fast Planning Through Planning Graph Analysis ", Artificial Intelligence , 90:281--300 (1997) AIMA textbook, Chap. 11, Section 11.4. March 29, 2007. Planning Problem.
E N D
An Introduction to Planning Graph Chang, Han-Wen A. Blum and M. Furst, "Fast Planning Through Planning Graph Analysis", Artificial Intelligence, 90:281--300 (1997) AIMA textbook, Chap. 11, Section 11.4 March 29, 2007
Planning Problem • Planning is to come up with a sequence of actions that will achieve a goal from the initial state.
Representation • states: conjunction of positive literals • ground and function-free first-order literals • closed-world assumption • actions: • action name and parameter list • precondition • add-effect • delete-effect • no new object created
A A B B R Rocket Example Cargo (A); Cargo (B); Rocket (R); Place (L); Place (P); move (Rocket ?r, Place ?from, Place ?to) Precond: At (?r, ?from) & HasFuel (?r) Add: At (?r, ?to) Delete: At (?r, ?from) & HasFuel (?r) load (Rocket ?r, Place ?p, Cargo ?c) Precond: At (?r, ?p) & At (?c, ?p) Add: In (?c, ?r) Delete: At (?c, ?p) unload (Rocket ?r, Place ?p, Cargo ?c) Precond: At (?r, ?p) & In (?c, ?r) Add: At (?c, ?p) Delete: In (?c, ?r) Place L Init: At (A, L) & At (B, L) & At (R, L) & HasFuel (R) Goal: At (A, P) & At (B, P) Place P
Motivation • Search performance depends on branching factor, and constraints reduce the search space. • Independent actions can be done in any order.
Basic Idea • Construct a graph that encodes constraints on possible plans • Use this “planning graph” to constrain search for a valid plan: • If valid plan exists, it is a subgraph of the planning graph
Planning Graph • Directed and Leveled • Nodes • Proposition nodes • Action nodes • Edges • Precondition edges: from propositions to actions • Add edges: from actions to propositions • Del edges: from actions to propositions • No-op edges: from propositions to propositions
Graph Levels • Alternate Levels • Proposition level: all propositions that could be true at time step t • Action level: all actions that could have their preconditions satisfied at time step t
Extending Planning Graph Load R, L, B Load R, L, A At B, L At B, L At A, L At A, L In B, R In A, R At R, L At R, L Fuel R Fuel R At R, P Move R, L, P
Unload R, L, B Unload R, L, B Unload R, L, A Unload R, L, A Load R, L, B Load R, L, B Load R, L, B Load R, L, A Load R, L, A Load R, L, A At B, L At B, L At B, L At B, L At A, L At A, L At A, L At A, L In B, R In B, R In B, R In A, R In A, R In A, R At R, L At R, L At R, L At R, L Fuel R Fuel R Fuel R Fuel R At R, P At R, P At R, P Unload R, P, B At B, P Unload R, P, A At A, P Move R, L, P Move R, L, P Move R, L, P Propositions Time 3 Propositions Time 2 Actions Time 2 Propositions Time 0 Actions Time 0 Propositions Time 1 Actions Time 1 Precondition edges Rocket Example Add-effect edges Delete-effect edges No-op edges
Mutual Exclusions (mutex) • Inconsistent Effects • Interference • Competing Needs • Inconsistent Support
Inconsistent Effects (mutex) • The action deletes an add-effect of the other. • Load(R, L, A) deletes At(L, A) which is an add-effect of Unload(R, L, A), so the two actions are mutex.
Interference (mutex) • The action deletes a precondition of the other. • Move(R, L, P) deletes At(R, L) which is an precondition of Load(R, L, A), so the two actions are mutex.
Competing Needs (mutex) • If there is a precondition p of action a and a precondition q of action b that are mutex in the previous proposition level, the two actions are mutex. • The precondition At(A, L) of action Load(R, A, L) and the precondition At(A, P) of action Load(R, A, P) are mutex, so the two actions are mutex.
Inconsistent Support (mutex) • If each action a having an add-effect of proposition p is marked as exclusive of each action b having an add-effect of proposition q, the two propositions are mutex. • The proposition At(A, L) and the proposition In(A, R) are mutex at time step t if the are mutex at time step t-1, and any action creates At(A, L) are mutex with any action creates In(A, R).
GraphPlan Algorithm function GRAPHPLAN(problem) returnsolution or failure graph INITIAL-PLANNING-GRAPH(problem) goals GOALS[problem] loop do ifgoals all non-mutex in last level of graph then do solution EXTRACT-SOLUTION(graph, goals, LENGTH(graph)) ifsolution failure then returnsolution else if NO-SOLUTION-POSSIBLE(graph) then return failure graph EXPAND-GRAPH(graph, problem)
Plan Extraction • Valid plan • goals are satisfied • Non-mutex actions • Backward chaining • Achieve goals level by level • Non-mutex actions at level k • Preconditions as the goals for level k-1 • No Non-mutex action found backtrack
Features • Literals increase monotonically • Actions increase monotonically • Mutexes decrease monotonically • Eventually level off • two consecutive levels are identical
Termination • planning graph eventually leveled-off • If the graph is leveled-off and some literals of the goal do not appear or are marked as mutex in the latest proposition level, the problem is unsolvable.
Advanced Test • Let Sti be the collection of unachievable (sub)goal-sets stored for level i after trial at stage t • If graph leveled off at level n and St-1n = Stn at a stage t > n, then output “No Plan Exists”
Remarks on Planning Graph • Polynomial space / graph creation time • p: |initial state| • n: #object • m: #operator • t: #level • l: max( #add-list ) • k: max( #operator parameter ) • #Max nodes action level: O(mnk) • #Max nodes proposition level: O(p+mlnk)
More Remarks • Sound & complete • Partially-ordered planning • Independent actions in the same level can be executed in any order
Pro and Con • Cases with better performance • pairwise mutex relations capture important constraints • parallel actions reduce the depth of the graph
Eat Cake Example (AIMA) similar to drink water example
A A B B R Rocket Example Cargo (A); Cargo (B); Rocket (R); Place (L); Place (P); move (Rocket ?r, Place ?from, Place ?to) Precond: At (?r, ?from) & HasFuel (?r) Add: At (?r, ?to) Delete: At (?r, ?from) & HasFuel (?r) load (Rocket ?r, Place ?p, Cargo ?c) Precond: At (?r, ?p) & At (?c, ?p) Add: In (?c, ?r) Delete: At (?c, ?p) unload (Rocket ?r, Place ?p, Cargo ?c) Precond: At (?r, ?p) & In (?c, ?r) Add: At (?c, ?p) Delete: In (?c, ?r) Place L Init: At (A, L) & At (B, L) & At (R, L) & HasFuel (R) Goal: At (A, P) & At (B, P) Place P
Unload R, L, B Unload R, L, B Unload R, L, A Unload R, L, A Load R, L, B Load R, L, B Load R, L, B Load R, L, A Load R, L, A Load R, L, A At B, L At B, L At B, L At B, L At A, L At A, L At A, L At A, L In B, R In B, R In B, R In A, R In A, R In A, R At R, L At R, L At R, L At R, L Fuel R Fuel R Fuel R Fuel R At R, P At R, P At R, P Unload R, P, B At B, P Unload R, P, A At A, P Move R, L, P Move R, L, P Move R, L, P Propositions Time 3 Propositions Time 2 Actions Time 2 Propositions Time 0 Actions Time 0 Propositions Time 1 Actions Time 1 Precondition edges Rocket Example Add-effect edges Delete-effect edges No-op edges
Extending Planning Graph Load R, L, B Load R, L, A At B, L At B, L At A, L At A, L In B, R In A, R At R, L At R, L Fuel R Fuel R At R, P Move R, L, P
Inconsistent Effects (mutex) • The action deletes an add-effect of the other. • Load(R, L, A) deletes At(L, A) which is an add-effect of Unload(R, L, A), so the two actions are mutex.
Interference (mutex) • The action deletes a precondition of the other. • Move(R, L, P) deletes At(R, L) which is an precondition of Load(R, L, A), so the two actions are mutex.
Competing Needs (mutex) • If there is a precondition p of action a and a precondition q of action b that are mutex in the previous proposition level, the two actions are mutex. • The precondition At(A, L) of action Load(R, A, L) and the precondition At(A, P) of action Load(R, A, P) are mutex, so the two actions are mutex.
Inconsistent Support (mutex) • If each action a having an add-effect of proposition p is marked as exclusive of each action b having an add-effect of proposition q, the two propositions are mutex. • The proposition At(A, L) and the proposition In(A, R) are mutex at time step t if the are mutex at time step t-1, and any action creates At(A, L) are mutex with any action creates In(A, R).
literals: EmptyCup FullCup Thirsty NotThirsty Initial Condition: FullCup & Thirsty Goal: NotThirsty & FullCup Drink Water Example
FillCup Preconds: EmptyCup Add-effs: FullCup Del-effs: EmptyCup EmptyCupAction Preconds: FullCup Add-effs: EmptyCup Del-effs: FullCup Drink Preconds: FullCup & Thirsty Add-effs: EmptyCup & NotThirsty Del-effs: FullCup & Thirsty Drink Water Example -- Actions
Drink Water Planning Graph EmptyCupAction EmptyCupAction FillCup EmptyCup EmptyCup FullCup FullCup FullCup Thirsty Thirsty Thirsty NotThirsty NotThirsty Drink Drink action time 2 proposition time 2 proposition time 3 action time 1 proposition time 1
Inconsistent Effects (mutex) • The action deletes an add-effect of the other. • Drink deletes Full_Cup which is an add-effect of Fill_Cup, so the two actions are mutex.
Interference (mutex) • The action deletes a precondition of the other. • EmptyCupAction deletes FullCup which is an precondition of Drink, so the two actions are mutex.
Competing Needs (mutex) • If there is a precondition p of action a and a precondition q of action b that are mutex in the previous proposition level, the two actions are mutex. • The precondition EmptyCup of action FillCup and the precondition FullCup of action Drink are mutex, so the two actions are mutex.
Inconsistent Support (mutex) • If each action a having an add-effect of proposition p is marked as exclusive of each action b having an add-effect of proposition q, the two propositions are mutex. • The proposition EmptyCup and the proposition FullCup are mutex at time step t if the are mutex at time step t-1, and any action creates EmptyCup are mutex with any action creates FullCup.