Transcript Lecture 4

Lecture 4
Planning
Lecture Plan
1.
Planning:
I.
PDDL
II.
Partial Order Planning
III.
Planning Graphs and the Graph Plan Algorithm
PDDL: Planning Domain Definition Language
 States
 Actions
 Goal
PDDL: Planning Domain Definition Language
 States
 States are specified by a set of 'atomic fluents.'
•
Fluents are propositions that can change their truth value
•
Atomic means these propositions are simple: They do not include conjunctions, disjunctions,
conditionals or negation.
•
Database semantics is assumed, allowing negation by omission.
 Actions
 Goal
•
Unique names assumption
•
Closed-world assumption
•
Domain closure
PDDL: Planning Domain Definition Language
 States
 Actions
 Actions are specified by a set of preconditions and effects, both of which are conjunctions
of literals.
•
Literals are simple atomic propositions or negations of atomic propositions.
•
All preconditions are current, all effects immediate.
 Actions can be performed at a state is all positive literals are, and all negative literals are
not, in the set of fluents at a state.
 The effect of an action is to add all positive literals, and remove all negative literals, in the
action's effects from the current state.
•
 Goal
Where an action has non-trivial effects, this causes us to transition to a new state.
How actions function as transitions:
State
1
State 1:
Set, F, of
Atomic Fluents
Action
Preconditions: Set, P = 𝑃+ ∪ 𝑃− ,
of literals, where:
• 𝑃+ ⊆F
• 𝐴(𝑃− ) ∩ F=∅.
Effects: Set, E = 𝐸 + ∪ 𝐸 − , of
literals.
State
2
State 2:
Set, G = 𝐹 ∪ 𝐸 + ∖ 𝐴(𝐸 − ),
of Atomic Fluents
PDDL: Planning Domain Definition Language
 States
 Actions
 Goal
 The planning goal is specified by a conjunction of literals OR a schema which can be
satisfied by such a conjunction of literals.
 We have achieved a goal state when all positive literals are, and all negative literals are
not, included in the current state specification.
A PDDL Problem
1. An initial state
2. A set of actions, or action schema:
Action schema use variables:
Action: Eat Cake (x,y)
Precondition: Cake(x), -Eaten(x), Person(y), Hungry(y)
Effect: Eaten(x), -Hungry(y)
3. A goal specification.
PDDL Problems as Search
1. We must discover the transitions we can make:
At each state, we must search through our actions to discover which actions may be
performed there.
2. It is easy to search backwards and discover states that can transition to our
current state given a possible action.
To find predecessor state to current state given a particular action: Remove all effects (add
negations) and add all preconditions (remove negations) from current state.
PDDL Example: Initial State
Initial state:
Person (mike)
PDDL Example: Actions
Action:
Go Shopping (x)
Preconditions:
Person(x)
Effects:
HasMix(x)
PDDL Example: Actions
Action:
Make Cake(x)
Preconditions:
Person(x)
HasMix (x)
Effects:
HasCake(x)
PDDL Example: Actions
Action:
Wait(x)
Preconditions:
Person(x),
-Hungry(x)
Effects:
Hungry(x)
PDDL Example: Actions
Action:
Eat Cake A (x)
Preconditions:
Person(x),
Hungry(x),
HasCake(x)
Effects:
-HasCake(x),
-Hungry(x),
EatenCake(x)
PDDL Example: Actions
Action:
Eat Cake B (x)
Preconditions:
Person(x),
-Hungry(x),
HasCake(x)
Effects:
-HasCake(x),
-Person(x)
PDDL Example: Goal
Preconditions:
Person(mike),
-Hungry(mike),
HasCake(mike),
EatenCake(mike)
We could have a goal specification that included variables. Eg Let anyone who is a person, not
just mike, eat a cake while having a cake and not being hungry:
Person(x),
-Hungry(x),
HasCake(x),
EatenCake(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Satisfied
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Initial
State
Person(mike)
Effects:
Satisfied by
omission
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Unsatisfied
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Unsatisfied
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Unsatisfied
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Unsatisfied
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Satisfied
Initial
State
Person(mike)
Effects:
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
-HasCake(x)
Effects:
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Initial
State
Person(mike)
Effects:
Satisfied (the second by
omission).
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Action:
Eat Cake B (x)
Action:
Eat Cake A (x)
Action:
Make Cake(x)
Pre.:
Person(x)
Pre.:
Person(x)
Pre.:
Person(x)
Effects:
-Hungry(x),
Hungry(x),
HasCake(x)
HasCake(x)
Effects:
-HasCake(x)
-HasCake(x),
-Hungry(x)
Goal
Person(mike),
Action:
Go Shopping (x)
-Hungry(mike),
Pre.:
Person(x)
HasCake(mike),
Effects:
HasMix(x)
EatenCake(mike)
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Person(mike)
Effects:
Wait
(mike)
S2
Person(mike),
Hungry(mike)
HasCake(x)
-HasMix(x)
EatenCake(x),
-Person(x)
Pre.:
HasMix(x)
Action:
Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:
Hungry(x)
Go Shopping
(mike)
Action: Go Shopping (x)
Pre.:
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
S2
Person(mike),
Hungry(mike)
Person(x)
Effects:HasMix(x)
At the next step, from S1 we could go shopping
again. But it wouldn’t change anything.
Go Shopping
(mike)
Action: Go Shopping (x)
Pre.:
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
Person(x)
Effects:HasMix(x)
At the next step, from S1 we could go shopping
again. But it wouldn’t change anything.
S2
The preconditions of the action are met...
Person(mike),
Hungry(mike)
Go Shopping
(mike)
Action: Go Shopping (x)
Pre.:
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
Person(x)
Effects:HasMix(x)
At the next step, from S1 we could go shopping
again. But it wouldn’t change anything.
S2
The preconditions of the action are met...
Person(mike),
Hungry(mike)
But the effects are already true at this state.
Go Shopping
(mike)
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
Action: Make Cake(x)
Make Cake
(mike)
S2
Person(mike),
Hungry(mike)
Pre.:
S3
Person(mike),
HasCake(mike)
Person(x)
HasMix(x)
Effects:HasCake(x)
-HasMix(x)
Or from S1 we could make a cake which would
change things.
Go Shopping
(mike)
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
Action: Make Cake(x)
Make Cake
(mike)
S2
Pre.:
S3
Person(mike),
HasCake(mike)
Person(x)
HasMix(x)
Effects:HasCake(x)
-HasMix(x)
Or from S1 we could make a cake which would
change things.
Person(mike),
Hungry(mike)
The preconditions of the action are met...
Go Shopping
(mike)
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
Action: Make Cake(x)
Make Cake
(mike)
S2
Pre.:
S3
Person(mike),
HasCake(mike)
Person(x)
HasMix(x)
Effects:HasCake(x)
-HasMix(x)
Or from S1 we could make a cake which would
change things.
Person(mike),
Hungry(mike)
The preconditions of the action are met...
And the effects cause one fluent to be made true...
Go Shopping
(mike)
Go Shopping
(mike)
S1
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
Action: Make Cake(x)
Make Cake
(mike)
S2
Pre.:
S3
Person(mike),
HasCake(mike)
Person(x)
HasMix(x)
Effects:HasCake(x)
-HasMix(x)
Or from S1 we could make a cake which would
change things.
Person(mike),
Hungry(mike)
The preconditions of the action are met...
And the effects cause one fluent to be made true...
And one to be made false.
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Person(mike),
HasMix(mike)
Initial
State
Wait
(mike)
S2
Wait
(mike)
Person(mike),
Hungry(mike)
Person(mike),
HasCake(mike)
S4
Person(mike),
HasMix(mike)
Action: Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:Hungry(x)
Or we could wait.
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Wait
(mike)
Initial
State
Wait
(mike)
S2
Action: Go Shopping (x)
Go Shopping
(mike)
Person(mike),
Hungry(mike)
Person(mike),
HasCake(mike)
Pre.:
Person(x)
Effects:HasMix(x)
S4
Person(mike),
HasMix(mike)
From S2 we can only go shopping. And that will
take us to S4 by another route.
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Wait
(mike)
Initial
State
Wait
(mike)
S5
Go Shopping
(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
Person(mike),
HasCake(mike)
S2
S4
Action: Go Shopping (x)
Pre.:
Person(x)
Effects:HasMix(x)
Go Shopping
(mike)
From S3 we can go shopping again.
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Wait
(mike)
Initial
State
S5
Go Shopping
(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
Eat Cake B
(mike)
S6
Person(mike),
HasCake(mike)
Action: Eat Cake B (x)
Wait
(mike)
S2
S4
Go Shopping
(mike)
Or we can eat the cake with action ’Eat Cake B’ (by
omission Mike is not hungry). This leads to a state with
no atomic fluents. Everything is negated. Including
’Person(mike)’: Mike is dead in this state!
Pre.:
Person(x)
-Hungry(x)
HasCake(x)
Effects: -Person(x),
-HasCake(x)
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Wait
(mike)
Initial
State
Wait
(mike)
S5
Go Shopping
(mike)
Eat Cake B
(mike)
S6
Person(mike),
HasCake(mike)
S2
S4
Go Shopping
(mike)
Or we can wait (and Mike lives...)
Person(mike),
HasMix(mike),
HasCake(mike)
S7
Wait
(mike)
Person(mike),
HasCake(mike),
Hungry(mike)
Action: Wait (x)
Pre.:
Person(x)
-Hungry(x)
Effects:Hungry(x)
Go Shopping
(mike)
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Eat Cake B
(mike)
S6
From S4 Wait
we can go shopping again, but that
Wait
doesn’t change
anything.
(mike)
(mike)
Initial
State
Wait
(mike)
S2
S5
Person(mike),
HasMix(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
S4
Go Shopping
(mike)
Action: Go Shopping (x)
Pre.:
Go Shopping
(mike)
Person(x)
Effects:HasMix(x)
Go Shopping
(mike)
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
Wait
(mike)
S2
Eat Cake B
(mike)
S6
S3
Wait
(mike)
Initial
State
Wait
(mike)
S4
Go Shopping
(mike)
Or we can make a cake, which takes us to S7
Go Shopping
(mike)
S5
Person(mike),
HasMix(mike),
HasCake(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
Make Cake
(mike)
Action: Make Cake(x)
Pre.:
Person(x)
HasMix(x)
Effects:HasCake(x)
Go Shopping
(mike)
Go Shopping
(mike)
Go Shopping
(mike)
Make Cake
(mike)
S1
S3
Wait
(mike)
Initial
State
Wait
(mike)
Eat Cake B
(mike)
S6
Wait
(mike)
S2
S4
Go Shopping
(mike)
Lets compress the diagram...
Go Shopping
(mike)
S5
Person(mike),
HasMix(mike),
HasCake(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
Make Cake
(mike)
Action: Make Cake(x)
Pre.:
Person(x)
HasMix(x)
Effects:HasCake(x)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
Initial
State
S1
S3
S2
S4
Lets compress the diagram...
S6
S7
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
Go Shopping
(mike)
Initial
State
S1
S3
S2
S4
S6
From S5, we can go shopping, changing
S7 nothing...
Person(mike),
HasCake(mike),
Hungry(mike)
Action: Go Shopping (x)
Pre.:
Person(x)
Effects:HasMix(x)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
S5
Go Shopping
(mike)
S1
Initial
State
S3
S6
Action: Make Cake(x)
Pre.:
Person(x)
HasMix(x)
Effects:HasCake(x)
S2
S4
From S5, we can make a cake... Leading back to S3, since we
cannot express that we have multiple
cakes.
S7
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
Eat Cake B
(mike)
S8
S5
HasMix(mike)
Go Shopping
Or we can eat the cake, leading to another way to kill Mike.
(mike)
S1
Initial
State
S3
S6
Action: Eat Cake B (x)
Pre.:
S2
S4
Person(x)
-Hungry(x)
HasCake(x)
S7
Effects: -Person(x),
-HasCake(x)
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
S5
Go Shopping
(mike)
Initial
State
S1
S3
S2
S4
Eat Cake B
(mike)
Wait
(mike)
S8
HasMix(mike)
S9
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
S6
Or we can wait.
Action: Wait (x)
S7
Pre.:
Person(x)
-Hungry(x)
Person(mike),
HasCake(mike),
Hungry(mike)
Effects:Hungry(x)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
Initial
State
S3
S2
S4
S8
S5
Go Shopping
(mike)
S1
Eat Cake B
(mike)
Wait
(mike)
S9
S6
We can’t do anything from S6, since all actions require
Person(mike).
S7
Person(mike),
HasCake(mike),
Hungry(mike)
HasMix(mike)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
Eat Cake B
(mike)
S8
S5
Go Shopping
(mike)
From S7, we can go shopping, leading to S9.
S1
S3
S6
Initial
State
S2
S4
Wait
(mike)
S9
HasMix(mike)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
Go Shopping
(mike)
Action: Go Shopping (x)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
Pre.:
Person(x)
Effects:HasMix(x)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
Initial
State
Eat Cake B
(mike)
S8
S5
Go Shopping Wait
(mike)
(mike)
Or we can eat the cake. This time we use ’Eat Cake
A’,
sinceS1Mike is hungry.
S3
S6
So this time he lives! (Yay)
S2
S9
Person(x)
Hungry(x)
HasCake(x)
Effects: Hungry(x)
-HasCake(x)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
Go Shopping
(mike)
S4
Action: Eat Cake A (x)
Pre.:
HasMix(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
S10
Eat Cake A
(mike)
Person(mike),
EatenCake(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
Make Cake
(mike)
Initial
State
S3
S2
S4
S8
S5
Go Shopping
(mike)
S1
Eat Cake B
(mike)
Wait
(mike)
S9
S6
Person(x)
Hungry(x)
HasCake(x)
Effects: Hungry(x)
-HasCake(x)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
Lets clear out the diagram
stop showing
Go(and
Shopping
actions)...
(mike)
Action: Eat Cake A (x)
Pre.:
HasMix(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
S10
Eat Cake A
(mike)
Person(mike),
EatenCake(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
Lets clear out the diagram (and stop showing
actions)...
S7
S10
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
EatenCake(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
S8 is another terminal node, since we killed off
Person(mike),
Mike.
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
S7
S10
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
EatenCake(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
At S9, we can go shopping but it does nothing.
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
S7
S10
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
EatenCake(mike)
Go Shopping
(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Or we can make another cake. But that takes us back
Person(mike),
to S7.
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
Make Cake
(mike)
S7
S10
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
EatenCake(mike)
Go Shopping
(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
Person(mike),
HasMix(mike),
EatenCake(mike)
Eat Cake A
(mike)
Go Shopping
(mike)
Make Cake
Or we can eat the cake using ’Eat Cake A’.
(mike)
S7
S10
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
EatenCake(mike)
S11
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
Make Cake
(mike)
S7
S10
Person(mike),
HasCake(mike),
Hungry(mike)
Person(mike),
EatenCake(mike)
Eat Cake A
(mike)
Person(mike),
HasMix(mike),
EatenCake(mike)
S11
Go Shopping
(mike)
Go Shopping
(mike)
At S10, we can go shopping, which also leads to S11.
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Person(mike),
HasMix(mike),
HasCake(mike),
Hungry(mike)
S9
S6
Or we can wait
Make Cake
(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
Eat Cake A
(mike)
S11
Go Shopping
(mike)
Go Shopping
(mike)
S10
Person(mike),
EatenCake(mike)
Person(mike),
HasMix(mike),
EatenCake(mike)
S12
Wait
(mike)
Person(mike),
HasMix(mike),
EatenCake(mike),
Hungry(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Finally, from S11 we can make a cake and reach a state
that satisfies the goal conditions!
Eat Cake A
Person(mike),
(mike)
HasMix(mike),
Person(mike),
HasMix(mike),
EatenCake(mike)
S11
HasCake(mike),
GoalHungry(mike)
conditions:
Make Cake
(mike)
Go Shopping
Person(mike)
S9
S6
(mike)
HasCake(mike),
GOAL!
EatenCake(mike) Go Shopping
Make Cake
(mike)
(mike)
-Hungry(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
S10
Person(mike),
EatenCake(mike)
S12
Wait
(mike)
Person(mike),
HasMix(mike),
EatenCake(mike),
Hungry(mike)
Person(mike),
HasMix(mike),
HasCake(mike)
S5
S8
HasMix(mike)
Finally, from S11 we can make a cake and reach a state
that satisfies the goal conditions!
Eat Cake A
Person(mike),
(mike)
HasMix(mike),
Person(mike),
HasMix(mike),
EatenCake(mike)
S11
HasCake(mike),
GoalHungry(mike)
conditions:
Make Cake
(mike)
Go Shopping
Person(mike)
S9
S6
(mike)
HasCake(mike),
GOAL!
EatenCake(mike) Go Shopping
Make Cake
(mike)
(mike)
-Hungry(mike)
S7
Person(mike),
HasCake(mike),
Hungry(mike)
S10
S12
We can do a few more thingsWait
from S12 that will take us
Person(mike),
back EatenCake(mike)
to other states, but lets(mike)
ignore them. Person(mike),
HasMix(mike),
EatenCake(mike),
Hungry(mike)
Backtrack to find mutliple paths/plans.
Make
Shop
Shop
Shop
Shop
S1
Wait
Shop
S3
S5
S9
Eat A
Make
I
Wait
Wait
Wait
S4
S2
Shop
S7
Make
S11
Shop
S10
Eat A
Shop
And we can backtrack though the graph (not the search
tree, which we didn’t show) to find possible paths.
Shop
G
Points to note

Naive searches are not going to scale.

Limitations regarding expression


Really for deterministic domains.

Can have difficulties with disjunctions (numerics a case in point).
Specifications of actions VERY important.

Can overcome expressive limitations

Can avoid pointless searching.

Loops in the search space

Orphan nodes in the search space

Potentially multiple goal nodes.

Potentially multiple paths from the initial state to a goal node.

Often due to the fact that we can perform the same steps in multiple orders.
Solving PDDL problems
Planning as Partial Ordering
A partial ordering is just a directed, acyclic graph.
Idea:
-
Make use of the ability to search backwards.
-
Deal with sets of actions that can be performed in multiple orders.
Planning as Partial Ordering: Basic Idea
THIS IS NOT A ROBUST ALGORITHM: IT REQUIRES CONSTRAINTS ON THE PROBLEM SPECIFICATION TO AVOID
ERRORS. IT IS HERE TO GIVE YOU AN IDEA OF PARTIAL ORDERED PLANNING.
1.
Enter initial state in a graph, and place the literals true at the initial state in a ’Base’ list.
2.
Enter the goal state in the graph, specifying the required literals. This is a list of ’open’ literals. Literals are
’closed’ by placing an arrow to them from an action node or the initial state node.
3.
While there are open literals remaining that can be closed:
4.
I.
If there are open literals that are in the base list or any effect lists, close them by drawing an arrow
from the initial state/action to the literals.
II.
If there are open literals which are the effect of actions:
1.
Select an action whose effects are consistent with the other literals in the specific list.
2.
Placing it as a node on the graph.
3.
Place the effects of the action in a effect list.
4.
Close the open literal by drawing an arrow from the relevant item in the effect list to the literal.
5.
Then place the preconditions for the action is a new list of open literals.
If the above terminates with open literals remaining, backtrack and try to use different actions. (You would
want to choose routes cleverly in real problems.)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
We set up:
• The base list from the initial state
• The initial open literal list from
the goal state .
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
We can immediately close two
literals in the goal list, since they are
present in the base list.
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Now we want to close
’EatenCake(mike)’. Only ’Eat Cake A’
can do this, so we add this action...
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Now we want to close
’EatenCake(mike)’. Only ’Eat Cake A’
can do this, so we add this action...
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
From the effects list of the ’Eat Cake
A’ action, we can close
’EatenCake(mike)’.
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
And we close the ’Person(mike)’
literal on the new open literal list,
since it is present in the base list.
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Now we want to close
’HasCake(mike)’. Only ’Make Cake’
can do this, so we add this action and
use it to remove the literal.
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
And we close what we can from the
new open literal list.
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
We want to close ’HasCake(mike)’
again, but in a different list. So we
add ’Make Cake’ again...
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
And we close the open literal
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
And we close what we can from the
new open literal list.
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Lets close both open ’HasMix’ literals
with two seperate ’GoShopping’
actions.
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Lets close both open ’HasMix’ literals
with two seperate ’GoShopping’
actions.
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
We can close the open literals on
these new lists directly from the base
list. So these paths are completed.
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
This leaves us wanting to close
’Hungry(mike)’, so we add the ’Wait’
action.
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
-Hungry(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
Hungry(mike)
This leaves us wanting to close
’Hungry(mike)’, so we add the ’Wait’
action.
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
EatenCake(mike)
-Hungry(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Base list:
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Person(mike)
-Hungry(mike)
Person(mike)
HasCake(mike)
Hungry(mike)
Hungry(mike)
EatenCake(mike)
-Hungry(mike)
Now we can close the remaining
open literals from the base list and
we are done!
Person(mike)
HasMix(mike)
Person(mike)
HasMix(mike)
HasCake(mike)
Goal:
Person(mike),
-Hungry(mike),
EatenCake(mike),
HasCake(mike)
Initial state
Go Shopping
(mike)
Make Cake (mike)
Go Shopping (mike)
Wait (mike)
Eat Cake A (mike)
Using action names, here is our
partial order plan...
Make Cake (mike)
Goal
Initial state
Go Shopping
(mike)
Make Cake (mike)
Go Shopping (mike)
Wait (mike)
Eat Cake A (mike)
We can perform actions in any order
that does not violate the partial
order given here.
Make Cake (mike)
Goal
Note: Avoid extra work
Although we didn’t see it in our
example, we can close open
literals from previously placed
actions.
Base List
HasHammer(mike)
Unattached(poster)
Unattached(painting)
Goal:
Attached(painting)
Attached(poster)
Note: Avoid extra work
Although we didn’t see it in our
example, we can close open
literals from previously placed
actions.
Base List
HasHammer(mike)
Unattached(poster)
Unattached(painting)
HasTape(mike)
Unattached(poster)
Attached(poster)
-HasTape(mike)
Add ’TapePoster(mike,poster)’ action.
Goal:
Attached(painting)
Attached(poster)
Note: Avoid extra work
Although we didn’t see it in our
example, we can close open
literals from previously placed
actions.
Base List
HasHammer(mike)
Unattached(poster)
Unattached(painting)
Add ’NailPainting(mike,painting)’ action.
HasTape(mike)
Unattached(poster)
Attached(poster)
-HasTape(mike)
HasNail(mike)
HasHammer(mike)
Unattached(painting)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Note: Avoid extra work
Although we didn’t see it in our
example, we can close open
literals from previously placed
actions.
Add ’GetSupplies(mike)’ action.
Base List
HasHammer(mike)
Unattached(poster)
Unattached(painting)
HasNail(mike)
HasTape(mike)
HasTape(mike)
Unattached(poster)
Attached(poster)
-HasTape(mike)
HasNail(mike)
HasHammer(mike)
Unattached(painting)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Note: Avoid extra work
Although we didn’t see it in our
example, we can close open
literals from previously placed
actions.
Use it to close open literals in
both ’TapePoster(mike,poster)
and ’NailPainting(mike,painting)’
actions.
Base List
HasHammer(mike)
Unattached(poster)
Unattached(painting)
HasNail(mike)
HasTape(mike)
HasTape(mike)
Unattached(poster)
Attached(poster)
-HasTape(mike)
HasNail(mike)
HasHammer(mike)
Unattached(painting)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Improvements to the algorithm
THESE IMPROVEMENTS SHOW HOW THE BASIC ALGORITHM CAN BE ADDED TO
IN ORDER TO MAKE IT MORE ROBUST IN CERTAIN CIRCUMSTANCES. THEY ARE
NOT A COMPREHENSIVE LIST OF DEVELOPING A POP PLANNER THAT CAN DEAL
WITH ANY PDDL PROBLEM. IF YOU WANT TO IMPLEMENT A POP PLANNER YOU
STILL NEED TO THINK CAREFULLY ABOUT PROBLEM SPECIFICATION. YOU
SHOULD RESEARCH THE LITERATURE TO SEE HOW OTHERS HAVE DEALT WITH
THESE ISSUES.
 Dealing with unchanging fluents
 Dealing with expended fluents
Dealing with unchanging fluents
To get the partial order we produced, we ignored that arrows were going from
the initial state to all states. This was because Person(mike) was being satisfied
at all actions and the goal by the base list.
It would not have mattered to have extra links from the initial state to all states.
But it would be cluttered.
You can work out when links can be dropped by examining the actions in the
partial order for preconditions that are not effected by the action
Dealing with expended fluents
Problem:
The graph on the right will
terminate using our basic
algorithm.
Base List
HasNail(mike)
But while we can do either
action from the origin, we
cannot do both.
HasNail(mike)
Attached(poster)
-HasNail(mike)
HasNail(mike)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Dealing with expended fluents
Problem:
The graph on the right will
terminate using our basic
algorithm.
Base List
HasNail(mike)
But while we can do either
action from the origin, we
cannot do both.
HasNail(mike)
Attached(poster)
-HasNail(mike)
HasNail(mike)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Dealing with expended fluents
Solution:
Track the inconsistencies
between the preconditions and
effects of an action to close
open fluents.
Close base literals/effects if
they are effected by an action
that they are used to supply the
preconditions for.
Base List
HasNail(mike)
HasNail(mike)
Attached(poster)
-HasNail(mike)
HasNail(mike)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Dealing with expended fluents
Solution:
Track the inconsistencies
between the preconditions and
effects of an action to close
open fluents.
Close base literals/effects if
they are effected by an action
that they are used to supply the
preconditions for.
Base List
HasNail(mike)
HasNail(mike)
Attached(poster)
-HasNail(mike)
HasNail(mike)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Dealing with expended fluents
Solution:
Track the inconsistencies
between the preconditions and
effects of an action to close
open fluents.
Close base literals/effects if
they are effected by an action
that they are used to supply the
preconditions for.
Base List
HasNail(mike)
HasNail(mike)
Attached(poster)
-HasNail(mike)
HasNail(mike)
Attached(painting)
-HasNail(mike)
Goal:
Attached(painting)
Attached(poster)
Planning Graphs
Planning Graphs
 Directed graphs, organized into alternating state and action levels:
s0,a0,s1,a1...sn.
 Each action at ai is connected to its precondition at si and effects at si+1.
 Trivial ’no-op’ actions are given for all literals. No-op action for literal P:
Preconditions: P
Effects: P
 Tracks (some) mutual exclusion relations.
Mutual Exclusion
Level ai contains all actions that can occur at level si and records mutual exclusion
links between incompatible actions. Two actions are recorded as incompatible if:
 Inconsistent effects – one action’s effect negates an effect of the other.
 Interference – one action’s effect is the negation of a precondition of the other.
 Competing needs – a precondition for one action is marked as mutually
exclusive to a precondition for the other.
Level si+1 contains all literals could result from any subset of compatible actions at
level ai and records mutual exclusion links between incompatible literals. Two
literals are recorded as incompatible if:
 Contradictory – One is the negation of the other.
 Inconsistent support – If each possible pair of actions that could produce the
literals are mutually exclusive.
Note: Not all mutual exclusions are tracked. Literals can appear before they are
actually possible!
Planning Graph
S0
Person(mike)
-Hungry(mike)
-HasCake(mike)
-HasMix(mike)
-EatenCake(mike)
The first state layer has all the literals
true in the initial state.
Planning Graph
S0
S0
-Hungry(mike)
□
Go Shopping
Wait
□
Each action layer has all the actions that
could be perform given the first state
layer.
-HasCake(mike)
□
Actions point to their preconditions.
-HasMix(mike)
□
Trivial actions are represented by ’□’.
-EatenCake(mike)
□
Person(mike)
Planning Graph
S0
A0
S1
-Hungry(mike)
□
Go Shopping
Wait
□
-HasCake(mike)
□
-HasMix(mike)
□
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
-EatenCake(mike)
Person(mike)
Person(mike)
Hungry(mike)
-Hungry(mike)
Each state layer now
has all literals that are
the result of any action
in the previous action
later. Each state points
to the actions it is an
effect of.
Trivial actions ensure
that the state layers
are monotonically
increasing (we never
loose states).
Planning Graph
S0
A0
S1
-Hungry(mike)
□
Go Shopping
Wait
□
-HasCake(mike)
□
-HasMix(mike)
□
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
-EatenCake(mike)
Person(mike)
Person(mike)
Hungry(mike)
-Hungry(mike)
And we enter mutex
(mutual exclusion)
relations.
Two actions are
recorded as
incompatible if:
• one action’s effect
negates an effect of
the other.
• one action’s effect is
the negation of a
precondition of the
other.
• a precondition for
one action is marked
as exclusive to a
precondition for the
other.
Planning Graph
S0
A0
S1
-Hungry(mike)
□
Go Shopping
Wait
□
-HasCake(mike)
□
-HasMix(mike)
□
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
-EatenCake(mike)
Person(mike)
Person(mike)
Hungry(mike)
-Hungry(mike)
And we enter mutex
(mutual exclusion)
relations.
Two actions are
recorded as
incompatible if:
• one action’s effect
negates an effect of
the other.
• one action’s effect is
the negation of a
precondition of the
other.
• a precondition for
one action is marked
as exclusive to a
precondition for the
other.
Planning Graph
S0
A0
S1
-Hungry(mike)
□
Go Shopping
Wait
□
-HasCake(mike)
□
-HasMix(mike)
□
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
-EatenCake(mike)
Person(mike)
Person(mike)
Hungry(mike)
-Hungry(mike)
And we enter mutex
(mutual exclusion)
relations.
Two states are
recorded as
incompatible if:
• One is the negation
of the other.
• If each possible pair
of actions that
could produce the
literals are mutually
exclusive.
Planning Graph
S0
A0
S1
-Hungry(mike)
□
Go Shopping
Wait
□
-HasCake(mike)
□
-HasMix(mike)
□
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
-EatenCake(mike)
Person(mike)
Person(mike)
Hungry(mike)
-Hungry(mike)
And we enter mutex
(mutual exclusion)
relations.
Two states are
recorded as
incompatible if:
• One is the negation
of the other.
• If each possible pair
of actions that
could produce the
literals are mutually
exclusive.
Planning Graph
A1
S1
Person(mike)
Hungry(mike)
-Hungry(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
Go Shopping
□
□
Wait
□
□
□
Make Cake
□
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
And we proceed.
Note we can create
the graph iteratively...
And at each stage the
number of
actions/literals
increases...
Planning Graph
A1
S1
Person(mike)
Hungry(mike)
-Hungry(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
Go Shopping
□
□
Wait
□
□
□
Make Cake
□
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
Two actions are
recorded as
incompatible if:
• one action’s effect
negates an effect of
the other.
• one action’s effect
is the negation of a
precondition of the
other.
• a precondition for
one action is
marked as exclusive
to a precondition
for the other.
Planning Graph
A1
S1
Person(mike)
Hungry(mike)
-Hungry(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
Go Shopping
□
□
Wait
□
□
□
Make Cake
□
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
Two actions are
recorded as
incompatible if:
• one action’s effect
negates an effect of
the other.
• one action’s effect
is the negation of a
precondition of the
other.
• a precondition for
one action is
marked as
exclusive to a
precondition for
the other.
Planning Graph
A1
S1
Person(mike)
Hungry(mike)
-Hungry(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
Go Shopping
□
□
Wait
□
□
□
Make Cake
□
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
Two states are
recorded as
incompatible if:
• One is the negation
of the other.
• If each possible pair
of actions that
could produce the
literals are mutually
exclusive.
Planning Graph
A1
S1
Person(mike)
Hungry(mike)
-Hungry(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
Go Shopping
□
□
Wait
□
□
□
Make Cake
□
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
Two states are
recorded as
incompatible if:
• One is the negation
of the other.
• If each possible
pair of actions that
could produce the
literals are
mutually exclusive.
Planning Graph
A1
S1
Person(mike)
Hungry(mike)
-Hungry(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
□
Go Shopping
□
□
Wait
□
□
□
Make Cake
□
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
We continue in this
iterative fashion until
two consecutive levels
are identical.
At this point we say
the graph has ‘leveled
off’ and terminate.
What use are Planning Graphs?
1.
If any goal literal fails to appear in the final state level, then the problem is
unsolvable.
2.
The number of levels between a state and the presence of all goal literals
can be used to give an admissable heuristic (for, e.g. A*).
1.
The max-level heuristic given the number of levels until all goal literals are in the graph.
2.
The set-level heuristic given the number of levels until all goal literals are in the graph
AND there are no mutexs between any pair of goal literals.
This is unsurprising: We have effectively relaxed constraint on the problem, which is a general
way of obtaining heuristics.
3.
We can obtain a plan directly of the Planning Graph using the Graph
Planning Algorithm.
Graph Planning Algorithm
Set initial state as current state and then repeat until termination:
1.
While at least one goal literals is absent at current state, Sc, OR there exists
at least one mutex between goal literals:
Create the next action and state levels, Ac and Sc+1 and then set current state to Sc+1.
2.
Otherwise, run the GP-Termination algorithm to see if the algorithm
terminated. If it does not, create the next action and state levels, Ac and
Sc+1 and set the current state to Sc+1.
GP-Termination Algorithm
1.
Set the last level of the planning graph as the initial state for a new search, and initialize a
list of literals to be satisfied from the goal state of the planning problem.
2.
The actions available in a state at level Si are any non-mutually exclusive sub-set of the
actions whose preconditions are themselves non-mutually exclusive.
3.
When transitioning from one state to another, the new state has as its goal list the set of
preconditions for actions involved in the transition.
4.
If a state is found with an empty goal list, a solution path has been found and we
termination with success.
5.
If no such state exists, no solution is currently possible and we record which goals were
unsatisfiable from the initial level. (This is used in terminating the algorithm with a failure
- see below - but we can also use this to terminate fruitless searches at later iterations.)
6.
If Sc = Sc-1 AND the goals that were unsatisfiable at Sc are the same as those that were
unsatisfiable at Sc-1 then we terminate with failure.
Planning Graph
A2
S2
Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
-EatenCake(mike)
S3
□
Go Shopping
Wait
Make Cake
Eat Cake A
Eat Cake B
□
□
□
□
□
□
□
Person(mike)
-Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
EatenCake(mike)
-EatenCake(mike)
Planning Graph
We’ll do one more level, but stop showing arrows
for trivial actions. We use line alignment instead.
A2
S2
S3
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
□
Go Shopping
Wait
Make Cake
Eat Cake A
Eat Cake B
□
□
□
□
□
□
-EatenCake(mike)
□
Person(mike)
Person(mike)
-Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
EatenCake(mike)
-EatenCake(mike)
‘Eat Cake B’ is mutex with all other nontrivial actions, since it kills Mike.
Planning Graph
A2
S2
S3
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
□
Go Shopping
Wait
Make Cake
Eat Cake A
Eat Cake B
□
□
□
□
□
□
-EatenCake(mike)
□
Person(mike)
Person(mike)
-Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
EatenCake(mike)
-EatenCake(mike)
Planning Graph
S2
A2
There are probably more
mutexs at S3. But
□
Person(mike)
I’ve
had enough!
Go Shopping
All goal literals (indeed all literalsWait
period) are
Make
in S3. So the heuristic value for
the Cake
origin,
using the max-level heuristic,Eat
is 3.Cake A
Eat Cake B
Hungry(mike)
The
literals of the goal state have□
mutexes
-Hungry(mike)
between
them. So we would not □
yet be
□
HasCake(mike)
ready
to backtrack in the Graph Planning
-HasCake(mike)
algorithm. Nor would we be able □
to calculate
□
HasMix(mike)
the
set-level heuristic.
□
-HasMix(mike)
-EatenCake(mike)
□
S3
Person(mike)
-Person(mike)
Hungry(mike)
-Hungry(mike)
HasCake(mike)
-HasCake(mike)
HasMix(mike)
-HasMix(mike)
EatenCake(mike)
-EatenCake(mike)