cse@buffal
o
A SNePS Approach to The Wumpus World Agent
or Cassie Meets the WumpusStuart C. Shapiro & Michael Kandefer Department of Computer Science and Engineering,
and Center for Cognitive Science
University at Buffalo, The State University of New York201 Bell Hall, Buffalo, NY 14260-2000
{shapiro|mkw3}@cse.buffalo.eduhttp://www.cse.buffalo.edu/~{shapiro|mkw3}/
NRAC-05 S. C. Shapiro & M. Kandefer 2
cse@buffal
o
: perform get(gold)No breeze here.No stench here.Exploring the cave...Found a safe room...
NRAC-05 S. C. Shapiro & M. Kandefer 3
cse@buffal
o
I am in room (1, 0), facing eastNo breeze here.No stench here.Exploring the cave...Found a safe room...
NRAC-05 S. C. Shapiro & M. Kandefer 4
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 5
cse@buffal
o
I am in room (1, 1), facing southI feel a breeze.No stench here.Exploring the cave...Found a safe room...
NRAC-05 S. C. Shapiro & M. Kandefer 6
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 7
cse@buffal
o
I am in room (0, 1), facing westNo breeze here.No stench here.Exploring the cave...Found a safe room...
NRAC-05 S. C. Shapiro & M. Kandefer 8
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 9
cse@buffal
o
I am in room (0, 2), facing southI feel a breeze.No stench here.Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 10
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 11
cse@buffal
o
Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 12
cse@buffal
o
Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 13
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 14
cse@buffal
o
Exploring the cave...Found a safe room...
NRAC-05 S. C. Shapiro & M. Kandefer 15
cse@buffal
o
I am in room (2, 0), facing eastI feel a breeze.No stench here.Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 16
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 17
cse@buffal
o
Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 18
cse@buffal
o
Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 19
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 20
cse@buffal
o
Exploring the cave...Visiting an old room...This is boring.
NRAC-05 S. C. Shapiro & M. Kandefer 21
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 22
cse@buffal
o
Exploring the cave...I'll chance a move...
NRAC-05 S. C. Shapiro & M. Kandefer 23
cse@buffal
o
I am in room (1, 2), facing southNo breeze here.I'm grabbing for the gold.No stench here.I'm going home!
NRAC-05 S. C. Shapiro & M. Kandefer 24
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 25
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 26
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 27
cse@buffal
o
NRAC-05 S. C. Shapiro & M. Kandefer 28
cse@buffal
o
Score = 966.
NRAC-05 S. C. Shapiro & M. Kandefer 29
cse@buffal
o
Formalism Used
• SNePS KRR system• SNeRE acting subsystem
NRAC-05 S. C. Shapiro & M. Kandefer 30
cse@buffal
o
Strategy
• Wander semi-randomly until find gold– Opportunistically shoot the wumpus
• Grab the gold• Go home• Stop
NRAC-05 S. C. Shapiro & M. Kandefer 31
cse@buffal
o
Semi-Random Exploration
• If have an adjacent safe new room, go there• Else if totally bored,
– Risk going to any adjacent new room• Might die!
– If none move randomly (boring)• Else go to an old room (boring)
NRAC-05 S. C. Shapiro & M. Kandefer 32
cse@buffal
o
Finding Home
• Lay down VisitedFrom(r2, r1) “arrows” while exploring.
• No two with same r2 to cut loops.• Follow backwards to find home.
NRAC-05 S. C. Shapiro & M. Kandefer 33
cse@buffal
o
Finding Walls
• Two walls adjacent to home room known• When bump, believe wall location
NRAC-05 S. C. Shapiro & M. Kandefer 34
cse@buffal
o
Important SNePS Features 1
• First-person beliefs– Not third-person “truth” about agent or world
• Beliefs are current beliefs– Even if about the past
• On-line acting• Reified propositions as well as acts & …• Neither states nor times are privileged
NRAC-05 S. C. Shapiro & M. Kandefer 35
cse@buffal
o
Important SNePS Features 2• SNeRE acts with operational semantics
– External acts:• go(right)• do(grab)• senseFor(breeze)
– Control acts:• snsequence(go(right), go(right))
– Mental acts:• believe(p)• disbelieve(p)
NRAC-05 S. C. Shapiro & M. Kandefer 36
cse@buffal
o
Important SNePS Features 3
• SNeRE policies integrate reasoning & acting– whendo(See(glitter), do(grab))– ActPlan(find(home), snif({if(In(cell(0,0)), do(stop)), else(…)}))
NRAC-05 S. C. Shapiro & M. Kandefer 37
cse@buffal
o
Important SNePS Features 4Use of SNePS andor connective
and belief revision for state constraints:
andor(1,1){Facing(north), Facing(south), Facing(east), Facing(west)}Facing(east)=> ~Facing(north), ~Facing(south), ~Facing(west)believe(Facing(south))
Facing(south), ~Facing(north),~Facing(east), ~Facing(west)
NRAC-05 S. C. Shapiro & M. Kandefer 38
cse@buffal
oImportant SNePS Features 5
Nondeterministic Choice~Have(gold) =>(all(r1)(In(r1) => ActPlan(explore(cave), withsome({?r2, ?d1}, SafeNewRoom(r1, ?r2, ?d1), snsequence3(turn(?d1), move(forward), believe(Bored(0))), <else clause>))))
NRAC-05 S. C. Shapiro & M. Kandefer 39
cse@buffal
oImportant SNePS Features 6
Numerical Quantifier
wheneverdo(Feel(breeze), withsome/3(?r, In(?r), believe(nexists(1,4,4)(c)({Adjacent(?r,c)}: {Contains(c,pit)}))))
NRAC-05 S. C. Shapiro & M. Kandefer 40
cse@buffal
o
Problems• The SNePS control structure
– Asynchronous– Multiprocessing– Producer/consumer– Message passing– Focused bidirectional inference
• Made designing the agent, viewed as a programming task, somewhat difficult.