An Introduction to Planning Graph 2019/6/2 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
2019/6/2 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 actions: 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
Rocket Example Cargo (A); Cargo (B); Rocket (R); Place (L); Place (P); R A B 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) B A 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 Edges 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
Rocket Example Precondition edges Add-effect edges Delete-effect edges 2019/6/2 Rocket Example Add-effect edges Delete-effect edges Load R, L, B Load R, L, A Move R, L, P Unload R, L, A Unload R, L, B Actions Time 1 Load R, L, B Load R, L, A Move R, L, P Unload R, L, A Unload R, L, B Unload R, P, A Unload R, P, B Actions Time 2 No-op edges Load R, L, B Load R, L, A Move R, L, P Actions Time 0 At B, L At A, L At R, L Fuel R Propositions Time 0 At B, L At A, L At R, L Fuel R At R, P In B, R In A, R Propositions Time 1 At B, L At A, L At R, L Fuel R At R, P In B, R In A, R Propositions Time 2 At B, L At A, L At R, L Fuel R At R, P In B, R In A, R At B, P At A, P Propositions Time 3
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).
Spare Tire Example (AIMA)
GraphPlan Algorithm function GRAPHPLAN(problem) return solution or failure graph INITIAL-PLANNING-GRAPH(problem) goals GOALS[problem] loop do if goals all non-mutex in last level of graph then do solution EXTRACT-SOLUTION(graph, goals, LENGTH(graph)) if solution failure then return solution else if NO-SOLUTION-POSSIBLE(graph) then return failure graph EXPAND-GRAPH(graph, problem)
Plan Extraction Valid plan Backward chaining 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 2019/6/2 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
Thanks
Eat Cake Example (AIMA) similar to drink water example
Spare Tire Example (AIMA)
Rocket Example Cargo (A); Cargo (B); Rocket (R); Place (L); Place (P); R A B 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) B A Goal: At (A, P) & At (B, P) Place P
Rocket Example Precondition edges Add-effect edges Delete-effect edges 2019/6/2 Rocket Example Add-effect edges Delete-effect edges Load R, L, B Load R, L, A Move R, L, P Unload R, L, A Unload R, L, B Actions Time 1 Load R, L, B Load R, L, A Move R, L, P Unload R, L, A Unload R, L, B Unload R, P, A Unload R, P, B Actions Time 2 No-op edges Load R, L, B Load R, L, A Move R, L, P Actions Time 0 At B, L At A, L At R, L Fuel R Propositions Time 0 At B, L At A, L At R, L Fuel R At R, P In B, R In A, R Propositions Time 1 At B, L At A, L At R, L Fuel R At R, P In B, R In A, R Propositions Time 2 At B, L At A, L At R, L Fuel R At R, P In B, R In A, R At B, P At A, P Propositions Time 3
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).
Drink Water Example literals: Initial Condition: Goal: EmptyCup FullCup Thirsty NotThirsty Initial Condition: FullCup & Thirsty Goal: NotThirsty & FullCup
Drink Water Example -- Actions 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:
Drink Water Planning Graph EmptyCupAction EmptyCupAction FillCup EmptyCup EmptyCup FullCup FullCup FullCup Thirsty Thirsty Thirsty NotThirsty NotThirsty Drink Drink proposition time 1 action time 1 proposition time 2 action time 2 proposition time 3
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.