An Introduction to Planning Graph

Post on 20-Jan-2016

45 views 0 download

Tags:

description

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. - PowerPoint PPT Presentation

transcript

An Introduction to Planning An Introduction to Planning GraphGraph

Chang, Han-WenChang, Han-Wen

March 29, 2007

A. Blum and M. Furst, "A. Blum and M. Furst, "Fast Planning Through Planning Graph Analysis", ", Artificial IntelligenceArtificial Intelligence, 90:281--300 (1997), 90:281--300 (1997) AIMA textbook, Chap. 11, Section 11.4AIMA textbook, Chap. 11, Section 11.4

Planning ProblemPlanning Problem

PlanningPlanning is to come up with is to come up with a sequence of a sequence of actionsactions that will achieve that will achieve a goala goal from the from the initial initial statestate..

RepresentationRepresentation

states: conjunction of positive literalsstates: conjunction of positive literals ground and function-free first-order literals closed-world assumption

actions:actions: action name and parameter list precondition add-effect delete-effect no new object created

AB

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)

Rocket ExampleRocket Example Cargo (A); Cargo (B); Rocket (R); Place (L); Place (P);

A B

Place L

Init:At (A, L) & At (B, L) & At (R, L) & HasFuel (R)

R

Goal:At (A, P) & At (B, P) Place P

MotivationMotivation

Search performance depends on Search performance depends on branching branching factorfactor, and constraints reduce the search , and constraints reduce the search space.space.

Independent actions can be done in any order. Independent actions can be done in any order.

Basic IdeaBasic Idea

Construct a graph that encodes constraints on Construct a graph that encodes constraints on possible planspossible plans

Use this “planning graph” to constrain search Use this “planning graph” to constrain search for a valid plan:for a valid plan: If valid plan exists, it is a subgraph of the planning

graph

Planning GraphPlanning Graph

Directed and LeveledDirected and Leveled NodesNodes

Proposition nodes Action nodes

EdgesEdges 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 LevelsGraph Levels

Alternate LevelsAlternate 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

At B, L

At A, L

At R, L

Fuel R

Load R, L, B

Load R, L, A

Move R, L, P

At B, L

At A, L

At R, L

Fuel R

At R, P

In B, R

In A, R

Extending Planning Extending Planning GraphGraph

Load R, L, B

Load R, L, A

Move R, L, P

Unload R, L, A

Unload R, L, B

ActionsTime 1

At B, L

At A, L

At R, L

Fuel R

Propositions Time 0

Load R, L, B

Load R, L, A

Move R, L, P

ActionsTime 0

At B, L

At A, L

At R, L

Fuel R

At R, P

In B, R

In A, R

Propositions Time 1

Precondition edges

Add-effect edges

Delete-effect edges

No-op edges

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

ActionsTime 2

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

Rocket ExampleRocket Example

Mutual Exclusions (mutex)Mutual Exclusions (mutex)

Inconsistent EffectsInconsistent Effects InterferenceInterference Competing NeedsCompeting Needs Inconsistent SupportInconsistent Support

Inconsistent Effects (mutex)Inconsistent Effects (mutex)

The action deletes an add-effect of the other.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)Interference (mutex)

The action deletes a precondition of the other.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)Competing Needs (mutex)

If there is a precondition If there is a precondition pp of action of action aa and a and a precondition precondition qq of action of action bb that are mutex in that are mutex in the previous proposition level, the two actions the previous proposition level, the two actions are mutex.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)Inconsistent Support (mutex)

If each action If each action aa having an add-effect of having an add-effect of proposition proposition pp is marked as exclusive of each is marked as exclusive of each action action bb having an add-effect of proposition having an add-effect of proposition qq, , the two propositions are mutex.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)Spare Tire Example (AIMA)

GraphPlan AlgorithmGraphPlan Algorithm

function GRAPHPLAN(problem) return solution or failuregraph 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 ExtractionPlan Extraction

Valid planValid plan goals are satisfied Non-mutex actions

Backward chainingBackward chaining Achieve goals level by levelAchieve goals level by level

Non-mutex actions at level k Preconditions as the goals for level k-1 No Non-mutex action found backtrack

FeaturesFeatures

Literals increase monotonicallyLiterals increase monotonically Actions increase monotonicallyActions increase monotonically Mutexes decrease monotonicallyMutexes decrease monotonically

Eventually level offEventually level off two consecutive levels are identical

TerminationTermination

planning graph eventually leveled-offplanning graph eventually leveled-off

If the graph is leveled-off and some literals of If the graph is leveled-off and some literals of the goal do not appear or are marked as the goal do not appear or are marked as mutex in the latest proposition level, the mutex in the latest proposition level, the problem is unsolvable.problem is unsolvable.

Advanced TestAdvanced Test

Let Let SStt

ii be the collection of unachievable be the collection of unachievable

(sub)goal-sets stored for level i after trial at (sub)goal-sets stored for level i after trial at stage tstage t

If graph leveled off at level n and If graph leveled off at level n and SSt-1t-1

nn = = SStt

nn at a at a

stage t > n, then output “No Plan Exists”stage t > n, then output “No Plan Exists”

Remarks on Planning GraphRemarks on Planning Graph Polynomial space / graph creation timePolynomial 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 RemarksMore Remarks

Sound & completeSound & complete

Partially-ordered planning Partially-ordered planning Independent actions in the same level can be

executed in any order

Pro and ConPro and Con

Cases with better performanceCases with better performance pairwise mutex relations capture important

constraints parallel actions reduce the depth of the graph

ThanksThanks

Eat Cake Example (AIMA)Eat Cake Example (AIMA)similar to drink water example

Spare Tire Example (AIMA)Spare Tire Example (AIMA)

AB

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)

Rocket ExampleRocket Example Cargo (A); Cargo (B); Rocket (R); Place (L); Place (P);

A B

Place L

Init:At (A, L) & At (B, L) & At (R, L) & HasFuel (R)

R

Goal:At (A, P) & At (B, P) Place P

Load R, L, B

Load R, L, A

Move R, L, P

Unload R, L, A

Unload R, L, B

ActionsTime 1

At B, L

At A, L

At R, L

Fuel R

Propositions Time 0

Load R, L, B

Load R, L, A

Move R, L, P

ActionsTime 0

At B, L

At A, L

At R, L

Fuel R

At R, P

In B, R

In A, R

Propositions Time 1

Precondition edges

Add-effect edges

Delete-effect edges

No-op edges

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

ActionsTime 2

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

Rocket ExampleRocket Example

At B, L

At A, L

At R, L

Fuel R

Load R, L, B

Load R, L, A

Move R, L, P

At B, L

At A, L

At R, L

Fuel R

At R, P

In B, R

In A, R

Extending Planning Extending Planning GraphGraph

Inconsistent Effects (mutex)Inconsistent Effects (mutex)

The action deletes an add-effect of the other.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)Interference (mutex)

The action deletes a precondition of the other.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)Competing Needs (mutex)

If there is a precondition If there is a precondition pp of action of action aa and a and a precondition precondition qq of action of action bb that are mutex in that are mutex in the previous proposition level, the two actions the previous proposition level, the two actions are mutex.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)Inconsistent Support (mutex)

If each action If each action aa having an add-effect of having an add-effect of proposition proposition pp is marked as exclusive of each is marked as exclusive of each action action bb having an add-effect of proposition having an add-effect of proposition qq, , the two propositions are mutex.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 ExampleDrink Water Example

literals:literals: EmptyCup FullCup Thirsty NotThirsty

Initial Condition:Initial Condition: FullCup & Thirsty

Goal:Goal: NotThirsty & FullCup

Drink Water Example -- Drink Water Example -- ActionsActions

FillCupFillCup Preconds: EmptyCup Add-effs: FullCup Del-effs: EmptyCup

EmptyCupActionEmptyCupAction Preconds: FullCup Add-effs: EmptyCup Del-effs: FullCup

DrinkDrink Preconds:

FullCup & Thirsty Add-effs:

EmptyCup & NotThirsty Del-effs:

FullCup & Thirsty

EmptyCupEmptyCup

Drink Water Planning GraphDrink Water Planning Graph

FullCup

EmptyCupAction

Drink

Thirsty

FullCup

NotThirsty

Thirsty

FillCup

EmptyCupAction

Drink

FullCup

NotThirsty

Thirsty

propositiontime 1

propositiontime 2

propositiontime 3

actiontime 1

actiontime 2

Inconsistent Effects (mutex)Inconsistent Effects (mutex)

The action deletes an add-effect of the other.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)Interference (mutex)

The action deletes a precondition of the other.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)Competing Needs (mutex)

If there is a precondition If there is a precondition pp of action of action aa and a and a precondition precondition qq of action of action bb that are mutex in that are mutex in the previous proposition level, the two actions the previous proposition level, the two actions are mutex.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)Inconsistent Support (mutex)

If each action If each action aa having an add-effect of having an add-effect of proposition proposition pp is marked as exclusive of each is marked as exclusive of each action action bb having an add-effect of proposition having an add-effect of proposition qq, , the two propositions are mutex.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.