Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence Logical Agents Chapter 7.

Similar presentations


Presentation on theme: "Artificial Intelligence Logical Agents Chapter 7."— Presentation transcript:

1 Artificial Intelligence Logical Agents Chapter 7

2 Outline of this Chapter An Agent for the Wumpus World

3 Wumpus World The Wumpus world is a cave consisting of rooms connected by passageways. Lurking somewhere in the cave is a Wumpus, a beast that eats anyone who enters its room. The Wumpus can be shot by an agent, but the agent has only one arrow. Some room contains bottomless pits that will trap anyone who wanders into these rooms ( except wumpus, which is too big to fall in ). The only mitigating feature of living in this environment is the possibility of finding a heap of gold.

4 Wumpus World PEAS description Performance measure –gold +1000, death -1000 –-1 per step, -10 for using the arrow Actuators: Left turn ( by 90 o ), Right turn ( by 90 o ), Forward Sensors: Stench, Breeze, Glitter, bump, scream, Shoot Environment Squares adjacent to wumpus are smelly Squares adjacent to pit are breezy Glitter if and only if gold is in the same square Shooting kills the wumpus if you are facing it Shooting uses up the only arrow Grabbing picks up the gold if in the same square Releasing drops the gold in the same square Difficulty: initial ignorance of the configuration of the environment Solution: logical reasoning.

5 Exploring a wumpus world The agent’s initial KB contains the rule of the env (see prev slide) It knows it is in [1,1], percept is [none,none, none,none, none]  it is safe square. Agent’s knowledge evolves as new percepts arrive & actions are taken. 1,12,1 2,3 2,2 2,4 1,3 1,2 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4

6 Exploring a wumpus world After 1 move, agent percept is [None, Breeze, None, None, None, ] A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok A

7 Exploring a wumpus world Agent detects a breeze in [2,1]  there must be a pit in a neighbouring square The pit can’t be in [1,1], by rule of game there must be pit in [2,2] or [3,1] At this point, only 1 square is OK & has not been visited  agent turns around & goes to it. A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok B A P?

8 Exploring a wumpus world After 3 rd move, the new percept now is [Stench, None, None, None, None]  there must be a wumpus nearby Stench in [1,2]  wampus cannot be in [1,1], & by the rule of the game it cannot be in [2,2] (the agent could have detected a stench when it was in [2,1])  A can infer that W is in [1,3] A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok B A A P?

9 Exploring a wumpus world The lack of breeze in [1,2] implies that there is no pit in [2,2] The Agent already inferred that there must be a pit in either [2,2] or [3,1]  so it means it must be in [3,1]. There is no W or P in [2,2]  so it is OK to move there. A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok B A A W! P! ok

10 Exploring a wumpus world A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok B A A W! P! ok A

11 Exploring a wumpus world A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok B A A W! P! ok A OK

12 Exploring a wumpus world After the 5 th move, the percept now is [Stench, Breeze, Glitter, None, None] Agent detects a glitter, so it should grab the gold & end the game. A 1,12,1 2,3 2,2 2,4 1,3 1,4 3,1 3,4 3,3 3,2 4,1 4,2 4,3 4,4 1,2 ok B A A W! P! ok A OK BGS A

13 Logic for the wumpus world Agent’s percepts are converted into sentences & entered into the KB B 2,1 = “There is a breeze at [2,1]” S 1.2 = “There is a stench at [1,2]” W 1.3 = “There is a wumpus at [1,3]” Current knowledge – KB contains the percept sequence ¬ S 1,1 ¬ B 1,1 ¬ S 2,1 B 2,1 S 1,2 ¬ B 1,2 Rules of inference—agent must start out with some knowledge of the env R1 : ¬ S 1,1  ¬ W 1,1 ^ ¬ W 2,1 ^ ¬ W 1,2 R2 : ¬ S 2,1  ¬ W 1,1 ^ ¬ W 2,1 ^ ¬ W 2,2 ^ ¬ W 3,1 R3 : ¬ S 1,2  ¬ W 1,1 ^ ¬ W 1,2 ^ ¬ W 2,2 ^ ¬ W 1.3 R4 : S 1,2  W 1,1  W 1.,2  W 2,2  W 1,3

14 Finding the wumpus How an agent can conclude W3.1? –Construct the truth table for KB  W3.1( 12 propositional symbols, i.e. B 1.1… ) –Use inference rules (instead than showing 2 12 rows) 1.Applying Modus Ponens, using ¬S1,1 and R1 ¬ W 1,1 ^ ¬ W 2,1 ^ ¬ W 1,2 2. Applying And-Elimination – we obtain 3 separate sentences ¬ W 1,1 ¬ W 1,2 ¬ W 2.1. 3. Modus Ponens, using ¬S 2,1 and R2, followed by And-Elimination – we obtain 3 sentences. ¬ W 2,2 ¬ W 2,1 ¬ W 3,1. 4. Modus Ponens, using S 1,2 and R4 – we obtain W 2,2  W 1,3  W 1,2  W 1,1....finally, using a series of Unit Resolutions, we derive W3.1 Problem: need separate propositions for each location,unable to “generalize”

15 Problems with the Propositional agent They are too many propositions to handle. Lack of variables prevents stating more general rules. Having so many rules slows down the inference procedure. Size of truth table is 2 n, (n is the No of propositional symbols in KB) Change of the KB over time is difficult to represent (when A makes its 1 st move, the proposition A 1,1 becomes False & A 2.1 becomes True)  important for the A to know where it was in the past. Standard technique is to index facts with the time when they’re true This means we have a separate KB for every time point.

16 Summary Logical agents apply inference to a knowledge base to derive new information and make decisions Basic concepts of logic: –syntax: formal structure of sentences –semantics: define the "meaning" of sentences –entailment: necessary truth of one sentence given another –inference: deriving sentences from other sentences –soundness: derivations produce only entailed sentences –completeness: derivations can produce all entailed sentences

17 End of Chapter 7


Download ppt "Artificial Intelligence Logical Agents Chapter 7."

Similar presentations


Ads by Google