Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4 Planning. Lecture Plan 1. Planning: I. PDDL II. Partial Order Planning III. Planning Graphs and the Graph Plan Algorithm.

Similar presentations


Presentation on theme: "Lecture 4 Planning. Lecture Plan 1. Planning: I. PDDL II. Partial Order Planning III. Planning Graphs and the Graph Plan Algorithm."— Presentation transcript:

1 Lecture 4 Planning

2 Lecture Plan 1. Planning: I. PDDL II. Partial Order Planning III. Planning Graphs and the Graph Plan Algorithm

3 PDDL: Planning Domain Definition Language  States  Actions  Goal

4 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. Unique names assumption Closed-world assumption Domain closure  Actions  Goal

5 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. Where an action has non-trivial effects, this causes us to transition to a new state.  Goal

6 How actions function as transitions: State 1 Action State 2 State 1: Set, F, of Atomic Fluents

7 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.

8 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.

9 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.

10 PDDL Example: Initial State Initial state: Person (mike)

11 PDDL Example: Actions Action:Go Shopping (x) Preconditions:Person(x) Effects:HasMix(x)

12 PDDL Example: Actions Action:Make Cake(x) Preconditions:Person(x) HasMix (x) Effects:HasCake(x)

13 PDDL Example: Actions Action:Wait(x) Preconditions:Person(x), -Hungry(x) Effects: Hungry(x)

14 PDDL Example: Actions Action:Eat Cake A (x) Preconditions:Person(x), Hungry(x), HasCake(x) Effects:-HasCake(x), -Hungry(x), EatenCake(x)

15 PDDL Example: Actions Action:Eat Cake B (x) Preconditions:Person(x), -Hungry(x), HasCake(x) Effects:-HasCake(x), -Person(x)

16 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)

17 Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Initial State Person(mike)

18 Initial State Person(mike) Satisfied Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

19 Initial State Person(mike) Satisfied by omission Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

20 Initial State Person(mike) Unsatisfied Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

21 Initial State Person(mike) Unsatisfied Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

22 Initial State Person(mike) Unsatisfied Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

23 Initial State Person(mike) Unsatisfied Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

24 Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Initial State Person(mike) Satisfied

25 Initial State Person(mike) Satisfied (the second by omission). Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

26 Initial State Person(mike) Go Shopping (mike) Wait (mike) S1 Person(mike), HasMix(mike) S2 Person(mike), Hungry(mike) Action: Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Action: Eat Cake B (x) Pre.:Person(x) -Hungry(x), HasCake(x) Effects:-HasCake(x) -Person(x) Action: Eat Cake A (x) Pre.:Person(x) Hungry(x), HasCake(x) Effects:-HasCake(x), EatenCake(x), -Hungry(x) Action: Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Action: Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Goal Pre.:Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike)

27 Initial State Go Shopping (mike) Wait (mike) S1 S2 Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike ) At the next step, from S1 we could go shopping again. But it wouldn’t change anything. Person(mike), Hungry(mike )

28 Person(mike), Hungry(mike ) Initial State Go Shopping (mike) Wait (mike) S1 S2 Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike ) At the next step, from S1 we could go shopping again. But it wouldn’t change anything. The preconditions of the action are met...

29 Person(mike), Hungry(mike ) Initial State Go Shopping (mike) Wait (mike) S1 S2 Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike ) At the next step, from S1 we could go shopping again. But it wouldn’t change anything. The preconditions of the action are met... But the effects are already true at this state.

30 Person(mike), Hungry(mike ) Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Person(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Or from S1 we could make a cake which would change things. Person(mike), HasMix(mike )

31 Person(mike), Hungry(mike ) Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Person(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Or from S1 we could make a cake which would change things. Person(mike), HasMix(mike ) The preconditions of the action are met...

32 Person(mike), Hungry(mike ) Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Person(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Or from S1 we could make a cake which would change things. Person(mike), HasMix(mike ) The preconditions of the action are met... And the effects cause one fluent to be made true...

33 Person(mike), Hungry(mike ) Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) -HasMix(x) Person(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Or from S1 we could make a cake which would change things. Person(mike), HasMix(mike ) The preconditions of the action are met... And the effects cause one fluent to be made true... And one to be made false.

34 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Person(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) S4 Action:Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Person(mike), HasMix(mike) Wait (mike) Or we could wait. Person(mike), Hungry(mike ) Person(mike), HasMix(mike )

35 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Person(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike) From S2 we can only go shopping. And that will take us to S4 by another route. Person(mike), Hungry(mike )

36 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) S5 Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike), HasCake(mike) From S3 we can go shopping again. Person(mike), HasCake(mike)

37 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) S5 Go Shopping (mike) S6 Action:Eat Cake B (x) Pre.:Person(x) -Hungry(x) HasCake(x) Effects:-Person(x), -HasCake(x) Eat Cake B (mike) Person(mike), HasMix(mike), HasCake(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! Person(mike), HasCake(mike)

38 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) S5 Go Shopping (mike) S6 Action:Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) Eat Cake B (mike) S7 Person(mike), HasCake(mike), Hungry(mike) Wait (mike) Person(mike), HasMix(mike), HasCake(mike) Or we can wait (and Mike lives...) Person(mike), HasCake(mike)

39 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) S5 Go Shopping (mike) S6 Eat Cake B (mike) S7 Person(mike), HasCake(mike), Hungry(mike) Wait (mike) Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike) From S4 we can go shopping again, but that doesn’t change anything.

40 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) S5 Go Shopping (mike) S6 Eat Cake B (mike) S7 Person(mike), HasCake(mike), Hungry(mike) Wait (mike) Go Shopping (mike) Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) Make Cake (mike) Person(mike), HasMix(mike), HasCake(mike) Or we can make a cake, which takes us to S7

41 Initial State Go Shopping (mike) Wait (mike) S1 S2 S3 Go Shopping (mike) Make Cake (mike) S4 Go Shopping (mike) Wait (mike) S5 Go Shopping (mike) S6 Eat Cake B (mike) S7 Person(mike), HasCake(mike), Hungry(mike) Wait (mike) Go Shopping (mike) Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) Make Cake (mike) Person(mike), HasMix(mike), HasCake(mike) Lets compress the diagram...

42 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Person(mike), HasMix(mike), HasCake(mike) Lets compress the diagram...

43 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) Person(mike), HasMix(mike), HasCake(mike) From S5, we can go shopping, changing nothing...

44 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) Action:Make Cake(x) Pre.:Person(x) HasMix(x) Effects:HasCake(x) Make Cake (mike) Person(mike), HasMix(mike), HasCake(mike) From S5, we can make a cake... Leading back to S3, since we cannot express that we have multiple cakes.

45 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) S8 HasMix(mike) Make Cake (mike) Eat Cake B (mike) Action:Eat Cake B (x) Pre.:Person(x) -Hungry(x) HasCake(x) Effects:-Person(x), -HasCake(x) Person(mike), HasMix(mike), HasCake(mike) Or we can eat the cake, leading to another way to kill Mike.

46 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) S8 Make Cake (mike) Eat Cake B (mike) S9 Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Wait (mike) Action:Wait (x) Pre.:Person(x) -Hungry(x) Effects:Hungry(x) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Or we can wait.

47 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) S8 Make Cake (mike) Eat Cake B (mike) S9 Wait (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) We can’t do anything from S6, since all actions require Person(mike).

48 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) S8 Make Cake (mike) Eat Cake B (mike) S9 Wait (mike) Go Shopping (mike) Action:Go Shopping (x) Pre.:Person(x) Effects:HasMix(x) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) From S7, we can go shopping, leading to S9.

49 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) S8 Make Cake (mike) Eat Cake B (mike) S9 Wait (mike) Go Shopping (mike) Action:Eat Cake A (x) Pre.:Person(x) Hungry(x) HasCake(x) Effects:Hungry(x) -HasCake(x) S10 Person(mike), EatenCake(mike) Eat Cake A (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Or we can eat the cake. This time we use ’Eat Cake A’, since Mike is hungry. So this time he lives! (Yay)

50 Initial State S1 S2 S3 S4 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) Go Shopping (mike) S8 Make Cake (mike) Eat Cake B (mike) S9 Wait (mike) Go Shopping (mike) Action:Eat Cake A (x) Pre.:Person(x) Hungry(x) HasCake(x) Effects:Hungry(x) -HasCake(x) S10 Person(mike), EatenCake(mike) Eat Cake A (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Lets clear out the diagram (and stop showing actions)...

51 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 S10 Person(mike), EatenCake(mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Lets clear out the diagram (and stop showing actions)...

52 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 S10 Person(mike), EatenCake(mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S8 is another terminal node, since we killed off Mike.

53 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 S10 Person(mike), EatenCake(mike) Go Shopping (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) At S9, we can go shopping but it does nothing.

54 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 S10 Person(mike), EatenCake(mike) Go Shopping (mike) Make Cake (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Or we can make another cake. But that takes us back to S7.

55 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 S10 Person(mike), EatenCake(mike) Go Shopping (mike) S11 Eat Cake A (mike) Person(mike), HasMix(mike), EatenCake(mike) Make Cake (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Or we can eat the cake using ’Eat Cake A’.

56 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 S10 Person(mike), EatenCake(mike) Go Shopping (mike) Make Cake (mike) S11 Eat Cake A (mike) Go Shopping (mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) Person(mike), HasMix(mike), EatenCake(mike) At S10, we can go shopping, which also leads to S11.

57 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S10 Person(mike), EatenCake(mike) Go Shopping (mike) Make Cake (mike) S11 Eat Cake A (mike) Go Shopping (mike) S12 Wait (mike) Person(mike), HasMix(mike), EatenCake(mike), Hungry(mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), EatenCake(mike) Or we can wait

58 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S10 Person(mike), EatenCake(mike) Go Shopping (mike) Make Cake (mike) S11 Eat Cake A (mike) Go Shopping (mike) S12 Wait (mike) Person(mike), HasMix(mike), EatenCake(mike), Hungry(mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), EatenCake(mike) GOAL! Goal conditions: Person(mike) HasCake(mike), EatenCake(mike) -Hungry(mike) Finally, from S11 we can make a cake and reach a state that satisfies the goal conditions! Make Cake (mike)

59 S5 S6 S7 Person(mike), HasCake(mike), Hungry(mike) S8 S9 Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S10 Person(mike), EatenCake(mike) Go Shopping (mike) Make Cake (mike) S11 Eat Cake A (mike) Go Shopping (mike) S12 Wait (mike) Person(mike), HasMix(mike), EatenCake(mike), Hungry(mike) HasMix(mike) Person(mike), HasMix(mike), HasCake(mike) Person(mike), HasMix(mike), EatenCake(mike) GOAL! Goal conditions: Person(mike) HasCake(mike), EatenCake(mike) -Hungry(mike) Finally, from S11 we can make a cake and reach a state that satisfies the goal conditions! We can do a few more things from S12 that will take us back to other states, but lets ignore them. Make Cake (mike)

60 S11 G Make S9 Eat A S10 Shop S7 S5 Shop Wait Shop Eat A S3 Shop S4 Shop Make Wait Shop S1 Make Wait S2 Shop I Wait Backtrack to find mutliple paths/plans. And we can backtrack though the graph (not the search tree, which we didn’t show) to find possible paths.

61 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.

62 Solving PDDL problems

63 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.

64 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: 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. 4.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.)

65 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) 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.

66 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.

67 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...

68 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Now we want to close ’EatenCake(mike)’. Only ’Eat Cake A’ can do this, so we add this action...

69 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) From the effects list of the ’Eat Cake A’ action, we can close ’EatenCake(mike)’.

70 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) And we close the ’Person(mike)’ literal on the new open literal list, since it is present in the base list.

71 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) Person(mike) HasMix(mike) HasCake(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. EatenCake(mike) -Hungry(mike)

72 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) And we close what we can from the new open literal list.

73 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) We want to close ’HasCake(mike)’ again, but in a different list. So we add ’Make Cake’ again...

74 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) And we close the open literal

75 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) And we close what we can from the new open literal list.

76 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) Lets close both open ’HasMix’ literals with two seperate ’GoShopping’ actions.

77 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) Person(mike) HasMix(mike) Lets close both open ’HasMix’ literals with two seperate ’GoShopping’ actions.

78 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) Person(mike) HasMix(mike) We can close the open literals on these new lists directly from the base list. So these paths are completed.

79 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) Person(mike) HasMix(mike) This leaves us wanting to close ’Hungry(mike)’, so we add the ’Wait’ action.

80 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) Person(mike) HasMix(mike) Person(mike) -Hungry(mike) Hungry(mike) This leaves us wanting to close ’Hungry(mike)’, so we add the ’Wait’ action.

81 Goal: Person(mike), -Hungry(mike), EatenCake(mike), HasCake(mike) Base list: Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) Person(mike) HasCake(mike) Hungry(mike) EatenCake(mike) -Hungry(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) HasCake(mike) Person(mike) HasMix(mike) Person(mike) HasMix(mike) Person(mike) -Hungry(mike) Hungry(mike) Now we can close the remaining open literals from the base list and we are done!

82 Goal Initial state Using action names, here is our partial order plan... Go Shopping (mike) Make Cake (mike) Wait (mike) Make Cake (mike) Eat Cake A (mike)

83 Goal Initial state We can perform actions in any order that does not violate the partial order given here. Go Shopping (mike) Make Cake (mike) Wait (mike) Make Cake (mike) Eat Cake A (mike)

84 Note: Avoid extra work Although we didn’t see it in our example, we can close open literals from previously placed actions. Goal: Attached(painting) Attached(poster) Base List HasHammer(mike) Unattached(poster) Unattached(painting)

85 Note: Avoid extra work Although we didn’t see it in our example, we can close open literals from previously placed actions. HasTape(mike) Unattached(poster) Attached(poster) -HasTape(mike) Goal: Attached(painting) Attached(poster) Base List HasHammer(mike) Unattached(poster) Unattached(painting) Add ’TapePoster(mike,poster)’ action.

86 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) HasNail(mike) HasHammer(mike) Unattached(painting) Attached(painting) -HasNail(mike) HasTape(mike) Unattached(poster) Attached(poster) -HasTape(mike) Goal: Attached(painting) Attached(poster) Add ’NailPainting(mike,painting)’ action.

87 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 ’GetSupplies(mike)’ action. HasNail(mike) HasHammer(mike) Unattached(painting) Attached(painting) -HasNail(mike) HasNail(mike) HasTape(mike) Unattached(poster) Attached(poster) -HasTape(mike) Goal: Attached(painting) Attached(poster)

88 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) Use it to close open literals in both ’TapePoster(mike,poster) and ’NailPainting(mike,painting)’ actions. HasNail(mike) HasHammer(mike) Unattached(painting) Attached(painting) -HasNail(mike) HasNail(mike) HasTape(mike) Unattached(poster) Attached(poster) -HasTape(mike) Goal: Attached(painting) Attached(poster)

89 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

90 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

91 Dealing with expended fluents Problem: The graph on the right will terminate using our basic algorithm. But while we can do either action from the origin, we cannot do both. HasNail(mike) Attached(painting) -HasNail(mike) HasNail(mike) Attached(poster) -HasNail(mike) Goal: Attached(painting) Attached(poster) Base List HasNail(mike)

92 Dealing with expended fluents Problem: The graph on the right will terminate using our basic algorithm. But while we can do either action from the origin, we cannot do both. HasNail(mike) Attached(painting) -HasNail(mike) HasNail(mike) Attached(poster) -HasNail(mike) Goal: Attached(painting) Attached(poster) Base List HasNail(mike)

93 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. HasNail(mike) Attached(painting) -HasNail(mike) HasNail(mike) Attached(poster) -HasNail(mike) Goal: Attached(painting) Attached(poster) Base List HasNail(mike)

94 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. HasNail(mike) Attached(painting) -HasNail(mike) HasNail(mike) Attached(poster) -HasNail(mike) Goal: Attached(painting) Attached(poster) Base List HasNail(mike)

95 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. HasNail(mike) Attached(painting) -HasNail(mike) HasNail(mike) Attached(poster) -HasNail(mike) Goal: Attached(painting) Attached(poster) Base List HasNail(mike)

96 Planning Graphs

97  Directed graphs, organized into alternating state and action levels: s 0,a 0,s 1,a 1...s n.  Each action at a i is connected to its precondition at s i and effects at s i+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.

98 Mutual Exclusion Level a i contains all actions that can occur at level s i 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 s i+1 contains all literals could result from any subset of compatible actions at level a i 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!

99 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 The first state layer has all the literals true in the initial state.

100 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 Each action layer has all the actions that could be perform given the first state layer. Actions point to their preconditions. Trivial actions are represented by ’ □ ’. □ Go Shopping Wait □ S0S0

101 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 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). □ Go Shopping Wait □ A0A0 Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1

102 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 □ Go Shopping Wait □ A0A0 Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 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.

103 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 □ Go Shopping Wait □ A0A0 Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 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.

104 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 □ Go Shopping Wait □ A0A0 Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 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.

105 Planning Graph Person(mike) -Hungry(mike) -HasCake(mike) -HasMix(mike) -EatenCake(mike) S0S0 □ Go Shopping Wait □ A0A0 Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 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.

106 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 □ Go Shopping □ Wait □ Make Cake □ A1A1 And we proceed. Note we can create the graph iteratively... And at each stage the number of actions/literals increases... Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2

107 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 □ Go Shopping □ Wait □ Make Cake □ A1A1 Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 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.

108 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 □ Go Shopping □ Wait □ Make Cake □ A1A1 Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 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.

109 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 □ Go Shopping □ Wait □ Make Cake □ A1A1 Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 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.

110 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 □ Go Shopping □ Wait □ Make Cake □ A1A1 Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 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.

111 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S1S1 □ Go Shopping □ Wait □ Make Cake □ A1A1 Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 We continue in this iterative fashion until two consecutive levels are identical. At this point we say the graph has ‘leveled off’ and terminate.

112 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.

113 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, S c, OR there exists at least one mutex between goal literals: Create the next action and state levels, A c and S c+1 and then set current state to S c+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, A c and S c+1 and set the current state to S c+1.

114 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 S i 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 S c = S c-1 AND the goals that were unsatisfiable at S c are the same as those that were unsatisfiable at S c-1 then we terminate with failure.

115 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 □ Go Shopping Wait Make Cake Eat Cake A Eat Cake B □ A2A2 Person(mike) -Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) EatenCake(mike) -EatenCake(mike) S3S3

116 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 □ Go Shopping Wait Make Cake Eat Cake A Eat Cake B □ A2A2 Person(mike) -Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) EatenCake(mike) -EatenCake(mike ) S3S3 We’ll do one more level, but stop showing arrows for trivial actions. We use line alignment instead.

117 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 □ Go Shopping Wait Make Cake Eat Cake A Eat Cake B □ A2A2 Person(mike) -Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) EatenCake(mike) -EatenCake(mike ) S3S3 ‘Eat Cake B’ is mutex with all other non- trivial actions, since it kills Mike.

118 Planning Graph Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) -EatenCake(mike) S2S2 □ Go Shopping Wait Make Cake Eat Cake A Eat Cake B □ A2A2 Person(mike) -Person(mike) Hungry(mike) -Hungry(mike) HasCake(mike) -HasCake(mike) HasMix(mike) -HasMix(mike) EatenCake(mike) -EatenCake(mike ) S3S3 There are probably more mutexs at S 3. But I’ve had enough! All goal literals (indeed all literals period) are in S 3. So the heuristic value for the origin, using the max-level heuristic, is 3. The literals of the goal state have mutexes between them. So we would not yet be ready to backtrack in the Graph Planning algorithm. Nor would we be able to calculate the set-level heuristic.


Download ppt "Lecture 4 Planning. Lecture Plan 1. Planning: I. PDDL II. Partial Order Planning III. Planning Graphs and the Graph Plan Algorithm."

Similar presentations


Ads by Google