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] PC-Plan 1

  2. Typical Wumpus World Breeze Stench 4 PIT Breeze Breeze 3 PIT Stench Gold Breeze Stench 2 Breeze Breeze 1 PIT START 1 2 3 4 PC-Plan 2

  3. Simple Reflex Agent Rep’n: At time = t , specify Percept([s,b,g,u,c], t ) where s ∈ { Stench , −} , b ∈ { Breeze, −} , . . . Eg: Tell(KB, Percept([Stench,-,Glitter,-,-], 3) ) • Connect percepts directly to actions: ∀ s, b, u, c, t Percept ([ s, b, Glitter , u, c ] , t ) ⇒ Action ( Grab , t ) • Or, more indirectly: ∀ s, b, u, c, t Percept ([ s, b, Glitter , u, c ] , t ) ⇒ AtGold ( t ) ∀ t AtGold ( t ) ⇒ Action ( Grab , t ) Q1: Which is more flexible? Q2: Limitations of reflex approach? PC-Plan 3

  4. Problem with Reflex Agents Q: When to Climb ? A: @ [ 1 , 1 ], and have Gold . . . but . . . � being @ [ 1 , 1 ] agent cannot sense having Gold Also. . . May be @ [ 2 , 3 ] when hunting for gold Then reach same [ 2 , 3 ] when returning As SAME percepts both times & reflex agent can ONLY use percept to decide on action agent must take SAME actions both times. . . ∞ -loop! ⇒ ⇒ Agent needs INTERNAL MODEL of state/world PC-Plan 4

  5. Tracking a Changing World • Consider FINDING KEYS . . . when “Keys are in pocket” . . . agent could keep percept history, & replay it Better: just store this info! Any decision based on past/present percepts FACT: can be based on current “world state” (. . . which is updated each action) So... perhaps KB should keep ONLY info about current situation PC-Plan 5

  6. Single-Time Knowledge Base Time 0: Initial configuration At(Agent, [ 1 , 1 ] ) Facing(Agent, North) Smell(No) ... Time 1: Then take a step Action = Forward NOW in new situation: Remove false statements remove At(Agent, [ 1 , 1 ] ) , . . . Add in statement that are now true: add At(Agent, [ 1 , 2 ] ) , . . . ⇒ use revised KB: At(Agent, [ 1 , 2 ] ) Facing(Agent, North) Smell(Yes) ... Time 2: Turn to the right Actions = TurnRight ⇒ use revised KB: At(Agent, [ 1 , 2 ] ) Facing(Agent, East) Smell(Yes) ... PC-Plan 6

  7. Problems with Single-Time KBs but . . . may need to reason about MANY times Eg: “Was there a stench in [ 1 , 2 ] and [ 2 , 3 ]?” • Need to Maintain info from previous states . . . labeled with state • Kinda like “time stamp” . . . but “time” is not relevant better to record SEQUENCE of ACTIONS! Compare: Having GOLD at time 4 with Having GOLD after Going forward , then Turning right , then Going forward , then Grabbing ⇒ Sequence of actions ≈ “plan”! PC-Plan 7

  8. Situation Calculus • Tag each “changable predicate” with “time”: Eg: At( Agent, [ 1 , 1 ] , S 0 ) At( Agent, [ 1 , 2 ] , Result( Forward, S 0 ) ) At( Agent, [ 1 , 3 ] , Result(Forward, Result( Forward, S 0 ))) . . . Notice: all stay around! • Only “label” predicates that can change. As Pit doesn’t move, At(Pit, � 3 , 2 � ) sufficient Similarly, just 2+2=4 , . . . • “Time” only wrt actions Snapshot of SITUATION. . . World represented as SERIES OF SITUATIONS connected by actions PC-Plan 8

  9. Updating State, Based on Action PIT PIT G o l d P I T PIT P I T Gold S 3 P I T P I T P I T Gold Forward S 2 P I T P I T P I Gold T TurnRight S 1 P I T Forward S 0 S 1 = Result( Forward, S 0 ) S 2 = Result( TurnRight, S 1 ) = Result( TurnRight, Result(Forward, S 0 ) ) S 3 Result( Forward, S 2 ) = = Result( Forward, Result( TurnRight, Result( Forward, S 0 ) ) ) Result : Action × State �→ State PC-Plan 9

  10. Computing Location • Can compute location: ∀ i, j, s At ( Ag , [ i, j ] , s ) ∧ Facing ( Ag , North , s ) ⇒ At( Ag , [ i, j + 1 ] , Result ( Forward , s )) ∀ i, j, s At ( Ag , [ i, j ] , s ) ∧ Facing ( Ag , East , s ) ⇒ At( Ag , [ i − 1 , j ] , Result ( Forward , s )) . . . • Can compute orientation: ∀ i, j, s Facing(Ag, North, s) ⇒ Facing(Ag, East, Result( TurnRight, s) ) . . . PC-Plan 10

  11. Interpreting Percepts • Extract Individual Percepts ∀ b, g, u, c, t Percept([Stench, b, g, u, c], t) ⇒ Stench(t) ∀ b, u, c, s, t Percept([s, Breeze, g, u, c], t) ⇒ Breeze(t) • Combine with State to make Infer- ences about Locations ∀ ℓ, s At ( Agent, ℓ, s ) ∧ Stench ( s ) ⇒ Smelly ( ℓ ) ∀ ℓ, s At ( Agent, ℓ, s ) ∧ Breeze ( s ) ⇒ Breezy ( ℓ ) • Combine with Causal Rules to Infer Locations of Wumpus, Pits ∀ ℓ Breezy ( ℓ ) ⇔ [ ∃ x PitAt ( x ) ∧ Adj ( ℓ, x )] ∀ ℓ Stench ( ℓ ) ⇔ [ ∃ x WumpusAt ( x ) ∧ Adj ( ℓ, x )] ∀ ℓ OK ( ℓ ) ⇔ ( ¬ WumpusAt ( ℓ ) ∧ ¬ PitAt ( ℓ )) PC-Plan 11

  12. Deducing Hidden Properties • Squares are breezy near a pit: – Diagnostic rule — infer cause from effect ∀ ℓ Breezy ( ℓ ) ⇒ ∃ x Pit ( x ) ∧ Adj ( ℓ, x ) – Causal rule — infer effect from cause ∀ ℓ, x Pit ( x ) ∧ Adj ( ℓ, x ) ⇒ Breezy ( ℓ ) – Neither is complete. . . Eg, the causal rule doesn’t say whether squares far away from pits can be breezy ⇒ Definition for Breezy predicate: ∀ ℓ Breezy ( ℓ ) ⇔ [ ∃ x PitAt ( x ) ∧ Adj ( ℓ, x )] • Squares are stenchy near the wumpus: ∀ ℓ Stench ( ℓ ) ⇔ [ ∃ x WumpusAt ( x ) ∧ Adj ( ℓ, x )] PC-Plan 12

  13. Using Information • After concluding ¬ Stench ([ 1 , 1 ]) ¬ Stench ([ 1 , 2 ]) Stench ([ 2 , 1 ]) ∀ ℓ Adj ([ 1 , 1 ] , ℓ ) ( ℓ = [ 2 , 1 ] ∨ ℓ = [ 1 , 2 ]) ⇔ ∀ ℓ Adj ([ 2 , 1 ] , ℓ ) ( ℓ = [ 1 , 1 ] ∨ ℓ = [ 2 , 2 ] ∨ ℓ = [ 3 , 1 ]) ⇔ ∀ ℓ Adj ([ 1 , 2 ] , ℓ ) ( ℓ = [ 1 , 1 ] ∨ ℓ = [ 2 , 2 ] ∨ ℓ = [ 1 , 3 ]) ⇔ • Can derive ¬ [ ∃ x WumpusAt ( x ) ∧ Adj ([ 1 , 1 ] , x )] ∀ x Adj ([ 1 , 1 ] , x ) ⇒ ¬ WumpusAt ( x ) ¬ WumpusAt ([ 1 , 2 ]), ¬ WumpusAt ([ 2 , 1 ]) ¬ [ ∃ x WumpusAt ( x ) ∧ Adj ([ 1 , 2 ] , x )] ¬ WumpusAt ([ 1 , 1 ]), ¬ WumpusAt ([ 2 , 2 ]), ¬ WumpusAt ([ 3 , 1 ]) [ ∃ x WumpusAt ( x ) ∧ Adj ([ 2 , 1 ] , x )] WumpusAt ([ 1 , 1 ]) ∨ WumpusAt ([ 2 , 2 ]) ∨ WumpusAt ([ 1 , 3 ]) . . . ⇒ WumpusAt ([ 1 , 3 ]) PC-Plan 13

  14. Connecting Inferences to Actions • Rate Each Action ∀ ℓ 1 , s WumpusAt( ℓ 1 ) ∧ LocationAhead(Agent, s) = ℓ 1 ⇒ Deadly( Forward, s ) ∀ ℓ 1 , s OK( ℓ 1 ,s) ∧ LocationAhead(Agent,s) = ℓ 1 ∧ ¬ Visited( ℓ 1 ,s) ⇒ Good(Forward, s ) ∀ ℓ 1 , s Gold( ℓ 1 ,s) ⇒ Great(Grab, s ) • Choose Best Action ∀ a, s Great ( a, s ) ⇒ Action ( a, s ) ∀ a, s Good ( a, s ) ∧ ( ¬∃ b Great ( b, s )) ⇒ Action ( a, s ) • Now, for each situation S , Ask( KB , ∃ a Action( a , S) ) . . . find a s.t. KB | = Action ( a, S ) PC-Plan 14

  15. Propagating Information Effect Actions: If agent Grabs, when in room with gold, he will be holding gold. ∀ ℓ, s Glitters ( ℓ ) ∧ At ( Agent , ℓ, s ) ⇒ AtGold ( s ) ∀ ℓ, s AtGold ( s ) ⇒ Holding ( Gold , Result ( Grab , s ) ) So, if Glitters( [ 3 , 2 ] ) , At ( Agent , [ 3,2 ] , S 6 ), then Holding ( Gold , S 7 ) where S 7 = Result ( Grab , S 6 ) What about NEXT situation? eg, S 8 = Result ( Turn Right , S 7 )? Want to derive Holding ( Gold , Result ( Turn Right , S 7 ) ), This requires . . . PC-Plan 15

  16. Frame Axioms • ∀ a, x, s Holding ( x, s ) ∧ ( a � = Release ) Holding ( x, Result ( a, s ) ) ⇒ ∀ a, s ¬ Holding ( Gold , s ) ∧ ( a � = Grab ∨ ¬ AtGold ( s ) ⇒ ¬ Holding ( Gold , Result ( a, s ) ) true afterwards ⇔ [an action made it true ∨ Gen’l: (true already & no action made it false)] Here: ∀ a, s Holding ( Gold , Result ( a, s )) ⇔ [ ( a = Grab ∧ AtGold ( s ) ) ∨ ( Holding ( Gold , s ) ∧ a � = Release ) ] Similarly: ∀ a, d, p, s At ( p, ℓ, Result ( a, s ) ) ⇔ [ ( a = Forward ∧ ℓ = LocAhead ( p, s ) ∧ ¬ Wall ( ℓ )) ∨ ( At ( p, ℓ, s ) ∧ a � = Forward ) ] • “Successor State Axiom” Lists all ways predicate can become true/false PC-Plan 16

  17. Frame, and Related, Problems • Representational Frame Problem Encoding what doesn’t change, as ac- tions take place (Solved via “success-state axioms”) • Inferential Frame Problem . . . deal with long sequences of actions . . . • Qualification Problem dealing with all qualifications . . . gold brick is not slippery, not screwed to table, . . . • Ramification When picking up the gold brick, also pick up the associated dust . . . PC-Plan 17

  18. Goal-Based Agent • These rules sufficient to FIND gold Then what? • Need to change strategies: – Was “ Find gold ” – Now: “ Get out! ” ∀ s Holding ( Gold , s ) ⇒ GoalLocation ( [ 1 , 1 ] , s ) Need to incorporate. . . How? PC-Plan 18

  19. How to Plan? Planning agents seek plan ≡ sequence of actions that achieve agent’s goals. Inference: Let logical reasoning system per- form search: Ask(KB, ∃ a 1 , a 2 , a 3 , a 4 , a 5 , t t = Result ( a 5 , Result ( a 4 , Result ( a 3 , Result ( a 2 , Result ( a 1 , S 0 ))))) ∧ Holding ( Agent, Gold, t ) ∧ At ( Agent, Outside, t )) Problematic, as not easy to heuristically guide reasoning system. . . . . . what if > 5 actions required? . . . Search: View actions as operations on KB , Goal = “ KB includes Holding ( Agent , Gold , t ) At ( Agent , Outside , t ))” Planning: Special purpose reasoning systems. . . PC-Plan 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend