B.Y. Title: A dv erserial Sear h ✫ ✬ Choueiry 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 1 Berthe Y. Choueiry (Sh u-w e-ri) (402)472-5444 Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
B.Y. ✫ ✬ Choueiry Outline In tro du tion Minimax algorithm Alpha-b eta pruning • 2 • • Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
B.Y. ✫ ✬ Choueiry Con text In an MAS, agen ts a�e t ea h other's w elfare En vironmen t an b e o op erativ e or omp etitiv e Comp etitiv e en vironmen ts yield adv erserial sear h problems • (games) • Approa hes: mathemati al game theory and AI games 3 • • Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
Game theory vs. AI B.Y. ✫ ✬ AI games: fully observ able, deterministi en vironmen ts, pla y ers Choueiry alternate, utilit y v alues are equal (dra w) or opp osite (winner/loser) In v o abulary of game theory: deterministi , turn-taking, • t w o-pla y er, zero-sum games of 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 of a tions, out ome de�ned b y simple rules 4 Not ro quet or i e ho k ey , but t ypi ally b oard games • Ex eption: So er (Rob o up www.robo up.org/ ) Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
Board game pla ying: an app ealing target of AI resear h B.Y. ✫ ✬ Choueiry Board game: Chess (sin e early AI), Othello, Go, Ba kgammon, et . - Easy to represen t - F airly small n um b ers of w ell-de�ned a tions - En vironmen t fairly a essible - Go o d abstra tion of an enem y , w/o real-life (or w ar) risks :�) 5 But also: Bridge, ping-p ong, et . Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
Chara teristi s B.Y. ✫ ✬ `Unpredi table' opp onen t: on tingen y problem Choueiry (in terlea v es sear h and exe ution) Not the usual t yp e of `un ertain t y': no randomness/no missing information (su h as in tra� ) • but, the mo v es of the opp onen t exp e tedly non b enign Challenges: • - h uge bran hing fa tor 6 - large solution spa e - Computing optimal solution is infeasible • - Y et, de isions m ust b e made. F orget A*... Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
B.Y. ✫ ✬ Choueiry Dis ussion What are the theoreti ally b est mo v es? T e hniques for ho osing a go o d mo v e when time is tigh t Pruning: ignore irrelev an t p ortions of the sear h spa e Ev aluation fun tion: appro ximate the true utilit y of a state • without doing sear h 7 • √ × Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
T w o-p erson Games - 2 pla y er: Min and Max - Max mo v es �rst B.Y. ✫ ✬ - Pla y ers alternate un til end of game Choueiry - Gain a w arded to pla y er/p enalt y giv e to loser Game as a sear h problem: Initial state: b oard p osition & indi ation whose turn it is Su essor fun tion: de�ning legal mo v es a pla y er an tak e Returns {(mo v e, state) ∗ } 8 T erminal test: determining when game is o v er • states satisfy the test: terminal states • Utilit y fun tion (a.k.a. pa y o� fun tion): n umeri al v alue for out ome e.g., Chess: win=1, loss=-1, dra w=0 • Instru tor's F ebruary • notes 22, 2012 #9 ✪ ✩
Usual sear h Max �nds a sequen e of op erators yielding a terminal goal s oring B.Y. winner a ording to the utilit y fun tion ✫ ✬ Choueiry Game sear h Min a tions are signi� an t Max m ust �nd a strategy to win regardless of what Min do es: orre t a tion for Max for ea h a tion of Min Need to appro ximate (no time to en visage all p ossibilities • di� ult y): a h uge state spa e, an ev en more h uge sear h spa e 9 di�eren t legal p ositions − → e.g. , hess: A v erage bran hing fa tor=35, 50 mo v es/pla y er= 35 100 • P erforman e in terms of time is v ery imp ortan t 8 Instru tor's 10 40 < F ebruary : notes 22, • 2012 #9 ✪ ✩
Example : Ti -T a -T o e Max has 9 alternativ e mo v es B.Y. T erminal states' utilit y: Max wins=1, Max loses = -1, Dra w = 0 ✫ ✬ Choueiry MAX ( X ) X X X MIN ( O ) X X X X X X 10 X O X O X . . . MAX ( X ) O X O X X O X O . . . MIN ( O ) X X Instru tor's . . . . . . . . . . . . F ebruary . . . X O X X O X X O X O X O O X X TERMINAL O X X O X O O notes 22, Utility �–1 0 +1 2012 #9 ✪ ✩
Example : 2-ply game tree B.Y. ✫ ✬ Max's a tions: a 1 , a 2 , a 3 Choueiry Min's a tions: b 1 , b 2 , b 3 A MAX 3 a 1 a 3 11 a 2 B C D MIN 3 2 2 b 1 b 3 c 1 c 3 d 1 d 3 Minimax algorithm determines the optimal strategy for Max � b 2 c 2 d 2 de ides whi h is the b est mo v e Instru tor's 3 12 8 2 4 6 14 5 2 F ebruary notes 22, → 2012 #9 ✪ ✩
Minimax algorithm B.Y. ✫ ✬ - Generate the whole tree, do wn to the lea v es Choueiry - Compute utilit y of ea h terminal state - Iterativ ely , from the lea v es up to the ro ot, use utilit y of no des at depth d to ompute utilit y of no des at depth ( d − 1) : MIN `ro w': minim um of hildren MAX `ro w': maxim um of hildren Minimax-V alue ( n ) Utility ( n ) if n is a terminal no de 12 Minimax-V alue ( s ) if n is a Max no de Minimax-V alue ( s ) if n is a Min no de 8 > > < Instru tor's max s ∈ Succ ( n ) F > ebruary > min s ∈ Succ ( n ) : notes 22, 2012 #9 ✪ ✩
B.Y. ✫ ✬ Minimax de ision Choueiry MAX's de ision: minimax de ision maximizes utilit y under the assumption that the opp onen t will pla y p erfe tly to his/her o wn adv an tage Minimax de ision maximes the w orst- ase out ome for Max • (whi h otherwise is guaran teed to do b etter) If opp onen t is sub-optimal, other strategies ma y rea h b etter 13 out ome b etter than the minimax de ision • • Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
B.Y. Minimax algorithm: Prop erties ✫ ✬ Choueiry maxim um depth legal mo v es Using Depth-�rst sear h, spa e requiremen t is: O ( bm ) : if generating all su essors at on e • m O ( m ) : if onsidering su essors one at a time b 14 Time omplexit y O ( b m ) • Real games: time ost totally una eptable • Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
Multiple pla y ers games B.Y. ✫ ✬ Utility ( n ) b e omes a v e tor of the size of the n um b er of pla y ers Choueiry F or ea h no de, the v e tor giv es the utilit y of the state for ea h pla y er 15 to move A (1, 2, 6) B (1, 2, 6) (1, 5, 2) � X Instru tor's C (1, 2, 6) (6, 1, 2) (1, 5, 2) (5, 4, 5) F ebruary 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) notes 22, 2012 #9 ✪ ✩
Allian e formation in m ultiple pla y ers games B.Y. ✫ ✬ Choueiry Ho w ab out allian es? A and B in w eak p ositions, but C in strong p osition A and B mak e an allian e to atta k C (rather than ea h other Collab oration emerges from purely sel�sh b eha vior! Allian es an b e done and undone ( areful for so ial stigma!) • When a t w o-pla y er game is not zero-sum, pla y ers ma y end up 16 → automati ally making allian es (for example when the terminal state maximizes utilit y of b oth pla y ers) • • Instru tor's F ebruary notes 22, 2012 #9 ✪ ✩
Alpha-b eta pruning B.Y. ✫ ✬ Choueiry Minimax requires omputing all terminal no des: una eptable Do w e really need to do ompute utilit y of all terminal no des? ... No, sa ys John M Carth y in 1956: • It is p ossible to ompute the orr e t minimax de ision without • lo oking at every no de in the tr e e, and yet get the orr e t 17 de ision Use pruning (eliminating useless bran hes in a tree) Instru tor's F ebruary • notes 22, 2012 #9 ✪ ✩
Example of alpha-b eta pruning B.Y. ✫ ✬ Choueiry [−∞, +∞] [−∞, +∞] A A (a) (b) [−∞, 3 ] [−∞, 3 ] B B 3 3 12 [ 3 , +∞] [ 3 , +∞] A A (c) (d) 18 B B [−∞, 2] C [3, 3] [3, 3] 3 12 8 3 12 8 2 [3, 14] A [3, 3] A (e) (f) T ry 14, 5, 2, 6 b elo w D B [−∞, 2 ] C [−∞, 14 ] D [−∞, 2] Instru tor's B C D [3, 3] [3, 3] [2, 2] F ebruary 3 12 8 2 14 3 12 8 2 14 5 2 notes 22, 2012 #9 ✪ ✩
Recommend
More recommend