Planning Russell and Norvig Chapter 11 CS 121

  • Slides: 40
Download presentation
Planning Russell and Norvig: Chapter 11 CS 121 – Winter 2003

Planning Russell and Norvig: Chapter 11 CS 121 – Winter 2003

Planning Agent sensors ? environment agent actuators A 1 A 2 A 3

Planning Agent sensors ? environment agent actuators A 1 A 2 A 3

Goal of Planning • Supposeactions that the goal is HAVE(MILK). Choose to achieve a

Goal of Planning • Supposeactions that the goal is HAVE(MILK). Choose to achieve a certain goal • From some initial state where HAVE(MILK) is not But isn’t the it exactly same as for satisfied, successorthe function mustgoal be repeatedly applied to solving? eventually generate a state where problem HAVE(MILK) is satisfied. Some difficulties with problem solving: • An explicit representation of the possible actions their effects would help the The successor function is aproblem black solver box: it select actions mustthe berelevant “applied” to a state to know which actions are possible inworld that an state and what Otherwise, in the real agent would are thebeeffects of each overwhelmed by one irrelevant actions nand

Goal of Planning Suppose that the goal HAVE(MILK) HAVE(BOOK) Choose actions to isachieve a

Goal of Planning Suppose that the goal HAVE(MILK) HAVE(BOOK) Choose actions to isachieve a certain goal But isn’tanitexplicit exactly the sameofgoal as the for Without representation the goal, problem solver cannot know that a state where problem solving? HAVE(MILK) is already achieved is more promising Some with HAVE(MILK) problem solving: than a difficulties state where neither nor is achieved The goal test is another black-box function, states are domain-specific data structures, and heuristics must be supplied for each new problem n. HAVE(BOOK)

Goal of Planning Choose actions to achieve a certain goal HAVE(MILK) and HAVE(BOOK) may

Goal of Planning Choose actions to achieve a certain goal HAVE(MILK) and HAVE(BOOK) may be achieved by But isn’t it exactly the same goal as for two nearlysolving? independent sequences of actions problem Some difficulties with problem solving: n The goal may consist of several nearly independent subgoals, but there is no way for the problem solver to know it

Representations in Planning opens up the black-boxes by using logic to represent: Actions n

Representations in Planning opens up the black-boxes by using logic to represent: Actions n States n Goals n Problem solving Logic representation Planning One possible language: STRIPS

State Representation C A B TABLE Conjunction of propositions: BLOCK(A), BLOCK(B), BLOCK(C), ON(A, TABLE),

State Representation C A B TABLE Conjunction of propositions: BLOCK(A), BLOCK(B), BLOCK(C), ON(A, TABLE), ON(B, TABLE), ON(C, A), CLEAR(B), CLEAR(C), HANDEMPTY

Goal Representation C B A Conjunction of propositions: ON(A, TABLE), ON(B, A), ON(C, B)

Goal Representation C B A Conjunction of propositions: ON(A, TABLE), ON(B, A), ON(C, B) The goal G is achieved in a state S if all the propositions in G are also in S

Action Representation Unstack(x, y) • P = HANDEMPTY, BLOCK(x), BLOCK(y), CLEAR(x), ON(x, y) •

Action Representation Unstack(x, y) • P = HANDEMPTY, BLOCK(x), BLOCK(y), CLEAR(x), ON(x, y) • E = HANDEMPTY, CLEAR(x), HOLDING(x), ON(x, y), CLEAR(y) Effect: list of literals Precondition: conjunction of propositions Means: Remove HANDEMPTY from state Means: Add HOLDING(x) to state

Example C A B BLOCK(A), BLOCK(B), BLOCK(C), ON(A, TABLE), ON(B, TABLE), ON(C, A), CLEAR(B),

Example C A B BLOCK(A), BLOCK(B), BLOCK(C), ON(A, TABLE), ON(B, TABLE), ON(C, A), CLEAR(B), CLEAR(C), HANDEMPTY Unstack(C, A) • P = HANDEMPTY, BLOCK(C), BLOCK(A), CLEAR(C), ON(C, A) • E = HANDEMPTY, CLEAR(C), HOLDING(C), ON(C, A), CLEAR(A)

Example C A B BLOCK(A), BLOCK(B), BLOCK(C), ON(A, TABLE), ON(B, TABLE), ON(C, A), CLEAR(B),

Example C A B BLOCK(A), BLOCK(B), BLOCK(C), ON(A, TABLE), ON(B, TABLE), ON(C, A), CLEAR(B), CLEAR(C), HANDEMPTY, HOLDING(C), CLEAR(A) Unstack(C, A) • P = HANDEMPTY, BLOCK(C), BLOCK(A), CLEAR(C), ON(C, A) • E = HANDEMPTY, CLEAR(C), HOLDING(C), ON(C, A), CLEAR(A)

Action Representation Unstack(x, y) • P = HANDEMPTY, BLOCK(x), BLOCK(y), CLEAR(x), ON(x, y) •

Action Representation Unstack(x, y) • P = HANDEMPTY, BLOCK(x), BLOCK(y), CLEAR(x), ON(x, y) • E = HANDEMPTY, CLEAR(x), HOLDING(x), ON(x, y), CLEAR(y) Stack(x, y) • P = HOLDING(x), BLOCK(y), CLEAR(y) • E = ON(x, y), CLEAR(y), HOLDING(x), CLEAR(x), HANDEMPTY Pickup(x) • P = HANDEMPTY, BLOCK(x), CLEAR(x), ON(x, TABLE) • E = HANDEMPTY, CLEAR(x), HOLDING(x), ON(x, TABLE) Put. Down(x) • P = HOLDING(x) • E = ON(x, TABLE), HOLDING(x), CLEAR(x), HANDEMPTY

Forward Planning B Pickup(B) C A B C B A C A Unstack(C, A))

Forward Planning B Pickup(B) C A B C B A C A Unstack(C, A)) Forward planning searches a space C C of word. C states B A B A In general, many actions are applicable B to a state huge branching factor A B C A C B A C

Relevant Action An action is relevant to a goal if one of its effects

Relevant Action An action is relevant to a goal if one of its effects matched a goal proposition Stack(B, A) n n P = HOLDING(B), BLOCK(A), CLEAR(A) E = ON(B, A), CLEAR(A), HOLDING(B), CLEAR(B), HANDEMPTY is relevant to ON(B, A), ON(C, B)

Regression of a Goal The regression of a goal G through an action A

Regression of a Goal The regression of a goal G through an action A is the weakest precondition R[G, A] such that: If a state S satisfies R[G, A] then: 1. The precondition of A is satisfied in S 2. Applying A to S yields a state that satisfies G

Example G = ON(B, A), ON(C, B) Stack(C, B) n n P = HOLDING(C),

Example G = ON(B, A), ON(C, B) Stack(C, B) n n P = HOLDING(C), BLOCK(B), CLEAR(B) E = ON(C, B), CLEAR(B), HOLDING(C), CLEAR(C), HANDEMPTY R[G, Stack(C, B)] = ON(B, A), HOLDING(C), BLOCK(B), CLEAR(B)

Example G = CLEAR(B), ON(C, B) Stack(C, B) n n P = HOLDING(C), BLOCK(B),

Example G = CLEAR(B), ON(C, B) Stack(C, B) n n P = HOLDING(C), BLOCK(B), CLEAR(B) E = ON(C, B), CLEAR(B), HOLDING(C), CLEAR(C), HANDEMPTY R[G, Stack(C, B)] = False

Computation of R[G, A] 1. If any element of G is deleted by A

Computation of R[G, A] 1. If any element of G is deleted by A then return False 2. G’ Precondition of A 3. For every element SG of G do If SG is not added by A then add SG to G’ 4. Return G’

Inconsistent Regression also called state constraints Inconsistency rules: G = ON(B, A), ON(C, B)

Inconsistent Regression also called state constraints Inconsistency rules: G = ON(B, A), ON(C, B) HOLDING(x) ON(y, x) False Stack(B, A) HOLDING(x) ON(x, y) False n n P =HOLDING(x) HOLDING(B), BLOCK(A), CLEAR(A) HOLDING(y) False E =Etc… ON(B, A), CLEAR(A), HOLDING(B), CLEAR(B), HANDEMPTY R[G, Stack(B, A)] = HOLDING(B), BLOCK(A), CLEAR(A), ON(C, B) impossible

Computation of R[G, A] 1. If any element of G is deleted by A

Computation of R[G, A] 1. If any element of G is deleted by A then return False 2. G’ Precondition of A 3. For every element SG of G do If SG is not added by A then add SG to G’ 4. If an inconsistency rule applies to G’ then return False 5. Return G’

Backward Chaining ON(B, A), ON(C, B) Stack(C, B) C A B ON(B, A), HOLDING(C),

Backward Chaining ON(B, A), ON(C, B) Stack(C, B) C A B ON(B, A), HOLDING(C), CLEAR(B) In general, there are much fewer actions relevant to a goal than there actions applicable to a state smaller branching factor than with forward planning

Backward Chaining ON(B, A), ON(C, B) Stack(C, B) ON(B, A), HOLDING(C), CLEAR(B) Pickup(C) C

Backward Chaining ON(B, A), ON(C, B) Stack(C, B) ON(B, A), HOLDING(C), CLEAR(B) Pickup(C) C A B ON(B, A), CLEAR(B), HANDEMPTY, CLEAR(C), ON(C, TABLE) Backward planning searches CLEAR(C), ON(C, TABLE), HOLDING(B), CLEAR(A) a space. Pickup(B) of goals Stack(B, A) CLEAR(C), ON(C, TABLE), CLEAR(A), HANDEMPTY, CLEAR(B), ON(B, TABLE) Putdown(C) CLEAR(A), CLEAR(B), ON(B, TABLE), HOLDING(C) Unstack(C, A) CLEAR(B), ON(B, TABLE), CLEAR(C), HANDEMPTY, ON(C, A)

Nonlinear Planning Both forward and backward planning methods commit to a total ordering on

Nonlinear Planning Both forward and backward planning methods commit to a total ordering on the selected actions Drawback: They do not take advantage Form of least commitment of possible (near) independence among subgoals Nonlinear planning: No unnecessary ordering among subgoals

Nonlinear Planning P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY

Nonlinear Planning P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY P: ON(B, A) ON(C, B) -: +:

Open preconditions The plan is incomplete P: HOLDING(B) CLEAR(A) -: CLEAR(A) HOLDING(B) +: ON(B,

Open preconditions The plan is incomplete P: HOLDING(B) CLEAR(A) -: CLEAR(A) HOLDING(B) +: ON(B, A) CLEAR(B) HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY P: ON(B, A) ON(C, B) -: +:

P: HOLDING(B) CLEAR(A) -: CLEAR(A) HOLDING(B) +: ON(B, A) CLEAR(B) HANDEMPTY Stack(B, A) P:

P: HOLDING(B) CLEAR(A) -: CLEAR(A) HOLDING(B) +: ON(B, A) CLEAR(B) HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) P: HOLDING(C) CLEAR(B) -: CLEAR(B) HOLDING(C) +: ON(C, B) CLEAR(C) HANDEMPTY P: ON(B, A) ON(C, B) -: +:

Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY

Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Nonlinear planning searches a plan space Stack(C, B) Pickup(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) Other possible achiever Stack(B, A) Achievers Threat P: -: +: ON(A, TABLE) ON(B,

Pickup(B) Other possible achiever Stack(B, A) Achievers Threat P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) P: CLEAR(B) Pickup(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) P: CLEAR(B) Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A)

Pickup(B) P: CLEAR(B) Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) P: CLEAR(B) Pickup(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) A consistent plan is one in which there is no cycle and no

Pickup(B) A consistent plan is one in which there is no cycle and no conflict between achievers and threats Stack(B, A) A conflict can be eliminated by constraining the ordering among the actions or by Stack(C, B) adding new actions P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) Note the similarity with constraint propagation HANDEMPTY Pickup(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) P: HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A)

Pickup(B) P: HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) Pickup(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) P: HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A)

Pickup(B) P: HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) Pickup(C) P: HANDEMPTY P: ON(B, A) ON(C, B) -: +:

~ Most-constrained-variable Pickup(B) heuristic in CSP choose the unachieved P: HANDEMPTY precondition that can

~ Most-constrained-variable Pickup(B) heuristic in CSP choose the unachieved P: HANDEMPTY precondition that can be CLEAR(B) ON(B, TABLE) satisfied in the fewest number of ways Stack(B, A) P: HOLDING(B) ON(C, TABLE) CLEAR(A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) P: ON(B, A) ON(C, B) P: HOLDING(C) -: +: CLEAR(B) Pickup(C) P: HANDEMPTY CLEAR(C) ON(C, TABLE)

Pickup(B) Stack(B, A) Stack(C, B) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A)

Pickup(B) Stack(B, A) Stack(C, B) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Pickup(C) Putdown(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C)

Pickup(B) Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) Unstack(C, A) Pickup(C) Putdown(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) P: HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A)

Pickup(B) P: HANDEMPTY Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) Unstack(C, A) Pickup(C) Putdown(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C)

Pickup(B) Stack(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY Stack(C, B) Unstack(C, A) Pickup(C) Putdown(C) P: ON(B, A) ON(C, B) -: +:

Pickup(B) P: HANDEMPTY CLEAR(B) ON(B, TABLE) The plan is complete because every Stack(B, A)

Pickup(B) P: HANDEMPTY CLEAR(B) ON(B, TABLE) The plan is complete because every Stack(B, A) precondition of every step is added P: HOLDING(B) CLEAR(A) by some previous step, and no P: HANDEMPTY intermediate step deletes it CLEAR(C) Stack(C, B) P: ON(B, A) P: -: +: ON(A, TABLE) ON(B, TABLE) ON(C, A) CLEAR(B) CLEAR(C) HANDEMPTY ON(C, A) Unstack(C, A) P: HOLDING(C) -: +: CLEAR(B) Pickup(C) Putdown(C) P: HANDEMPTY P: HOLDING(C) CLEAR(C) ON(C, TABLE) ON(C, B)

Applications of Planning Military operations Construction Most appliedtasks systems use extended Machining tasks languages,

Applications of Planning Military operations Construction Most appliedtasks systems use extended Machining tasks languages, nonlinear representation planning techniques, Mechanical assemblyand domain-specific heuristics Design of experiments in genetics Command sequences for satellite

Summary Representations in planning Representation of action: preconditions + effects Forward planning Regression of

Summary Representations in planning Representation of action: preconditions + effects Forward planning Regression of a goal Backward planning Nonlinear planning