0% found this document useful (0 votes)
2 views

ai unit 3-2

The document discusses logical agents, particularly in the context of the Wumpus World game, where agents utilize a knowledge base to draw conclusions and make decisions. It explains the agent's percepts, actuators, and goals, as well as the use of propositional and first-order logic for reasoning. Additionally, it highlights the challenges of inference and the efficiency of using first-order logic to simplify rules for decision-making.

Uploaded by

nirupa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ai unit 3-2

The document discusses logical agents, particularly in the context of the Wumpus World game, where agents utilize a knowledge base to draw conclusions and make decisions. It explains the agent's percepts, actuators, and goals, as well as the use of propositional and first-order logic for reasoning. Additionally, it highlights the challenges of inference and the efficiency of using first-order logic to simplify rules for decision-making.

Uploaded by

nirupa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Agents that Reason Logically

■ Logical agents have knowledge base,


from which they draw conclusions
■ TELL: provide new facts to agent
■ ASK: decide on appropriate action
Logical Agents – Quick Summary

22MDC45 - Unit 3
Sample: Wumpus World
■ Show original wumpus game
■ goal is to shoot wumpus
■ example of logical reasoning
■ http://www.inthe70s.com/games/wumpus/i
ndex.shtml
■ Our version:
■ Find gold, avoid wumpus, climb back out of
cave
A Wumpus Agent
■ Agent does not perceive its own location
(unlike sample game), but it can keep track
of where it has been
■ Percepts:
■ Stench – wumpus is nearby
■ Breeze – pit is nearby
■ Glitter – gold is here
■ Bump – agent has just bumped against a wall
■ Scream – agent has heard another player die
Wumpus Agent
■ Actuators:
■ Forward, Turn Left, Turn Right
■ Grab (gold)
■ Shoot (shoots arrow forward until hits
wumpus or wall)
■ agent only has one arrow
■ Climb (exit the cave)
■ Environment:
■ 4x4 grid, start at (1,1) facing right
Wumpus Agent
■ Death
■ Agent dies if it enters a pit or square with
wumpus
■ Goal: get gold and climb back out. Don’t
die.
■ 1000 points for climbing out of cave with
gold
■ 1 point penalty for each action taken
■ 10,000 point penalty for death
Some complex reasoning
examples
■ Start in (1,1)
■ Breeze in (1,2) and (2,1)
■ Probably a pit in (2,2)
■ Smell in (1,1) – where can you go?
■ Pick a direction – shoot
■ Walk in that direction
■ Know where wumpus is
The use of logic
■ A logic: formal language for
representing information, rules for
drawing conclusions
■ Two kinds of logics:
■ Propositional Logic (Chap 7)
■ Represents facts

■ First Order Logic (Chap 8)


■ Represents facts, objects, and relations
Models and soundness
■ Model = “possible world”
■ A world m is a model of a sentence α if α is
true in m
■ α = It is raining today
■ α = The wumpus is not in (2,2)
■ Rules of inference allow us to derive new
sentences entailed by a knowledge base
■ Rules of inference must be sound: sentences
inferred by a KB should be entailed by that KB
■ What is a non-sound inference?
■ Video
Entailment
■ At any given time, we have a knowledge base
of information
■ If I were a train, I’d be late
■ If I were a rule, I would bend
■ I am a rule
■ The knowledge base KB entails α means α is
true in all worlds where KB is true
■ e.g. if α = “I would bend”
■ KB α
Propositional Logic: Syntax
Propositional Logic: Semantics
Inference by Enumeration
Enumeration Solution: is α
entailed by KB?
Enumeration is too
computationally intense
■ For n proposition symbols, enumeration
takes 2n rows (exponential)
■ Inference rules allow you to deduce
new sentences from the KB
■ Can use inference rules as operators in a
standard search algorithm
■ Think of testing if something as true as
searching for it
Common inference rules for
propositional logic
■ Modus Ponens (Implication-Elimination)

■ And-Elimination

And-Introduction

■ “Or Introduction”
Common inference rules for
propositional logic
■ Double-Negation Elimination

■ Unit Resolution

■ Resolution
Example of using logic in
Wumpus World
■ KB contains:

Stench
Agent
Start Breeze
KB also contains knowledge of
environment
■ No stench no wumpus nearby

■ Stench wumpus nearby


We can determine where
wumpus is!
■ Method 1: Truth table
■ At least 14 symbols currently: S1,1, S2,1, S1,2,
S2,2, W1,1, W2,1, W1,2, W2,2, W3,1, W1,3, B1,1, B2,1,
B1,2, B2,2
■ 214 rows, ouch!
We can determine where
wumpus is!
■ Method 2: Inference
■ Modus Ponens

■ And-Elimination
Inference continued...
■ Modus Ponens and And-Elimination again:

■ One more Modus Ponens:


Inference continued...
■ Unit Resolution:

Wumpus is in (1,3)!!!
Shoot it. Shoot where?
Determining action based on
knowledge

■ Propositional logic cannot answer well


the question “What action should I
take?”
■ It only answers “Should I take action
X?”
Propositional logic seems
inefficient
■ Rule: “Shoot if the wumpus is in front of
you”
■ 16 x 4 = 64 rules for the 4x4 grid
■ Ditto for pits
First-order logic to the rescue
■ Uses variables to represent generalities
■ Can reduce rules significantly

You might also like