Choueiry AIMA: Chapter 5 (Setions 5.1, 5.2 and 5.3) In - - PowerPoint PPT Presentation

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

Choueiry AIMA: Chapter 5 (Setions 5.1, 5.2 and 5.3) In - - PowerPoint PPT Presentation

B.Y. Title: A dv erserial Sear h Choueiry AIMA: Chapter 5 (Setions 5.1, 5.2 and 5.3) In tro dution to Artiial In telligene CSCE 476-876, Spring 2012 URL: www.se.unl.edu/ ho uei ry/ S1 2-4 76-


slide-1
SLIDE 1

✬ ✫ ✩ ✪

Title: A dv erserial Sear h AIMA: Chapter 5 (Se tions 5.1, 5.2 and 5.3) In tro du tion to Arti ial In telligen e CSCE 476-876, Spring 2012 URL:
  • www. se.unl.edu/
ho uei ry/ S1 2-4 76- 87 6 Berthe Y. Choueiry (Sh u-w e-ri) (402)472-5444 B.Y. Choueiry 1 Instru tor's notes #9 F ebruary 22, 2012
slide-2
SLIDE 2

✬ ✫ ✩ ✪

Outline
  • In
tro du tion
  • Minimax
algorithm
  • Alpha-b
eta pruning B.Y. Choueiry 2 Instru tor's notes #9 F ebruary 22, 2012
slide-3
SLIDE 3

✬ ✫ ✩ ✪

Con text
  • In
an MAS, agen ts ae t ea h
  • ther's
w elfare
  • En
vironmen t an b e
  • p
erativ e
  • r
  • mp
etitiv e
  • Comp
etitiv e en vironmen ts yield adv erserial sear h problems (games)
  • Approa
hes: mathemati al game theory and AI games B.Y. Choueiry 3 Instru tor's notes #9 F ebruary 22, 2012
slide-4
SLIDE 4

✬ ✫ ✩ ✪

Game theory vs. AI
  • AI
games: fully
  • bserv
able, deterministi en vironmen ts, pla y ers alternate, utilit y v alues are equal (dra w)
  • r
  • pp
  • site
(winner/loser) In v
  • abulary
  • f
game theory: deterministi , turn-taking, t w
  • -pla
y er, zero-sum games
  • f
p erfe t information
  • Games
are attra tiv e to AI: states simple to represen t, agen ts restri ted to a small n um b er
  • f
a tions,
  • ut ome
dened b y simple rules Not ro quet
  • r
i e ho k ey , but t ypi ally b
  • ard
games Ex eption: So er (Rob
  • up
www.robo up.org/) B.Y. Choueiry 4 Instru tor's notes #9 F ebruary 22, 2012
slide-5
SLIDE 5

✬ ✫ ✩ ✪

Board game pla ying: an app ealing target
  • f
AI resear h Board game: Chess (sin e early AI), Othello, Go, Ba kgammon, et .
  • Easy
to represen t
  • F
airly small n um b ers
  • f
w ell-dened a tions
  • En
vironmen t fairly a essible
  • Go
  • d
abstra tion
  • f
an enem y , w/o real-life (or w ar) risks :) But also: Bridge, ping-p
  • ng,
et . B.Y. Choueiry 5 Instru tor's notes #9 F ebruary 22, 2012
slide-6
SLIDE 6

✬ ✫ ✩ ✪

Chara teristi s
  • `Unpredi table'
  • pp
  • nen
t:
  • n
tingen y problem (in terlea v es sear h and exe ution)
  • Not
the usual t yp e
  • f
`un ertain t y': no randomness/no missing information (su h as in tra ) but, the mo v es
  • f
the
  • pp
  • nen
t exp e tedly non b enign
  • Challenges:
  • h
uge bran hing fa tor
  • large
solution spa e
  • Computing
  • ptimal
solution is infeasible
  • Y
et, de isions m ust b e made. F
  • rget
A*... B.Y. Choueiry 6 Instru tor's notes #9 F ebruary 22, 2012
slide-7
SLIDE 7

✬ ✫ ✩ ✪

Dis ussion
  • What
are the theoreti ally b est mo v es?
  • T
e hniques for ho
  • sing
a go
  • d
mo v e when time is tigh t

Pruning: ignore irrelev an t p
  • rtions
  • f
the sear h spa e

×

Ev aluation fun tion: appro ximate the true utilit y
  • f
a state without doing sear h B.Y. Choueiry 7 Instru tor's notes #9 F ebruary 22, 2012
slide-8
SLIDE 8

✬ ✫ ✩ ✪

T w
  • -p
erson Games
  • 2
pla y er: Min and Max
  • Max
mo v es rst
  • Pla
y ers alternate un til end
  • f
game
  • Gain
a w arded to pla y er/p enalt y giv e to loser Game as a sear h problem:
  • Initial
state: b
  • ard
p
  • sition
& indi ation whose turn it is
  • Su essor
fun tion: dening legal mo v es a pla y er an tak e Returns {(mo v e, state)∗ }
  • T
erminal test: determining when game is
  • v
er states satisfy the test: terminal states
  • Utilit
y fun tion (a.k.a. pa y
  • fun tion):
n umeri al v alue for
  • ut ome
e.g., Chess: win=1, loss=-1, dra w=0 B.Y. Choueiry 8 Instru tor's notes #9 F ebruary 22, 2012
slide-9
SLIDE 9

✬ ✫ ✩ ✪

Usual sear h Max nds a sequen e
  • f
  • p
erators yielding a terminal goal s oring winner a ording to the utilit y fun tion Game sear h
  • Min
a tions are signi an t Max m ust nd a strategy to win regardless
  • f
what Min do es:

− →

  • rre t
a tion for Max for ea h a tion
  • f
Min
  • Need
to appro ximate (no time to en visage all p
  • ssibilities
di ult y): a h uge state spa e, an ev en more h uge sear h spa e e.g., hess:

8 < : 1040

dieren t legal p
  • sitions
A v erage bran hing fa tor=35, 50 mo v es/pla y er= 35100
  • P
erforman e in terms
  • f
time is v ery imp
  • rtan
t B.Y. Choueiry 9 Instru tor's notes #9 F ebruary 22, 2012
slide-10
SLIDE 10

✬ ✫ ✩ ✪

Example: Ti -T a -T
  • e
Max has 9 alternativ e mo v es T erminal states' utilit y: Max wins=1, Max loses =
  • 1,
Dra w =

X X X X X X X X X X X O O X O O X O X O X . . . . . . . . . . . . . . . . . . . . . X X

–1 +1

X X X X O X X O X X O O O X X X O O O O O X X

MAX (X) MIN (O) MAX (X) MIN (O) TERMINAL Utility

B.Y. Choueiry 10 Instru tor's notes #9 F ebruary 22, 2012
slide-11
SLIDE 11

✬ ✫ ✩ ✪

Example: 2-ply game tree Max's a tions: a1 , a2 , a3 Min's a tions: b1 , b2 , b3

MAX

A B C D 3 12 8 2 4 6 14 5 2 3 2 2 3 a1 a2 a3 b1 b2 b3

  • c1

c2 c3 d1 d2 d3

MIN

Minimax algorithm determines the
  • ptimal
strategy for Max

de ides whi h is the b est mo v e B.Y. Choueiry 11 Instru tor's notes #9 F ebruary 22, 2012
slide-12
SLIDE 12

✬ ✫ ✩ ✪

Minimax algorithm
  • Generate
the whole tree, do wn to the lea v es
  • Compute
utilit y
  • f
ea h terminal state
  • Iterativ
ely , from the lea v es up to the ro
  • t,
use utilit y
  • f
no des at depth d to
  • mpute
utilit y
  • f
no des at depth (d − 1): MIN `ro w': minim um
  • f
hildren MAX `ro w': maxim um
  • f
hildren Minimax-V alue (n )

8 > > < > > :

Utility(n) if n is a terminal no de

maxs∈Succ(n)

Minimax-V alue(s) if n is a Max no de

mins∈Succ(n)

Minimax-V alue(s) if n is a Min no de B.Y. Choueiry 12 Instru tor's notes #9 F ebruary 22, 2012
slide-13
SLIDE 13

✬ ✫ ✩ ✪

Minimax de ision
  • MAX's
de ision: minimax de ision maximizes utilit y under the assumption that the
  • pp
  • nen
t will pla y p erfe tly to his/her
  • wn
adv an tage
  • Minimax
de ision maximes the w
  • rst- ase
  • ut ome
for Max (whi h
  • therwise
is guaran teed to do b etter)
  • If
  • pp
  • nen
t is sub-optimal,
  • ther
strategies ma y rea h b etter
  • ut ome
b etter than the minimax de ision B.Y. Choueiry 13 Instru tor's notes #9 F ebruary 22, 2012
slide-14
SLIDE 14

✬ ✫ ✩ ✪

Minimax algorithm: Prop erties
  • m
maxim um depth

b

legal mo v es
  • Using
Depth-rst sear h, spa e requiremen t is:

O(bm):

if generating all su essors at
  • n e

O(m):

if
  • nsidering
su essors
  • ne
at a time
  • Time
  • mplexit
y O(bm) Real games: time
  • st
totally una eptable B.Y. Choueiry 14 Instru tor's notes #9 F ebruary 22, 2012
slide-15
SLIDE 15

✬ ✫ ✩ ✪

Multiple pla y ers games Utility(n ) b e omes a v e tor
  • f
the size
  • f
the n um b er
  • f
pla y ers F
  • r
ea h no de, the v e tor giv es the utilit y
  • f
the state for ea h pla y er

to move A B C A

(1, 2, 6) (4, 2, 3) (6, 1, 2) (7, 4,1) (5,1,1) (1, 5, 2) (7, 7,1) (5, 4, 5) (1, 2, 6) (6, 1, 2) (1, 5, 2) (5, 4, 5) (1, 2, 6) (1, 5, 2) (1, 2, 6)

X

  • B.Y.
Choueiry 15 Instru tor's notes #9 F ebruary 22, 2012
slide-16
SLIDE 16

✬ ✫ ✩ ✪

Allian e formation in m ultiple pla y ers games Ho w ab
  • ut
allian es?
  • A
and B in w eak p
  • sitions,
but C in strong p
  • sition
A and B mak e an allian e to atta k C (rather than ea h
  • ther

Collab
  • ration
emerges from purely selsh b eha vior!
  • Allian es
an b e done and undone ( areful for so ial stigma!)
  • When
a t w
  • -pla
y er game is not zero-sum, pla y ers ma y end up automati ally making allian es (for example when the terminal state maximizes utilit y
  • f
b
  • th
pla y ers) B.Y. Choueiry 16 Instru tor's notes #9 F ebruary 22, 2012
slide-17
SLIDE 17

✬ ✫ ✩ ✪

Alpha-b eta pruning
  • Minimax
requires
  • mputing
all terminal no des: una eptable
  • Do
w e really need to do
  • mpute
utilit y
  • f
all terminal no des? ... No, sa ys John M Carth y in 1956: It is p
  • ssible
to
  • mpute
the
  • rr
e t minimax de ision without lo
  • king
at every no de in the tr e e, and yet get the
  • rr
e t de ision
  • Use
pruning (eliminating useless bran hes in a tree) B.Y. Choueiry 17 Instru tor's notes #9 F ebruary 22, 2012
slide-18
SLIDE 18

✬ ✫ ✩ ✪

Example
  • f
alpha-b eta pruning

(a) (b) (c) (d) (e) (f)

3 3 12 3 12 8 3 12 8 2 3 12 8 2 14 3 12 8 2 14 5 2

A B A B A B C D A B C D A B A B C

[−∞, +∞] [−∞, +∞] [3, +∞] [3, +∞] [3, 3] [3, 14] [−∞, 2] [−∞, 2] [2, 2] [3, 3] [3, 3] [3, 3] [3, 3] [−∞, 3] [−∞, 3] [−∞, 2] [−∞, 14]

T ry 14, 5, 2, 6 b elo w D B.Y. Choueiry 18 Instru tor's notes #9 F ebruary 22, 2012
slide-19
SLIDE 19

✬ ✫ ✩ ✪

General prin ipal
  • f
Alpha-b eta pruning If Pla y er has a b etter hoi e m at

8 < :

  • a
paren t no de
  • f n
  • an
y hoi e p
  • in
t further up

n

will nev er b e rea hed in a tual pla y

Player Opponent Player Opponent .. .. .. m n

On e w e ha v e found enough ab
  • ut n
(e.g., through
  • ne
  • f
it des endan ts), w e an prune it (i.e., dis ard all its remaining des endan ts) B.Y. Choueiry 19 Instru tor's notes #9 F ebruary 22, 2012
slide-20
SLIDE 20

✬ ✫ ✩ ✪

Me hanism
  • f
Alpha-b eta pruning

α :

v alue
  • f
b est hoi e so far for MAX, (maxim um)

β

: v alue
  • f
b est hoi e so far for MIN, (minim um)

Player Opponent Player Opponent .. .. .. m n

Alpha-b eta sear h:
  • up
dates the v alue
  • f α , β
as it go es along
  • prunes
a subtree as so
  • n
as its w
  • rse
then urren t α
  • r β
B.Y. Choueiry 20 Instru tor's notes #9 F ebruary 22, 2012
slide-21
SLIDE 21

✬ ✫ ✩ ✪

Ee tiv eness
  • f
pruning Ee tiv eness
  • f
pruning dep ends
  • n
the
  • rder
  • f
new no des examined

(a) (b) (c) (d) (e) (f)

3 3 12 3 12 8 3 12 8 2 3 12 8 2 14 3 12 8 2 14 5 2

A B A B A B C D A B C D A B A B C

[−∞, +∞] [−∞, +∞] [3, +∞] [3, +∞] [3, 3] [3, 14] [−∞, 2] [−∞, 2] [2, 2] [3, 3] [3, 3] [3, 3] [3, 3] [−∞, 3] [−∞, 3] [−∞, 2] [−∞, 14]

B.Y. Choueiry 21 Instru tor's notes #9 F ebruary 22, 2012
slide-22
SLIDE 22

✬ ✫ ✩ ✪

Sa vings in terms
  • f
  • st
  • Ideal
ase: Alpha-b eta examines O(bd/2) no des (vs. Minimax: O(bd))

Ee tiv e bran hing fa tor

√ b

(vs. Minimax: b)
  • Su essors
  • rdered
randomly:

b > 1000,

asymptoti
  • mplexit
y is O((b/ log b)d)

b

reasonable, asymptoti
  • mplexit
y is O(b3d/4)
  • Pra ti ally:
F airly simple heuristi s w
  • rk
(fairly) w ell B.Y. Choueiry 22 Instru tor's notes #9 F ebruary 22, 2012