1 / 20

Planning

Planning. Points Elements of a planning problem Planning as resolution Conditional plans Actions as preconditions and effects Goal regression. Elements of a planning problem. When is a problem a good application for planning?

ban
Download Presentation

Planning

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Planning • Points • Elements of a planning problem • Planning as resolution • Conditional plans • Actions as preconditions and effects • Goal regression

  2. Elements of a planning problem • When is a problem a good application for planning? • It can be decomposed into subproblems in such a way that solving each subproblem (in some order) solves the whole problem. • It is conjunctive, that is, it can be expressed as a conjunction of conditions, each representing an elementary aspect if the world, the initial situation, the final situation. • Each subproblem can be reduced to facts about domain objects, and relations among such objects.

  3. Elements of a planning problem (2) • States, state spaces. • Actions with preconditions and postconditions. • An action is a function from states to states. It makes local changes that affect few objects. • Actions are generic, facts are specific. • Actions are elementary: one-step plans. • A design decision: granularity of actions. • Conditional actions: If( C, A1, A2 ). • Frame axioms and the Closed World Assumption. • The timing of actions: is a real-time plan needed, or do we only need a sequence of actions with relative time?

  4. Elements of a planning problem (3) • A plan is a sequence of actions that lead from an initial state to a goal state. • In a linear plan, the actions required to solve a subproblem precede the actions required to solve the next subproblem. • In a non-linear plan, actions for subproblems may be (or even may have to be) interleaved. • Optimality of plans: a simple criterion is the number of actions. • A plan may be executed either “in batch mode” (after the whole plan has been created), or with every action performed immediately (with feedback for more planning).

  5. Elements of a planning problem (4) • A formal representation of plans may look, for example, like this: • Do( Action3, Do( Action2, Do( Action1, init ) ) ) • where init denotes an initial state. • There are two ways of implementing state changes (we must be able to undo such changes, because planning algorithms usually backtrack). • Explicit changes in the knowledge base. • Implicit changes, not in the knowledge base but only in the plan representation, recomputed as needed (this is costly, but undoing is easier).

  6. Planning as resolution • The blocks world(find its description in any textbook ) • T( p, s ) means "predicate p is true in state s" • Elementary conditions: On, OnTbl and Clear. • Examples of actions: Stack, Unstack and NoOp. • T( OnTbl( x ), s ) T( Clear( x ), s )  T( Clear( y ), s )  x ≠ y  T( On( x, y ), Do( Stack( x, y ), s ) ) • T( On( x, y ), s )  T( Clear( x ), s ) T( OnTbl( x ), Do( Unstack( x, y ), s ) )  T( Clear( y ), Do( Unstack( x, y ), s ) ) • T( p, s )  T( p, Do( NoOp, s ) )

  7. Planning as resolution (2) • On means “sitting on another block”. • OnTbl means “sitting on the table”. • Some facts about this worlds are always true.For example: • T( OnTbl( x ), s )    y T( On( x, y ), s) [=] • Frame axioms — two examples: • T( Clear( u ), s )  u ≠ y  T( Clear( u ), Do( Stack( x, y ), s ) ) • T( On( u, w ), s )  u ≠ x  T( On( u, w ), Do( Unstack( x, y ), s ) )

  8. A S0 S1 C B C A B Planning as resolution (3) • An initial state • T( Clear( C ), S0 ) T( On( C, A ), S0 ) • T( Clear( B ), S0 ) • T( OnTbl( A ), S0 ) T( OnTbl( B ), S0 ) • Another (possibly final) state • T( Clear( A ), S1 ) T( On( A, B ), S1 ) • T( On( B, C ), S1 ) T( OnTbl( C ), S1 )

  9. Plan construction by resolution(a very simple example) Planning as resolution (4) • We want to prove thatT( OnTbl( A ), t ) given S1. • We assume that we can do it in one action , so that state tshould look likeDo( , S1 ). • If this is not possible, we will try Do( , Do( , S1 ) ),Do( , Do( , Do( , S1 ) ) ), and so on. • Let’s negate the fact that we want proven. •  T( OnTbl( A ), Do( , S1 ) ) • Action  could be Unstack. That is because one of the clauses in its clausal-form definition is this: •  T( On( x, y ), s ),  T( Clear( x ), s ),T( OnTbl( x ), Do( Unstack( x, y ), s ) )

  10. Plan construction by resolution(continued) Planning as resolution (5) •  T( OnTbl( A ), Do( , S1 ) ) • T( OnTbl( x ), Do( Unstack( x, y ), s ) ), T( On( x, y ), s ),  T( Clear( x ), s ) • This gives •  T( On( A, y ), S1 ),  T( Clear( A ), S1 ) • after assigning x  A, sS1, Unstack( A, y ). • This is given: T( On( A, B ), S1 ). • We resolve and get  T( Clear( A ), S1 ) with y  B. • This too is given: T( Clear( A ), S1 ). • so we produce the empty resolvent: done. • tDo( , S1 ) = Do( Unstack( A, B ), S1 )

  11. Conditional plans • Let T( Clear( A ), S2 ) be the only given fact. • We can find a plan for the goal • T( OnTbl( A ), Do( , S2 ) ) • even though the problem is under-constrained. • Axioms for conditional actions • T( p, s )  T( q, Do( , s ) )  T( q, Do( If( p, ,  ), s ) ) • ¬ T( p, s )  T( q, Do( , s ) )  T( q, Do( If( p, ,  ), s ) ) • Again, we begin by assuming a one-step plan, but now it will be a conditional plan.

  12. Conditional plans (2) • ¬ T( OnTbl( A ), Do( , S2 ) ) • Assume If( p, ,  ). • ¬ T( OnTbl( A ), Do( If( p, ,  ), S2 ) ) • The first axiom as a clause: [+] • T( q, Do( If( p, ,  ), s ) ),¬ T( p, s ), ¬ T( q, Do( , s ) ) • Resolve with q OnTbl( A ), sS2 and get • ¬ T( p, S2 ), ¬ T( OnTbl( A ), Do( , S2 ) ) • We need again that axiom for Unstack: • T( OnTbl( x ), Do( Unstack( x, y ), s ) ), T( On( x, y ), s ),  T( Clear( x ), s )

  13. Conditional plans (3) • ¬ T( p, S2 ), ¬ T( OnTbl( A ), Do( , S2 ) ) • T( OnTbl( x ), Do( Unstack( x, y ), s ) ), T( On( x, y ), s ),  T( Clear( x ), s ) • With x  A, Unstack( A, y ), sS2 we get • ¬ T( p, S2 ),  T( On( A, y ), S2 ),  T( Clear( A ), S2 ) • We resolve this with our only fact: • ¬ T( p, S2 ),  T( On( A, y ), S2 ) • ... and this is it. We need something new to move on. • One possibility is factoring: look for matching literals on the resolvent. Here we can assign p On( A, y ) and reduce the resolvent to  T( On( A, y ), S2 ).

  14. Conditional plans (4) • We can conclude the proof if we assume • T( On( A, y ), S2 ) • Here, the conditional nature of the plan helps.We combine everything we have found so far.Our one-action plan looks like this: • Do( If( On( A, y ), Unstack( A, y ),  ), S2 ) • To also determine , we return to the point marked [+] and look at the second axiom for conditional actions: • T( q, Do( If( p, ,  ), s ) ), T( p, s ), ¬ T( q, Do( , s ) ) • ¬ T( OnTbl( A ), Do( , S2 ) ) • Resolve with q OnTbl( A ), sS2 and get • T( p, S2 ), ¬ T( OnTbl( A ), Do( , S2 ) )

  15. Conditional plans (5) • T( p, S2 ), ¬ T( OnTbl( A ), Do( , S2 ) ) • The clausal form of action NoOp: • ¬ T( p, s ), T( p, Do( NoOp, s ) ) • Assign p OnTbl( A ),   NoOp and get this: • T( p, S2 ), ¬ T( OnTbl( A ), S2 ) • It is time to recall that useful fact [=] about OnTbl: • T( OnTbl( x ), s )    y T( On( x, y ), s) • So, we can replace one side with the other: • T( p, S2 ),  y T( On( A, y ), S2) • Skolemize ( is the Skolem constant): • T( p, S2 ), T( On( A,  ), S2)

  16. Conditional plans (6) • T( p, S2 ), T( On( A,  ), S2) • We perform factorization, assigning p On( A,  ): • T( On( A,  ), S2) • To conclude the second part of the proof, we assume •  T( On( A,  ), S2 ) • Now, our one-action plan is either of these: • Do( If( On( A, y ), Unstack( A, y ),  ), S2 ) • Do( If( On( A,  ), , NoOp ), S2 ) • We can finally put these partial plans together: • Do( If( On( A,  ), Unstack( A,  ), NoOp ), S2 )

  17. Another representation of actions • Preconditions of an action + • facts added (made true) by this action + • facts deleted (made false) by this action. • Pre( Unstack( x, y ) ) = { On( x, y ), Clear( x ) } • Add( Unstack( x, y ) ) = { OnTbl( x ), Clear( y ) } • Del( Unstack( x, y ) ) = { On( x, y ) } • The Closed World Assumption serves as the frame axiom: • facts not on the Add list and on the Del listare by default preserved. • A state is represented as a set of facts, for example: • { OnTbl( A ), OnTbl( B ) }

  18. Goal regression • Reduce one of the goals to its subgoal or subgoals. • This means working backward from a state to a state by looking at the preconditions and effects of some action. • Let Regr( q,  ) be a state achieved by regression from q through  (“undoing” the effects of ). •  cannot delete a fact that must be true in q: • q  Del(  ) = Ø • If  has this property, we can define: • Regr( q,  ) = Pre(  )  (q — Add(  ) ) • So: keep the preconditions of , undo the effects of .

  19. Goal regression (2) • Example • If we begin with • { OnTbl( A ), OnTbl( B ) } • we can “recreate” • { Clear( A ), On( A, B ), OnTbl( B ) } • by regression through Unstack( A, B ). • Protection violation • Actions for a subproblem must not undo the effects of earlier actions for already solved subproblems.

  20. A planning strategy for conjunctive problems • Going left to right, make a plan for each conjunct and freeze the effects (put the added or preserved goals on a list of protected goals). • This simple method is weak. It will not work even for the following trivial problem. • SinitialOn( C, A ) OnTbl( A ) OnTbl( B ) • SfinalOn( C, A ) On( A, B ) • On( C, A ) is true in Sinitial and must be protected. But: it must be temporarily destroyed to achieve On( A, B ). Goal protection makes planning impossible. • Here, rearrangement helps: On( A, B ) On( C, A ) “works”. In general non-linear planning is necessary. • One such a smarter planner is Warplan.

More Related