Supplemental slides for CSE 327 Prof Jeff Heflin GoalBased Agent sensors actuators Agent Environment What the world is like now What action I should do now Goals State How the world evolves ID: 538653
Download Presentation The PPT/PDF document "Ch. 7 – Logical Agents" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Ch. 7 – Logical Agents
Supplemental slides for CSE 327
Prof. Jeff HeflinSlide2
Goal-Based Agent
sensors
actuators
Agent
Environment
What the world is like now
What action I should do now
Goals
State
How the world evolves
What my actions do
What it will be like if I do action A
From Fig. 2.13, p. 52Slide3
Knowledge-Based Agent
function
KB-Agent
(
percept) returns an action persistent: KB, a knowledge base t, a counter, initially 0 indicating time Tell(KB, Make-Percept-Sentence(percept, t)) action ASK(KB, Make-Action-Query(t)) Tell(KB, Make-Action-Sentence(action, t)) t
t + 1 return action
From Figure 7.1, p. 236Slide4
Example KB Sentences
For an adventure game AI, specified informally:
State of the world
I am healthyA wall is in front of me
Effects of actionsIf I fall in a pit, I will dieIf I shoot something, I will injure itChanging goalsIf I see an enemy, then attackIf I am injured, then retreatSlide5
Grammar for Propositional Logic
Sentence
AtomicSentence
| ComplexSentenceAtomicSentence True | False | SymbolSymbol P | Q | R | …ComplexSentence ( Sentence ) | [ Sentence ] |
Sentence |
(Sentence Sentence
) | (Sentence
Sentence) | (
Sentence Sentence) | (
Sentence
Sentence)
From Figure 7.7, p. 244Slide6
Checking Entailment
P
Q
R
1:
PQ
2
:
Q
3
:Q
R
KB:
1
2
3
P
R
P
R
F
F
F
T
T
T
T
T
F
T
F
F
T
T
T
T
T
T
T
T
F
T
FTFFFTFTFTTTFTFTTTTFFFTTFFFFTFTFTTFFTTTTFTFFFFFFTTTTFTFFTT
Assume KB={PQ, Q, QR}
Entailed!
Entailed!
Not Entailed!Slide7
Inference via Model Checking
function
TT-Entails?
(
KB, ) returns true or false symbols a list of the proposition symbols in KB and return TT-Check-All(KB, , symbols, {})function
TT-Check-All(KB, ,
symbols, model)
returns true or
false
if Empty?(
symbols
) then
if PL-True?(KB, model
) then
return
PL-True?(, model)
else
return true
else do
P
First(symbols
); rest Rest
(symbols)
return TT-Check-All(KB,
,
rest, model
{P=
true} and
TT-Check-All(
KB, ,
rest, model
{P=false
})
From Figure 7.10, p. 248Slide8
Wumpus World Agent
function
HYBRID-WUMPUS-AGENT
(
percept) returns an action inputs: percept, a list [stench, breeze, glitter] persistent: KB, a knowledge base, contains “rules” of the Wumpus world x, y, orientation, the agent’s position visited, array of squares visited by agent, initially empty action, most recent action, initially null plan, an action sequence, initially empty update x, y, orientation, visited based on action if stench then
Tell(KB, Sx,y) else
Tell(KB, Sx,y)
if breeze
then Tell(KB, Bx,y
) else Tell(KB, B
x,y)
if glitter
then action grab else if plan is nonempty then
action
Pop(plan)
else if for some frontier square [i,j], Ask(KB, (
Pi,j
Wi,j
)) is true or
for some frontier square
[i,j],
Ask(KB, (Pi,j
W
i,j )) is false
then do
plan
A*-Graph-Search(Route-Problem([x,y
], orientation, [i,j
], visited))
action Pop(
plan)
else action a randomly chosen move
return action
Simplified version of agent described in Figure 7.20, p. 270