Скачать презентацию Planning Department of Computer Science Engineering Indian Скачать презентацию Planning Department of Computer Science Engineering Indian

841c8bd7e6b2e8e77a7c0b0b571b1db1.ppt

  • Количество слайдов: 16

Planning Department of Computer Science & Engineering Indian Institute of Technology Kharagpur CSE, IIT Planning Department of Computer Science & Engineering Indian Institute of Technology Kharagpur CSE, IIT Kharagpur

The Planning Problem Get a quart of milk and a bunch of bananas and The Planning Problem Get a quart of milk and a bunch of bananas and a cordless drill • Given: – Initial state: The agent is at home without milk, bananas, drill – Goal state: The agent is at home with milk, bananas, drill – States can be represented by predicates such as At(x), Have(y), Sells(x, y) – Actions: • Go(y) : Agent goes to y – causes At(y) to be true • Buy(z): Agent buys z – causes Have(z) to be true • Steal(z): Agent steals z CSE, IIT Kharagpur 2

Planning versus Problem Solving • Problems with using the problem solving techniques – Huge Planning versus Problem Solving • Problems with using the problem solving techniques – Huge state space and large branching factor • What do we do in planning? – Actions are represented by logical descriptions of preconditions and effects. This enables the planner to make direct connections between states and actions. – The planner is free to add actions to the plan wherever they are required, rather than incremental manner starting from the initial state. – Most parts of the world are independent of most other parts – hence dividing and conquer works well. CSE, IIT Kharagpur 3

Using Situation Calculus Initial state: At(Home, s 0) Have(Milk, s 0) Have(Bananas, s 0) Using Situation Calculus Initial state: At(Home, s 0) Have(Milk, s 0) Have(Bananas, s 0) Have(Drill, s 0) Goal state: s At(Home, s) Have(Milk, s) Have(Bananas, s) Have(Drill, s) Operators: a, s Have(Milk, Result(a, s)) [(a = Buy(Milk) At(Supermarket, s) (Have(Milk, s) a Drop(Milk))] Result(a, s) names the situation resulting from executing the action a in the situation s CSE, IIT Kharagpur 4

The STRIPS language • To make planning practical we need to: – Restrict the The STRIPS language • To make planning practical we need to: – Restrict the language with which we define problems. With a restrictive language, there are fewer possible solutions to search through – Use a special-purpose algorithm called a planner rather than a general purpose theorem prover. • STRIPS – STanford Research Institute Problem Solver – There are many more efficient planners today, but most of them use specification languages that are variants of the one used in STRIPS. CSE, IIT Kharagpur 5

Representation for states and goals • States are represented by conjunctions of function-free ground Representation for states and goals • States are represented by conjunctions of function-free ground literals At(Home) Have(Milk) Have(Bananas) Have(Drill) • Goals are also described by conjunctions of literals At(Home) Have(Milk) Have(Bananas) Have(Drill) • Goals can also contain variables At(x) Sells(x, Milk) • The above goal is being at a store that sells milk CSE, IIT Kharagpur 6

Representation for Actions • Action description – serves as a name for a possible Representation for Actions • Action description – serves as a name for a possible action • Precondition – a conjunction of positive literals (why positive? ) • Effect – a conjunction of literals (positive or negative) – The original version had an add list and a delete list. Op( ACTION: PRECOND: EFFECT: CSE, IIT Kharagpur Go(there), At(here) Path(here, there), At(there) At(here) ) 7

Representation for Plans • A set of plan steps. Each step is one of Representation for Plans • A set of plan steps. Each step is one of the operators for the problem. • A set of step ordering constraints. Each ordering constraint is of the form Si Sj, which means Si must occur sometime before Sj. • A set of variable binding constraints. Each variable constraint is of the form v = x, where v is a variable in some step, and x is either a constant or some other variable. • A set of causal links. A causal link is written as S c: S’ means S achieves the precondition c for S’. CSE, IIT Kharagpur which 8

Example • Actions Op( ACTION: Right. Shoe, PRECOND: Right. Sock. On, EFFECT: Right. Shoe. Example • Actions Op( ACTION: Right. Shoe, PRECOND: Right. Sock. On, EFFECT: Right. Shoe. On) Op( ACTION: Right. Sock, EFFECT: Right. Sock. On) Op( ACTION: Left. Shoe, PRECOND: Left. Sock. On, EFFECT: Left. Shoe. On) Op( ACTION: Left. Sock, EFFECT: Left. Sock. On) • Initial plan Plan( STEPS: { S 1: Op( S 2: Op( ACTION: start ), ACTION: finish, PRECOND: Right. Shoe. On Left. Shoe. On ) }, ORDERINGS: {S 1 S 2}, BINDINGS: {}, LINKS: {} CSE, IIT Kharagpur ) 9

Partial Order Planning Initial state: Op( ACTION: Start, EFFECT: At(Home) Sells(HWS, Drill) Sells(SM, Milk) Partial Order Planning Initial state: Op( ACTION: Start, EFFECT: At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Banana) ) Goal state: Op( ACTION: Finish, PRECOND: At(Home) Have(Milk) Have(Bananas) Have(Drill) ) Actions: Op( ACTION: Go(there), PRECOND: At(here), EFFECT: At(there) At(here)) Op(ACTION: Buy(x), PRECOND: At(store) Sells(store, x), EFFECT: Have(x)) CSE, IIT Kharagpur 10

Partial Order Planning Algorithm Function POP( initial, goal, operators ) returns plan Make-Minimal-Plan( initial, Partial Order Planning Algorithm Function POP( initial, goal, operators ) returns plan Make-Minimal-Plan( initial, goal ) Loop do If Solution( plan ) then return plan S, c Select-Subgoal( plan ) Choose-Operator( plan, operators, S, c ) Resolve-Threats( plan ) end Function Select-Subgoal( plan ) returns S, c pick a plan step S from STEPS( plan ) with a precondition that C has not been achieved return S, c CSE, IIT Kharagpur 11

POP Algorithm (Contd. ) Procedure Choose-Operator( plan, operators, S, c ) choose a step POP Algorithm (Contd. ) Procedure Choose-Operator( plan, operators, S, c ) choose a step S’ from operators or STEPS( plan ) that has c as an effect if there is no such step then fail add the causal link S’ c: S to LINKS( plan ) add the ordering constraint S’ S to ORDERINGS( plan ) if S’ is a newly added step from operators then add S’ to STEPS( plan ) add to Start S’ Finish ORDERINGS( plan ) CSE, IIT Kharagpur 12

POP Algorithm (Contd. ) Procedure Resolve-Threats( plan ) for each S’’ that threatens a POP Algorithm (Contd. ) Procedure Resolve-Threats( plan ) for each S’’ that threatens a link Si c: Sj in LINKS( plan ) do choose either Promotion: Add S’’ Si to ORDERINGS( plan ) Demotion: Add Sj S’’ to ORDERINGS( plan ) if not Consistent( plan ) then fail end CSE, IIT Kharagpur 13

Partially instantiated operators • • So far we have not mentioned anything about binding Partially instantiated operators • • So far we have not mentioned anything about binding constraints Should an operator that has the effect, say, At(x), be considered a threat to the condition, At(Home) ? – Indeed it is a possible threat because x may be bound to Home • Approaches for dealing with possible threats – Resolve now with an equality constraint • Bind x to something that resolves the threat (say x = HWS) – Resolve now with an inequality constraint • Extend the language of variable binding to allow x Home – Resolve later • Ignore possible threats. If x = Home is added later into the plan, then we will attempt to resolve threat (by promotion or demotion) CSE, IIT Kharagpur 14

Support for partially instantiated operators Procedure Choose-Operator( plan, operators, S, c ) choose a Support for partially instantiated operators Procedure Choose-Operator( plan, operators, S, c ) choose a step S’ from operators or STEPS( plan ) that has c’ as an effect such that u = UNIFY( c, c’, BINDINGS( plan )) if there is no such step then fail add u to BINDINGS( plan ) add the causal link S’ c: S to LINKS( plan ) add the ordering constraint S’ S to ORDERINGS( plan ) if S’ is a newly added step from operators then add S’ to STEPS( plan ) add to Start S’ Finish ORDERINGS( plan ) CSE, IIT Kharagpur 15

Support for partially instantiated operators Procedure Resolve-Threats( plan ) for each Si c: Sj Support for partially instantiated operators Procedure Resolve-Threats( plan ) for each Si c: Sj in LINKS( plan ) do for each S’’ in STEPS( plan ) do for each c’ in EFFECTS( S’’) do if SUBST( BINDINGS(plan), c ) = SUBST( BINDINGS(plan), c’ ) then choose either Promotion: Add S’’ Si to ORDERINGS( plan ) Demotion: Add Sj S’’ to ORDERINGS( plan ) if not Consistent( plan ) then fail end end CSE, IIT Kharagpur 16