Title: A toy world for logical exploration
1The Wumpus example
- A toy world for logical exploration
2Wumpus world
- A four by four cave with locations identified by
coordinates (3,4), etc. - Agent is at a location, facing a particular
direction (L,R,D,U) - Agent starts at (1,1) facing R
4
gt
1
1
4
3Wumpus world
- In the cave is
- A wumpus that smells
- It can kill the agent if at same location
- It can be killed by the agent shooting an arrow
if facing the wumpus. When the wumpus dies, it
SCREAMs
4
1
1
4
4Wumpus world
- In the cave are
- 3 Pits. Breezes blow from pits.
- If an agent steps into a pit, it falls to its
death. - A heap of gold that glitters
4
1
1
4
5Wumpus world
- Agent goal
- get gold and get out alive
- Agent actions
- Move forward one square in current direction
(Fwd) - Turn left or right 90o (TL,TR)
- Shoot arrow in current direction
- Grab gold
- Agent perceptions at each location
- Stench, Breeze, Glitter, Bump, Scream
6Wumpus world
- Cave is created randomly (location of wumpus,
pits and gold) - Perception / action loop
- Agent must construct a model knowledge base
about the cave as it tries to achieve its goal
4
gt
1
1
4
7Wumpus world knowledge
- General knowledge (known at start)
- Location and direction
- Living
- Grab and holding
- Wumpus and stench, shooting, scream, life
- Pits and breeze
- Gold and glitter
- Movement and location, direction and bumps
- Starting state of agent
- Goal
- Facts (not known)
- Location of wumpus, pits, gold
8Wumpus world in propositional logic
- Facts are propositions
- e.g., W44 Wumpus is at square (4,4)
- 96 propositions (16 each for wumpus, stench, pit,
breeze, gold, glitter) to represent a particular
cave - General knowledge in sentences
- e.g., W44?(S44 ? S43 ? S34) if the wumpus is at
(4,4), there is stench at (4,4), (4,3) and (3,4) - many sentences
9Wumpus world in propositional logic
- Facts that may change
- Location of agent, direction of agent
- Agent holding gold
- Agent has shot arrow
- Agent, wumpus are alive
- ?timed logic
- ?proliferation of propositions
10Wumpus world in FOL
- the objects in the environment
- terms constants, variables, functions
- constants
- times 0, 1, 2, ...
- headings R, L, D, U
- coordinates 1, 2, 3, 4
- locations 16 squares
- percepts Stench, Breeze, Glitter, Bump, Scream,
None - actions Turn(Left), Turn(Right), Forward, Grab,
Shoot - Agent, Wumpus
11Wumpus world in FOL
- the objects in the environment
- terms constants, variables, functions
- functions
- Square(x,y) // x,y p.259
- Home(Wumpus)
- Perception(s, b, g, h, y) // s, b, g, h, y
p.258 - Heading(t), Location(t)
12Wumpus world in FOL
- the basic knowledge
- atomic sentences predicates, termterm
- predicates (true or false)
- properties (of one term/object)
- Breezy(t) // agent feeling breeze at time t
- Breeze(s) // breeze blowing on square s
- Pit(s), Gold(s), etc.
- Time(x) // object x is a time
- Coordinate(x), Action(x), Heading(x), etc.
13Wumpus world in FOL
- the basic knowledge
- atomic sentences predicates, termterm
- predicates (true or false)
- relations (of multiple terms/objects)
- At(s,t) // agent on square s at time t
- Adjacent (r,s) // squares r and s are adjacent
- Alive(x,t) // x is alive at time t
- Percept(p,t) // perception at time t
- BestAction(a,t) // action a to take at time t
compare with p.259
14Wumpus world in FOL
- the basic knowledge
- atomic sentences predicates, termterm
- term term (true or false)
- Home(Wumpus) 3,3
- Heading(5) U
15Wumpus world in FOL
- the knowledge base
- General knowledge
- Facts that are fixed
- Facts that may change over time
Compound sentences
Atomic sentences
16Wumpus world in FOL
- the knowledge base
- General knowledge
- Facts that are constant
- Facts that may change over time
17Exploring Wumpus world in FOL
Initial conditions known unknown
After first perception P0, action
A0 known new unknown
P0
A0
18Exploring Wumpus world in FOL
After first perception P0, action
A0 known new unknown
After second perception P1, action A1
P0
P1
A0
A1
19Exploring Wumpus world in FOL
Timed atomic sentences Initial
conditions At(1,1,0) Heading(R,0) Alive(Agent,0)
Alive(Wumpus,0) then First perception Percept(S
tench,None, None, None, None,0)
20Exploring Wumpus world in FOL
Percept(Stench, None, None, None,
None,0) Understanding what is perceived ?b ?g ?h
?y ?t Percept(Stench,b,g, h, y,t)?Stinky(t) ?s
?g ?h ?y ?t Percept(s,None,g, h,
y,t)??Glittery(t) Stinky(0) ?Glittery(0) ?r ?t
Stinky(t) ? At(r,t) ? Stinks(r) ?r ?t
?Glittery(t) ? At(r,t) ? ?Glitters(r) Stinks(1,1
) ?Glitters (1,1)
Fixed knowledge
21Exploring Wumpus world in FOL
Updating timed knowledge All atomic sentences
may be different from t to t1 BUT Most are the
same UNLESS An action changes them ?r ?t At(r,t)
? (?BestAction(Forward,t) ? (Bumped(t1))
?At(r,t1) ?t Screams(t) ? ?Alive(Wumpus,t)
Time t
Time t1
22Exploring Wumpus world in FOL
Deciding the best action (incomplete description
here) Need to reason about the cave
conditions Diagnostic rules (p.259) ?s Breezy(s)
? ?r Adjacent(r,s) ? Pit(r) Causal rules
(p.260) ?r Pit(r) ? ?s Adjacent(r,s) ?
Breezy(s)