1.19k likes | 1.37k Views
Lecture 4. Planning. Lecture Plan. Planning: PDDL Partial Order Planning Planning Graphs and the Graph Plan Algorithm. PDDL: Planning Domain Definition Language. States Actions Goal. PDDL: Planning Domain Definition Language. States
E N D
Lecture 4 Planning
Lecture Plan • Planning: • PDDL • Partial Order Planning • 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. • Unique names assumption • Closed-world assumption • Domain closure • Actions • Goal
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
How actions function as transitions: State 1 State 2 Action • Preconditions: Set, , of literals, where: • . • Effects: Set, , of literals. State 2: Set, ), of Atomic Fluents State 1: Set, F, 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 • An initial state • 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) • A goal specification.
PDDL Problems as Search • 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. • 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 A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Satisfied Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Satisfied by omission Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Unsatisfied Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Unsatisfied Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Unsatisfied Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Unsatisfied Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Satisfied Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Initial State Satisfied (the second by omission). Person(mike)
Action: Eat Cake A (x) Pre.: Person(x) Hungry(x), HasCake(x) Effects: -HasCake(x), EatenCake(x), -Hungry(x) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x), HasCake(x) Effects: -HasCake(x) -Person(x) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Goal Pre.: Person(mike), -Hungry(mike), HasCake(mike), EatenCake(mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) S1 Go Shopping (mike) Person(mike), HasMix(mike) Initial State S2 Wait (mike) Person(mike) Person(mike), Hungry(mike)
Go Shopping (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Go Shopping (mike) S1 Initial State Person(mike), HasMix(mike) At the next step, from S1 we could go shopping again. But it wouldn’t change anything. S2 Wait (mike) Person(mike), Hungry(mike)
Go Shopping (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Go Shopping (mike) S1 Initial State Person(mike), HasMix(mike) At the next step, from S1 we could go shopping again. But it wouldn’t change anything. S2 Wait (mike) The preconditions of the action are met... Person(mike), Hungry(mike)
Go Shopping (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Go Shopping (mike) S1 Initial State Person(mike), HasMix(mike) At the next step, from S1 we could go shopping again. But it wouldn’t change anything. S2 Wait (mike) The preconditions of the action are met... Person(mike), Hungry(mike) But the effects are already true at this state.
Go Shopping (mike) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Make Cake (mike) Go Shopping (mike) S1 S3 Initial State Person(mike), HasMix(mike) Person(mike), HasCake(mike) S2 Wait (mike) Or from S1 we could make a cake which would change things. Person(mike), Hungry(mike)
Go Shopping (mike) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Make Cake (mike) Go Shopping (mike) S1 S3 Initial State Person(mike), HasMix(mike) Person(mike), HasCake(mike) S2 Wait (mike) 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) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Make Cake (mike) Go Shopping (mike) S1 S3 Initial State Person(mike), HasMix(mike) Person(mike), HasCake(mike) S2 Wait (mike) 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) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) -HasMix(x) Make Cake (mike) Go Shopping (mike) S1 S3 Initial State Person(mike), HasMix(mike) Person(mike), HasCake(mike) S2 Wait (mike) 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) Make Cake (mike) Go Shopping (mike) S1 S3 Initial State Person(mike), HasMix(mike) Person(mike), HasCake(mike) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Wait (mike) S2 S4 Wait (mike) Person(mike), Hungry(mike) Person(mike), HasMix(mike) Or we could wait.
Go Shopping (mike) Make Cake (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Go Shopping (mike) S1 S3 Initial State Wait (mike) Person(mike), HasCake(mike) Go Shopping (mike) S2 S4 Wait (mike) Person(mike), Hungry(mike) Person(mike), HasMix(mike) From S2 we can only go shopping. And that will take us to S4 by another route.
Go Shopping (mike) S5 Person(mike), HasMix(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Go Shopping (mike) S1 S3 Initial State Wait (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Person(mike), HasCake(mike) S2 S4 Wait (mike) Go Shopping (mike) From S3 we can go shopping again.
Go Shopping (mike) S5 Person(mike), HasMix(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Eat Cake B (mike) Go Shopping (mike) S1 S3 S6 Initial State Wait (mike) Person(mike), HasCake(mike) Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x) HasCake(x) Effects: -Person(x), -HasCake(x) S2 S4 Wait (mike) 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!
Go Shopping (mike) S5 Person(mike), HasMix(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Eat Cake B (mike) Go Shopping (mike) S1 S3 S6 Initial State Wait (mike) Person(mike), HasCake(mike) S7 Person(mike), HasCake(mike), Hungry(mike) Wait (mike) S2 S4 Wait (mike) Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) Go Shopping (mike) Or we can wait (and Mike lives...)
Go Shopping (mike) S5 Person(mike), HasMix(mike) Go Shopping (mike) Make Cake (mike) Eat Cake B (mike) Go Shopping (mike) S1 S3 S6 Initial State From S4 we can go shopping again, but that doesn’t change anything. Wait (mike) Wait (mike) S7 Person(mike), HasCake(mike), Hungry(mike) S2 S4 Wait (mike) Go Shopping (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Go Shopping (mike)
Go Shopping (mike) S5 Person(mike), HasMix(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Eat Cake B (mike) Go Shopping (mike) S1 S3 S6 Initial State Wait (mike) Wait (mike) S7 Person(mike), HasCake(mike), Hungry(mike) S2 S4 Make Cake (mike) Wait (mike) Go Shopping (mike) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) Or we can make a cake, which takes us to S7 Go Shopping (mike)
Go Shopping (mike) S5 Person(mike), HasMix(mike), HasCake(mike) Go Shopping (mike) Make Cake (mike) Eat Cake B (mike) Go Shopping (mike) S1 S3 S6 Initial State Wait (mike) Wait (mike) S7 Person(mike), HasCake(mike), Hungry(mike) S2 S4 Make Cake (mike) Wait (mike) Go Shopping (mike) Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) Lets compress the diagram... Go Shopping (mike)
Person(mike), HasMix(mike), HasCake(mike) S5 S1 S3 S6 Initial State S2 S4 S7 Lets compress the diagram... Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) S5 Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) Go Shopping (mike) S1 S3 S6 Initial State S2 S4 S7 From S5, we can go shopping, changing nothing... Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) Make Cake (mike) S5 Action: Make Cake(x) Pre.: Person(x) HasMix(x) Effects: HasCake(x) Go Shopping (mike) S1 S3 S6 Initial State 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) Eat Cake B (mike) Make Cake (mike) S8 S5 HasMix(mike) Go Shopping (mike) Or we can eat the cake, leading to another way to kill Mike. S1 S3 S6 Initial State Action: Eat Cake B (x) Pre.: Person(x) -Hungry(x) HasCake(x) Effects: -Person(x), -HasCake(x) S2 S4 S7 Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) Eat Cake B (mike) Make Cake (mike) S8 S5 HasMix(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S9 Go Shopping (mike) Wait (mike) S1 S3 S6 Initial State Or we can wait. S2 S4 Action: Wait (x) Pre.: Person(x) -Hungry(x) Effects: Hungry(x) S7 Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) Eat Cake B (mike) Make Cake (mike) S8 S5 HasMix(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S9 Go Shopping (mike) Wait (mike) S1 S3 S6 Initial State S2 S4 We can’t do anything from S6, since all actions require Person(mike). S7 Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) Eat Cake B (mike) Make Cake (mike) S8 S5 HasMix(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S9 Go Shopping (mike) Wait (mike) From S7, we can go shopping, leading to S9. S1 S3 S6 Initial State S2 S4 Go Shopping (mike) Action: Go Shopping (x) Pre.: Person(x) Effects: HasMix(x) S7 Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) Eat Cake B (mike) Make Cake (mike) S8 S5 HasMix(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S9 Go Shopping (mike) Wait (mike) Or we can eat the cake. This time we use ’Eat Cake A’, since Mike is hungry. So this time he lives! (Yay) S1 S3 S6 Initial State S2 S4 Go Shopping (mike) Action: Eat Cake A (x) Pre.: Person(x) Hungry(x) HasCake(x) Effects: Hungry(x) -HasCake(x) Person(mike), EatenCake(mike) S7 S10 Eat Cake A (mike) Person(mike), HasCake(mike), Hungry(mike)
Person(mike), HasMix(mike), HasCake(mike) Eat Cake B (mike) Make Cake (mike) S8 S5 HasMix(mike) Person(mike), HasMix(mike), HasCake(mike), Hungry(mike) S9 Go Shopping (mike) Wait (mike) S1 S3 S6 Initial State Lets clear out the diagram (and stop showing actions)... S2 S4 Go Shopping (mike) Action: Eat Cake A (x) Pre.: Person(x) Hungry(x) HasCake(x) Effects: Hungry(x) -HasCake(x) Person(mike), EatenCake(mike) S7 S10 Eat Cake A (mike) Person(mike), HasCake(mike), Hungry(mike)