Agents that use logic
Knowledge, inference and action
in the
environment
Logic – based agents
reason by
inference on KB (search)
evaluating logical expressions
knowledge of environment
where do goals, plans, actions fit in?
in the KB or external?
D Goforth - COSC 4117, fall 2003
2
Example – reasoning only
Smith, Jones and Clark
each has a distinct job
programmer, knowledge engineer, manager
Jones owes programmer $1000
manager’s spouse doesn’t allow borrowing
Smith is not married
Who has which job?
D Goforth - COSC 4117, fall 2003
3
Knowledge
9 propositions:
Cp, Ck, Cm
Jp, Jk, Jm
Sp, Sk, Sm
29 = 512 rows in truth table
S: Smith; J: Jones; C: Clark
p: programmer; k: knowledge engineer; m: manager
D Goforth - COSC 4117, fall 2003
4
Knowledge
general knowledge
Jp \/ Sp \/ Cp // there’s a programmer
Jp => ~Sp ^ ~Cp //just one programmer
Sp => ~Jp ^ ~Cp
Cp => ~Sp ^ ~Jp
D Goforth - COSC 4117, fall 2003
5
Knowledge
general knowledge
Jp \/ Jm \/ Jk // Jones has a job
Jp => ~Jm ^ ~Jk //just one job
Jm => ~Jp ^ ~Jk
Jk => ~Jm ^ ~Jp
D Goforth - COSC 4117, fall 2003
6
Knowledge
facts
~Jp // Jones owes programmer $1000
~Jm // manager doesn’t borrow
~Sm // Smith not married, not mgr
Construct the truth table headings
D Goforth - COSC 4117, fall 2003
7
Knowledge base
9 propositions
Cp Ck Cm …
24 general knowledge
sentences
CpJpSp …
facts
~Jp ~Jm ~Sm
KB=ΛRi
Reasoning
Common Sense
Smith is not
married
Jones owes
programmer $1000
manager’s
spouse doesn’t
allow borrowing
D Goforth - COSC 4117, fall 2003
8
Dynamic environments
Logic is based on static knowledge
If agents can act to change their
environment, logical representation
has problems because “facts” are
changing
What happens to conclusions based on
original facts?
D Goforth - COSC 4117, fall 2003
9
Wumpus world
D Goforth - COSC 4117, fall 2003
10
Representing the world
Wumpus world environment facts
16
16
16
16
16
16
propositions
propositions
propositions
propositions
propositions
propositions
for
for
for
for
for
for
pits
breeze
wumpus
stench
gold
glitter
D Goforth - COSC 4117, fall 2003
11
Representing the world
Wumpus world
general knowledge
relate pits and
breezes
relate wumpus and
stench
relate gold to glitter
D Goforth - COSC 4117, fall 2003
12
Adding changing facts, plans and
actions
Wumpus world agent location and
orientation
proposition for location: L11
proposition for orientation: R, U, D, L
(facing Right, etc)
propositions for moving: Fwd, TL, TR
... plus shooting, grabbing gold.
problem – information is not static
at L23 – after move: no longer true, at L22
D Goforth - COSC 4117, fall 2003
13
Possible agent models
1. implement timed logic
Facts are true at specific time
2. keep other changing information
outside KB (e.g., position, orientation
of agent)
D Goforth - COSC 4117, fall 2003
14
Timed logic
solution: location and orientation have
time also
L111, at location (1,1) at time 1
L239
R7, facing right at time 7
R7 TR7 D8
R7 L117 Fwd7 L218
D Goforth - COSC 4117, fall 2003
15
Dynamic problem:
too many propositions
t=0
1
2
3
4
5
6
KB keeps a ‘history’ of the
activity as a series of
snapshots
D Goforth - COSC 4117, fall 2003
16
Dynamic problem:
too many propositions
t1
= 234
0 56
Partial solutions:
1. More powerful logic (next chapter)
2. Keep dynamic knowledge separate
static reasoning in KB
dynamic in:
algorithm in agent (p.226)
reflex wired agent (p.229)
D Goforth - COSC 4117, fall 2003
17
2. Static reasoning only
plus dynamic algorithm
outside
KB
2. Static reasoning only
in reflex ‘circuit’ agent
Vector of
perceptions
State
variable
Actions
2. Static reasoning only
in reflex ‘circuit’ agent
Vector of
perceptions
State
variables
Actions