Knowledge-Based Agents: Chapter 7.1-7.3
Knowledge-Based Agents: Chapter 7.1-7.3
Agents
Chapter 7.1-7.3
3
Wason Selection Task
• I have a pack of cards each of which has a letter
written on one side and a number written on the
other side and I claim the following rule is true:
If a card has a vowel on one side, then it has an
even number on the other side.
• Look at these cards and say which card or cards to
turn over in order to decide whether the rule is true
or false?
E 4 T 7
4
Wason Selection Task
• Wason (1966) showed that people are not very
good at this task.
Wason, P. (1966). Reasoning. In New Horizons in Psychology.
Penguin, Hammondsworth, UK.
• To disprove P=>Q, find a situation in which P^~Q
• To disprove vowel => even, find a card with a
vowel and an odd number
• Thus, turn over the cards showing vowels and turn
over cards showing odd numbers
5
Wason Selection Task
• This version seems easier for people to do, as was shown by
Griggs & Cox, 1982
• Your are the bouncer in a bar. Which of these people do
you card given the rule:
You must be 21 or older to drink beer.
beer coke 22 20
6
Logic as a Methodology
Even if people do not use formal logical reasoning
for solving a problem, logic might be a good
approach for AI for a number of reasons
– Airplanes don’t need to flap their wings
– Logic may be a good implementation strategy
– Developing a solution in a formal system like
logic can offer other benefits, e.g., letting us
prove properties of the approach
•See neats vs. scruffies
A knowledge-based agent
• A knowledge-based agent includes a knowledge base and an
inference system.
• A knowledge base is a set of representations of facts of the
world.
• Each individual representation is called a sentence.
• The sentences are expressed in a knowledge representation
language.
• The agent operates as follows:
1. It TELLs the knowledge base what it perceives.
2. It ASKs the knowledge base what action it should perform.
3. It performs the chosen action.
Architecture of a KB agent
• Knowledge Level
– The most abstract level: describe agent by saying
what it knows
– Ex: A taxi agent might know that the Golden Gate Bridge
connects San Francisco with the Marin County
• Logical Level
– The level at which the knowledge is encoded into sentences
– Ex: links(GoldenGateBridge, SanFrancisco, MarinCounty)
• Implementation Level
– The physical representation of the sentences in the logical level
– Ex: ‘(links goldengatebridge sanfrancisco
marincounty)
The Wumpus World environment
• The Wumpus computer game
• The agent explores a cave consisting of rooms
connected by passageways
• Lurking somewhere in the cave is the Wumpus, a
beast that eats any agent that enters its room
• Some rooms contain bottomless pits that trap any
agent that wanders into the room
• The Wumpus can fall into a pit too, so avoids them
• Occasionally, there is a heap of gold in a room.
• The goal is to collect the gold and exit the world
without being eaten
Wumpus History
• See Hunt_the_Wumpus for
details
• Early (c. 1972) text-based game
written in BASIC written by Gregory Yob, a
student at UMASS, Dartmouth
• Defined a genre of games including adventure,
zork, and nethack
• Eventually commercialized (c. 1980) for early
personal computers
• The Hunt the Wumpus basic code is available in a
1976 article in Creative Computing by Yob!
AIMA’s Wumpus World
¬W
¬W
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
B breeze
G glitter
OK safe cell
P pit
S stench
W wumpus
Exploring a wumpus world
A agent
P?
B breeze
G glitter
OK safe cell
P pit
P?
S stench
W wumpus
Wumpuses online
• AIMA code
– Python
– Lisp
• http://scv.bu.edu/cgi-bin/wcl – Web-based
version you can play
• http://codenautics.com/wumpus/ - Mac
version
Logic in general
• Logics are formal languages for representing
information such that conclusions can be drawn
• Syntax defines the sentences in the language
• Semantics define the "meaning" of sentences
– i.e., define truth of a sentence in a world
• E.g., the language of arithmetic
– x+2 ≥ y is a sentence; x2+y > {} is not a sentence
– x+2 ≥ y is true iff the number x+2 is no less than
the number y
– x+2 ≥ y is true in a world where x = 7, y = 1
– x+2 ≥ y is false in a world where x = 0, y = 6
Entailment
• Entailment means that one thing follows from
another:
KB ╞ α
Higher Order
Probabilistic
Logic First Order