Choueiry AIMA: Chapter 7 (Setions 7.1, 7.2, and 7.3) In - - PowerPoint PPT Presentation

choueiry aima chapter 7 se tions 7 1 7 2 and 7 3 in tro
SMART_READER_LITE
LIVE PREVIEW

Choueiry AIMA: Chapter 7 (Setions 7.1, 7.2, and 7.3) In - - PowerPoint PPT Presentation

B.Y. Title: Logial Agen ts Choueiry AIMA: Chapter 7 (Setions 7.1, 7.2, and 7.3) In tro dution to Artiial In telligene CSCE 476-876, Spring 2016 URL: www.se.unl.edu/~ ho uei ry/ S1 6-4 76- 87 6 1


slide-1
SLIDE 1

✬ ✫ ✩ ✪

Title: Logi al Agen ts AIMA: Chapter 7 (Se tions 7.1, 7.2, and 7.3) In tro du tion to Arti ial In telligen e CSCE 476-876, Spring 2016 URL:
  • www. se.unl.edu/~
ho uei ry/ S1 6-4 76- 87 6 Berthe Y. Choueiry (Sh u-w e-ri) (402)472-5444 B.Y. Choueiry 1 Instru tor's notes #11 Mar h 16, 2016
slide-2
SLIDE 2

✬ ✫ ✩ ✪

Outline
  • W
umpus w
  • rld:
motiv ating example
  • Kno
wledge bases
  • Logi
for Kno wledge Represen tation & Reasoning
  • Syn
tax
  • Seman
ti s
  • Inferen e
me hanisms:
  • mplexit
y ,
  • mpleteness
Prop
  • sitional
logi /sen ten tial logi Predi ate logi /rst-order logi B.Y. Choueiry 2 Instru tor's notes #11 Mar h 16, 2016
slide-3
SLIDE 3

✬ ✫ ✩ ✪

Motiv ating example: The W umpus w
  • rld
Early
  • mputer
game Agen t explores a a v e with:
  • b
  • ttomless
pits
  • a
b east that eats an y
  • ne
who en ters the ro
  • m,
and
  • heap
  • f
gold to trap

Breeze Breeze Breeze Breeze Breeze

Stench Stench

Breeze

PIT PIT PIT

1 2 3 4 1 2 3 4

START

Gold

Stench

B.Y. Choueiry 3 Instru tor's notes #11 Mar h 16, 2016
slide-4
SLIDE 4

✬ ✫ ✩ ✪

PEAS des ription
  • f
the W umpus w
  • rld
P erforman e measure: gold +1000, death
  • 1000,
  • 1
p er step,
  • 10
for using the arro w En vironmen t: Squares adja en t to W umpus are smelly Squares adja en t to pit are breezy Glitter i gold is in the same square Sho
  • ting
kills W umpus if y
  • u
are fa ing it Sho
  • ting
uses up the
  • nly
arro w Grabbing pi ks up gold if in same square Releasing drops the gold in same square Sensors: Breeze, Glitter, Smell A tuators: Left turn, Righ t turn, F
  • rw
ard, Grab, Release, Sho
  • t
B.Y. Choueiry 4 Instru tor's notes #11 Mar h 16, 2016
slide-5
SLIDE 5

✬ ✫ ✩ ✪

W umpus W
  • rld:
Chara terization Is the w
  • rld:
  • Observ
able? No,
  • nly
lo al p er eption
  • Deterministi ?
Y es,
  • ut ome
exa tly sp e ied
  • Episo
di ? No, sequen tial at the lev el
  • f
a tions
  • Stati ?
Y es, W umpus/Pits don't mo v e
  • Dis rete?
Y es
  • Single-agen
t? Y es, W umpus
  • nsidered
a natural feature B.Y. Choueiry 5 Instru tor's notes #11 Mar h 16, 2016
slide-6
SLIDE 6

✬ ✫ ✩ ✪

Empiri al ev aluations: single/m ultiple
  • nguration
An agen t an do w ell in a single en vironmen t: learns the en vironmen t, exe utes rules. Agen t m ust b e tested in a
  • mplete
lass
  • f
en vironmen ts and its a v erage p erforman e m ust b e determined → empiri al exp erimen ts
  • Constrain
ts: start from p
  • sition
[1,1℄, limited to 4×4 grid
  • Lo
ation
  • f
W umpus and Gold hosen randomly with a uniform distribution (all squares are p
  • ssible
ex ept [1,1℄)
  • Ea
h square, ex ept [1,1℄, an b e a pit with probabilit y 0.2
  • T
erribly bad ases: gold in a pit
  • r
surrounded b y pits B.Y. Choueiry 6 Instru tor's notes #11 Mar h 16, 2016
slide-7
SLIDE 7

✬ ✫ ✩ ✪

W umpus W
  • rld:
A ting & Reasoning
  • After
re eiving initial p er epts, agen t kno ws it is in [1,1℄ and it is OK
  • No
sten h
  • r
breeze in [1,1℄ ⇒ [1,2℄ and [2,1℄ are danger-free
  • Cautious
agen t mo v es
  • nly
to square it kno ws it is OK
  • Agen
t mo v es
  • nly
to square [2,1℄, dete ts breeze y ⇒ ∃ a pit in neigh b
  • ring
squares [1,1℄, [2,2℄ and [3,1℄. Agen t kno ws no pit in [1,1℄ → Pit indi ated in [2,2℄ and [3,1℄ with P?
  • Not
visited OK squares? Only [1,2℄. Agen t go es to [1,1℄, pro eeds to [1,2℄ B.Y. Choueiry 7 Instru tor's notes #11 Mar h 16, 2016
slide-8
SLIDE 8

✬ ✫ ✩ ✪

W umpus W
  • rld:
A ting & Reasoning

Breeze Breeze Breeze Breeze Breeze Stench Stench Breeze

PIT PIT PIT

1 2 3 4 1 2 3 4 START

Gold Stench

A B G P S W = Agent = Breeze = Glitter, Gold = Pit = Stench = Wumpus OK = Safe square V = Visited A OK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 OK OK B P? P? A OK OK OK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 V

(a) (b)

B.Y. Choueiry 8 Instru tor's notes #11 Mar h 16, 2016
slide-9
SLIDE 9

✬ ✫ ✩ ✪

W umpus W
  • rld:
A ting & Reasoning
  • Agen
ts dete ts sten h in [1,2℄ ⇒ W umpus nearb y! P
  • ssibilities:
[1,1℄, [1,3℄
  • r
[2,2℄. Agen t kno ws [1,1℄ is W umpus-free (Agen t w as there!) Agen t an infer [2,2℄ is W umpus-free ( ∃ sten h in [2,1℄) Agen t infers W umpus is in [1,3℄ (W!)
  • La
k
  • f
breeze in [1,2℄ ⇒ [2,2℄ is pit-free But, ∃ a pit in either [2,2℄
  • r
[3,1℄ ⇒ ∃ pit in [3,1℄ (P!) Inferen e
  • m
bines kno wledge gained at dieren t times and pla es, b ey
  • nd
the abilities
  • f
most animals, but Logi al Inferen e an handle this
  • Sin e
[2,2℄ is OK and not visited, Agen t mo v es there
  • et .
B.Y. Choueiry 9 Instru tor's notes #11 Mar h 16, 2016
slide-10
SLIDE 10

✬ ✫ ✩ ✪

W umpus W
  • rld:
A ting & Reasoning

Breeze Breeze Breeze Breeze Breeze Stench Stench Breeze

PIT PIT PIT

1 2 3 4 1 2 3 4 START

Gold Stench

B B P! A OK OK OK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 V OK W! V P! A OK OK OK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 V S OK W! V V V B S G P? P?

(b) (a)

S A B G P S W = Agent = Breeze = Glitter, Gold = Pit = Stench = Wumpus OK = Safe square V = Visited

B.Y. Choueiry 10 Instru tor's notes #11 Mar h 16, 2016
slide-11
SLIDE 11

✬ ✫ ✩ ✪

The p
  • in
t
  • f
the W umpus w
  • rld
In ea h ase where the agen t dra ws a
  • n lusion
from the a v ailable information, that
  • n lusions
is guaran teed to b e
  • rre t
if the a v ailable information is
  • rre t.

− →

F undamen tal prop ert y
  • f
logi al reasoning. B.Y. Choueiry 11 Instru tor's notes #11 Mar h 16, 2016
slide-12
SLIDE 12

✬ ✫ ✩ ✪

Kno wledge Base A fa t in the w
  • rld:
A represen tation
  • f
a fa t in the w
  • rld
A sen ten e= a represen tation
  • f
a fa t in the w
  • rld
in a formal language A Kno wledge Based (KB): A set sen ten es A set (of represen tations)
  • f
fa ts ab
  • ut
the w
  • rld
Issues: A ess to KB, Represen tation (language), Reasoning (inferen e) B.Y. Choueiry 12 Instru tor's notes #11 Mar h 16, 2016
slide-13
SLIDE 13

✬ ✫ ✩ ✪

Lev el
  • f
Kno wledge Agen ts an b e view ed at v arious lev els: 1. Epistemologi al: Abstra t des ription
  • f
what the agen t kno ws ab
  • ut
the w
  • rld
2. Logi al: En o ding
  • f
kno wledge in to sen ten es 3. Implemen tation: A tual implemen tation (lists, arra ys, hash tables, et .)
  • V
ery imp
  • rtan
t for p erforman e
  • f
agen t
  • Irrelev
an t for higher lev els
  • f
kno wledge B.Y. Choueiry 13 Instru tor's notes #11 Mar h 16, 2016
slide-14
SLIDE 14

✬ ✫ ✩ ✪

A simple KB-agen t

function KB-AGENT( percept) returns an action static: 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

The agen t m ust b e able to: represen t states, a tions, et . in orp
  • rate
new p er epts up date in ternal represen tations
  • f
the w
  • rld
dedu e hidden prop erties
  • f
the w
  • rld
dedu e appropriate a tions B.Y. Choueiry 14 Instru tor's notes #11 Mar h 16, 2016
slide-15
SLIDE 15

✬ ✫ ✩ ✪

Kno wledge-Based Agen t

function KB-AGENT( percept) returns an action static: 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

P er eiv es: T ells KB ab
  • ut
new p er epts (new sen ten es) Represen tation: Make-Per ept-Senten e A ess to KB: Asks KB ab
  • ut
a tions to tak e (inferen e) T w
  • primitiv
es: Ask and Tell hide reasoning details A ts: T ells KB ab
  • ut
a tions (new sen ten es) Represen tation: Make-A tion-Senten e, Make-A tion-Quer y B.Y. Choueiry 15 Instru tor's notes #11 Mar h 16, 2016
slide-16
SLIDE 16

✬ ✫ ✩ ✪

Logi in general Logi s are formal languages for represen ting information su h that
  • n lusions
an b e dra wn Syn tax denes the sen ten es in the language (grammar) Seman ti s dene the meaning
  • f
sen ten es; i.e., dene truth
  • f
a sen ten e in a w
  • rld
Example: the language
  • f
arithmeti
  • Syn
tax: x + 2 ≥ y is a sen ten e; x2 + y > is not a sen ten e
  • Seman
ti s: x + 2 ≥ y is true i the n um b er x + 2 is no less than the n um b er y x + 2 ≥ y is true in a w
  • rld
where x = 7, y = 1 x + 2 ≥ y is false in a w
  • rld
where x = 0, y = 6 B.Y. Choueiry 16 Instru tor's notes #11 Mar h 16, 2016
slide-17
SLIDE 17

✬ ✫ ✩ ✪

T yp es
  • f
logi Logi s are hara terized b y what they
  • mmit
to as primitiv es On tologi al
  • mmitmen
t : what existsfa ts?
  • b
je ts? time? b eliefs? Epistemologi al
  • mmitmen
t : what states
  • f
kno wledge?

Language Ontological Commitment Epistemological Commitment (What exists in the world) (What an agent believes about facts) Propositional logic facts true/false/unknown First-order logic facts, objects, relations true/false/unknown Temporal logic facts, objects, relations, times true/false/unknown Probability theory facts degree of belief 0…1 Fuzzy logic degree of truth degree of belief 0…1

B.Y. Choueiry 17 Instru tor's notes #11 Mar h 16, 2016
slide-18
SLIDE 18

✬ ✫ ✩ ✪

Kno wledge represen tation & reasoning

Follows Sentences Facts Sentence Fact Entails

Semantics Semantics

Representation World

F a ts: in the w
  • rld
Represen tations: in the
  • mputer
Reasoning: pro ess
  • f
  • nstru ting
new represen tations from
  • ld
  • nes
Prop er Reasoning: ensures new represen tations
  • rresp
  • nd
to fa ts that a tually follo w from fa ts in the w
  • rld
B.Y. Choueiry 18 Instru tor's notes #11 Mar h 16, 2016
slide-19
SLIDE 19

✬ ✫ ✩ ✪

En tailmen t En tailmen t means that
  • ne
thing follo ws from another: (KB |

= α )

Kno wledge base KB en tails sen ten e α i α is true in all w
  • rlds
where KB is true Example: KB: {a ∧ b}, then KB |

= a;

KB |

= b;

KB |

= a ∨ b

En tailmen t is a relationship b et w een sen ten es (i.e., syn tax) that is based
  • n
seman ti s (α |

= β

): the truth
  • f β
  • n
tains the truth
  • f α
F
  • r
example: (x + y = 4) |

= (4 = x + y), (x + y = 4) | = (4 ≥ x + y), (x + y ≥ 4) | = (4 = x + y),

B.Y. Choueiry 19 Instru tor's notes #11 Mar h 16, 2016
slide-20
SLIDE 20

✬ ✫ ✩ ✪

Mo dels Logi ians t ypi ally think in terms
  • f
mo dels, whi h are formally stru tured w
  • rlds
with resp e t to whi h truth an b e ev aluated W e sa y m is a mo del
  • f
a sen ten e α if α is true in m

M(α)

is the set
  • f
all mo dels
  • f α
Then KB |

= α

if and
  • nly
if M(KB) ⊆ M(α)
  • M( )

α M(KB)

B.Y. Choueiry 20 Instru tor's notes #11 Mar h 16, 2016
slide-21
SLIDE 21

✬ ✫ ✩ ✪

En tailmen t in the W umpus w
  • rld
Situation: Agen t dete ted nothing in [1,1℄, breeze in [2,1℄ 23 =8 p
  • ssible
mo dels P er epts + the PEAS des ription = KB Agen t w
  • nders
whether pit is in [1,2℄, [2,2℄, and [3,1℄: Only 3 mo dels where the KB is true

α1

= no pit in [1,2℄:

α1

is true in 4 mo dels.

1 2 3 1 2 PIT 1 2 3 1 2 PIT 1 2 3 1 2 PIT PIT PIT 1 2 3 1 2 PIT PIT 1 2 3 1 2 PIT 1 2 3 1 2 PIT PIT 1 2 3 1 2 PIT PIT 1 2 3 1 2

KB

α1

B r ee z e B r e e z e B r e e z e B r e e z e B r e e z e B r e e z e B r e e z e B r e e z e B.Y. Choueiry 21 Instru tor's notes #11 Mar h 16, 2016
slide-22
SLIDE 22

✬ ✫ ✩ ✪

En tailmen t in the W umpus w
  • rld

1 2 3 1 2

PIT

1 2 3 1 2

PIT

1 2 3 1 2

PIT PIT PIT

1 2 3 1 2

PIT PIT

1 2 3 1 2

PIT

1 2 3 1 2

PIT PIT

1 2 3 1 2

PIT PIT

1 2 3 1 2

KB

α1

B r e e z e B r e e z e B r ee z e B r ee z e B r ee z e B r e e z e B r e e z e B r ee z e

Consider: α1 = no pit in [1,2℄, α2 = no pit in [2,2℄ Mo del he king: KB |

= α1

, KB |

= α2

Giv en KB, agen t annot
  • n lude
whether α2 holds
  • r
not En tailmen t an b e used to deriv e
  • n lusions:
Inferen e Inferen e here is done b y mo del he king B.Y. Choueiry 22 Instru tor's notes #11 Mar h 16, 2016
slide-23
SLIDE 23

✬ ✫ ✩ ✪

Inferen e KB ⊢i α ≡ α is deriv ed from KB b y pro edure i Consequen es
  • f
KB are a ha ysta k; α is a needle. En tailmen t = needle in ha ysta k; inferen e = nding it Soundness: i is sound if whenev er KB ⊢i α , it is also true that KB |

= α

Completeness: i is
  • mplete
if whenev er KB |

= α

, it is also true that KB ⊢i α That is, the pro edure will answ er an y question whose answ er follo ws from what is kno wn b y the KB The re ord
  • f
  • p
eration
  • f
a sound inferen e pro edure is a pro
  • f
Next, prop
  • sitional
logi : syn tax, seman ti s, and inferen e B.Y. Choueiry 23 Instru tor's notes #11 Mar h 16, 2016