logical agents
play

Logical Agents Reasoning [Ch 6] Propositional Logic [Ch 6] - PDF document

Logical Agents Reasoning [Ch 6] Propositional Logic [Ch 6] Predicate Calculus Representation [Ch 7] Predicate Calculus Inference [Ch 9] Implemented Systems [Ch 10] Applications [Ch 8] Planning [Ch 11]


  1. Logical Agents • Reasoning [Ch 6] • Propositional Logic [Ch 6] • Predicate Calculus – Representation [Ch 7] • Predicate Calculus – Inference [Ch 9] • Implemented Systems [Ch 10] • Applications [Ch 8] • Planning [Ch 11] − Using “Situation Calculus” − Simple − GraphPlan [Notes] Planning 1

  2. Planning 2

  3. Planning (Overview) • Planning vs Problem Solving ? • Strips framework • Situation Space vs Plan Space • Partial Order Planner • Protected Links • Example Planning 3

  4. Planning in Situation Calculus • Planning ⊂ Problem Solving Given: Initial: At(Home, S 0 ) ∧ ¬ Have(Milk, S 0 ) Goal: ∃ s At(Home,s) ∧ Have(Milk,s) Operators: ∀ a, s Have(Milk, Result(a,s)) ⇔ [( a = Buy(Milk) ∧ At(Store, s) ) ( Have(Milk,s) ∧ a � = Drop(Milk) )] ∨ . . . Find: Sequence of operators [ o 1 , . . . o k ] where S = Result( o k , Result( ...Result( o 1 , S 0 ) ...)) s.t. At(Home, S) ∧ Have(Milk, S) but. . . Standard Problem Solving is inefficient As goal is “black box” just generate-&-test! Planning 4

  5. Na ¨ ıve Problem Solving Goal: “Have Milk, Bananas, and Drill; at home” ∃ s At(Home, s) ∧ Have(Milk, s) ∧ Have(Banana, s) ∧ Have(Drill, s) Initial: “None of these; at home” At(Home, S 0 ) ∧ ¬ Have(Milk, S 0 ) ∧¬ Have(Banana, S 0 ) ∧ ¬ Have(Drill, S 0 ) Operators: Goto(y), SitIn(z), Talk(w), Buy(q), ... Talk to Parrot Go To Pet Store Buy a Dog Go To School Go To Class Go To Supermarket Buy Tuna Fish Start Go To Sleep Buy Arugula Read A Book Buy Milk ... Finish Sit in Chair Sit Some More Etc. Etc. ... Read A Book . . . Planning 5

  6. General Issues • Done? • General problems: − Problem solving is P -space complete − Logical inference is only semidecidable − . . . plan returned may go from initial to goal, but extremely inefficiently [A, A − 1 ], (NoOp, . . . ) • Solution + Restrict language + Special purpose reasoner ⇒ PLANNER Planning 6

  7. Key Ideas 1. Open up representation . . . to connect States to Actions If goal includes “ Have(Milk) ”, and “ Buy(x) achieves Have(x) ”, “ Buy(Milk) ” then consider action 2. Add actions ANYWHERE in plan Not just to front! Order of adding actions � = order of execution! Eg, can decide to include Buy(Milk) BEFORE de- ciding where? How to get there? . . . Note: Exploits decomposition: doesn’t matter which Milk-selling store, whether agent currently has Drill, . . . . . . avoid arbitrary early decisions . . . 3. Subgoals tend to be nearly independent divide-&-conquer ⇒ Eg, going to store does NOT interfer with bor- rowing from neighbor. . . Planning 7

  8. Strips Representation State: Conjunct’n of (function-free) ground literals At(Home) ∧ ¬ Have(Milk) Goal: Conjunct’n of literals . . . may contain existentially quantified variables At(Home) ∧ Have(Milk) At(x) ∧ Sells(x, Milk) Action: Name of action Action descript’n: Conjunct’n of positive literals Precondition: Conjunct’n of literals Effect: Eg: Op(Action: Go(here, there), At(here) ∧ Path(here, there), Precondition: At(there) ∧ ¬ At(here) ) Effects: Initial: At(Home), Path(Home, Store), ... take “ Go(Home, Store) ” New state: ¬ At(Home), At(Store), Path(Home, Store), ... NOTE: no explicit “situation variables” Precondition just wrt previous situation, . . . Planning 8

  9. Situation Space Situation Space Planner: search through space of SITUATIONS Progression planner: Forward search through situations, from initial towards goal Problem: High branching factor Regression planner: Backward search from goal to starting situation Possible : if operator contain enuff info to regress from (partial description) of result state to (partial description) of previous state Desirable : if goal has few conjuncts; & each conjunct has only a few applicable operators ⇒ Regression planner can be much more ef- ficient but . . . Conjunctive goals make this difficult: − Inefficient − Interdependent goals Planning 9

  10. Searching in Space of “Situations” At(P , B) 1 At(P , A) Fly(P ,A,B) 2 1 At(P , A) 1 (a) At(P , A) 2 Fly(P ,A,B) At(P , A) 2 1 At(P , B) 2 At(P , A) 1 At(P , B) Fly(P ,A,B) 2 1 At(P , B) 1 (b) At(P , B) 2 At(P , B) Fly(P ,A,B) 2 1 At(P , A) 2 Planning 10

  11. Search the Space of Plans • Start with partial plan Expand plan until producing complete plan • Refinement operators add constraints to partial plan Eg: Adding an action Imposing order on actions Instantiating unbound variable . . . (View “partial plan” as set of “completed” plans. Each refinement REMOVES some plans.) + Modification Operators other changes – “debugging” bad plans Planning 11

  12. Searching in Space of “Partial Plans” Start At(GS) Sells(GS, Arugala) Buy Arugala On(L−Shoe) On(R−Shoe) Finish Start Start On(L−Sock) PutOn(L−Shoe) On(L−Shoe) On(R−Shoe) On(L−Shoe) On(R−Shoe) Finish Finish Start At(x) At(Parrot, x) Talk(Parrot) On(L−Shoe) On(R−Shoe) Finish Planning 12

  13. Partial Plan • A “(partial) plan” is   set of actions { S i }       set of ordering constraints: “ S i ≺ S j ”     PreC set of causal links: “ S i → S j ” −        set of open preconditions:    • Action ∈ S ≡ instantiated operator PutOn(L-Sock), PutOn(R-Shoe) • Ordering constraints ⊂ S × S “ S i ≺ S j ” means S i has to happen (sometime) before S j PutOn(L-Sock) ≺ PutOn(L-Shoe) • Causal links ⊂ S × P rop × S PreC “ S i − → S j ” means S i causes PreC , which S j needs PreC ∈ Effects of S i ; PreC ∈ PreConditions of S j On ( L − Sock ) − → PutOn(L-Sock) PutOn(L-Shoe) • Open-PreC ⊂ P rop Set of preconditions, over all actions that are not achieved Planning 13

  14. Initial Partial Plan (Shoes) Consider: Goal: RShoeOn ∧ LShoeOn Initial: {} Operators: Op(RShoe, PreC: RSockOn, RShoeOn) Eff: Op(LShoe, PreC: LSockOn, LShoeOn) Eff: PreC: {} , Op(RSock, RSockOn) Eff: PreC: {} , Op(LSock, LSockOn) Eff: • Initially. . . just dummy actions: S s (Start): no PreC ; Effects are FACTs S f (Finish): PreC = Goal; no Effects Plan ( Actions: � � S s : Act( Start; {} ) PreC: {} ; Eff: S f : Act( Finish; PreC: RShoeOn ∧ LShoeOn ) � � S s ≺ S f Orderings: CausalLinks: {} � � RShoeOn Open-PreC : LShoeOn ) Planning 14

  15. Shoe Plan #2 � S s :   � PreC: {} ; Eff: {} ) Act( Start; Actions: S f : Act( Finish; PreC: RShoeOn ∧ LShoeOn )   { S s ≺ S f } Orderings: Plan   {} CausalLinks:   � RShoeOn  �  Open-PreC : LShoeOn • “ Open-PreC ” � = {} ⇒ NOT DONE! • Next partial plan: Try to achieve “RShoeOn” ∈ Open-PreC . . . using “ RShoe ”     S s : Act( Start; PreC: {} ; Eff: {} )   S f : Act( Finish; PreC: RShoeOn ∧ LShoeOn )     Actions: S rs : Act( RShoe; PreC: RSockOn;       Eff: RShoeOn )       � � S s ≺ S f   Plan Orderings: S s ≺ S rs ≺ S f       { RSock On ( RSockOn )   − → RShoe }   CausalLinks: � RSockOn    �  Open-PreC : LShoeOn Planning 15

  16. Comments on Partial Plans • Every action is between S s and S f S s for start, before everything S e for finish, only when all goals achieved • ≺ means BEFORE not necessarily IMMEDIATELY before PreC “ S i → S j ” means before − with no “intervening clobber-er” • In “Planning Space”: Move from Plan i to Plan j by ⋆ Adding new Action S PreC ⋆ Adding new Ordering ≺ ; CausalLink S i → S j , − Value for Variable, . . . . . . Q: When to add S ? A: If S : Effect matches Open-PreC Q: How to add S ? A: Add to Actions S Add S ≺ T to Ordering PreC Add − → T to CausalLinks S Add S : PreC to Open-PreC as necessary + more. . . Planning 16

  17. Shoe Plan #3 Plan ( Actions:   S s : Act(Start; {} ) PreC: {} ; Eff:    S e : Act(Finish; PreC: RShoeOn ∧ LShoeOn)        S rs : Act(RShoe; PreC: RSockOn; Eff: RShoeOn)   Act(RSock; PreC: {} ; Eff: S rx : RSockOn)    S lx : Act(LSock; PreC: {} ; Eff: LSockOn)        S ls : Act(LShoe; PreC: LSockOn; Eff: LShoeOn)     S s ≺ S e , S s ≺ S lx , S s ≺ S rx , . . .   S lx ≺ S ls , S rx ≺ S rs Orderings: S ls ≺ S e , S rs ≺ S e , . . .     LSockOn − → S lx S ls   CausalLinks: RSockOn S rx − → S rs   Open-PreC : {} ) Notes: As “Open-PreC = {} , can stop (Still another check) . . . Planning 17

Recommend


More recommend