State Space 4 Chapter 4 Adversarial Games.

Slides:



Advertisements
Similar presentations
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Advertisements

Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CS 484 – Artificial Intelligence
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
Mahgul Gulzai Moomal Umer Rabail Hafeez
This time: Outline Game playing The minimax algorithm
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
Game-Playing Read Chapter 6 Adversarial Search. Game Types Two-person games vs multi-person –chess vs monopoly Perfect Information vs Imperfect –checkers.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game-Playing Read Chapter 6 Adversarial Search. State-Space Model Modified States the same Operators depend on whose turn Goal: As before: win or win.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
ICS-270a:Notes 5: 1 Notes 5: Game-Playing ICS 270a Winter 2003.
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Game Playing.
Game Playing. Towards Intelligence? Many researchers attacked “intelligent behavior” by looking to strategy games involving deep thought. Many researchers.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Today’s Topics Playing Deterministic (no Dice, etc) Games –Mini-max –  -  pruning –ML and games? 1997: Computer Chess Player (IBM’s Deep Blue) Beat Human.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search. Regular Tic Tac Toe Play a few games. –What is the expected outcome –What kinds of moves “guarantee” that?
Adversarial Search 2 (Game Playing)
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Search: Games & Adversarial Search Artificial Intelligence CMSC January 28, 2003.
1 Chapter 6 Game Playing. 2 Chapter 6 Contents l Game Trees l Assumptions l Static evaluation functions l Searching game trees l Minimax l Bounded lookahead.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Announcements Homework 1 Full assignment posted..
Last time: search strategies
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Pengantar Kecerdasan Buatan
Adversarial Search.
Game Playing.
David Kauchak CS52 – Spring 2016
Games & Adversarial Search
Adversarial Search.
Game playing.
Alpha-Beta Search.
Games & Adversarial Search
Games & Adversarial Search
NIM - a two person game n objects are in one pile
Alpha-Beta Search.
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Alpha-Beta Search.
Minimax strategies, alpha beta pruning
Alpha-Beta Search.
Mini-Max search Alpha-Beta pruning General concerns on games
Based on slides by: Rob Powers Ian Gent
Adversarial Search CS 171/271 (Chapter 6)
Alpha-Beta Search.
Games & Adversarial Search
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4.
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

State Space 4 Chapter 4 Adversarial Games

Two Flavors Games of Perfect Information Each player knows everything that can be known Chess, Othello Games of Imperfect Information Player’s have partial knowledge Poker: dispute is settled by revealing the contents of one’s hand Two Flavors

Two Approaches to Perfect Information Games Use simple heuristics and search many nodes Use sophisticated heuristics and search few nodes Cost of calculating the heuristics might outweigh the cost of opening many nodes The closer h is to h*, the better informed it is. But information can be expensive Two Approaches to Perfect Information Games

A Model: MiniMax on exhaustively searchable graphs Two Players min: tries to achieve an outcome of 0 max: tries to achieve an outcome of 1 A Model: MiniMax on exhaustively searchable graphs

You are max at node A MAX A C D Min B 1 Max G E F Min K 1 J H I Max O C D Min B 1 Max G E F Min K 1 J H I Max O N 1 1 L M P Q R Min 1

Wins Max would like to end game at F,J,N,Q,L Min would like to end game at D,H,P,R,M Propagating Scores: A first pass Min’s Turn at Node I Go to M to win So assign I a 0 Max’s turn at node O Go to Q to win So assign 1 to node O Wins

If faced with two labeled choices, you would choose 0 (if min) or 1 (if max) Assume you’re opponent will play the same way Conclusion

Propagating Scores For each unlabeled node in the tree If it’s max’s turn, give it the max score of its children If it’s min’s turn, give it the min score of its children Now label the tree Conclusion: Max must choose C at the first move or lose the game Propagating Scores

7 coins 2 players Players divide coins into two piles at each move, such that Piles have an unequal number of coins No pile is empty Play ends when a player can no longer move. At that point the other player wins and his/her score bubbles up Nim

Start of Game min 7 4,3 5,2 6,1 5,1,1 4,2,1 P. 152 Luger.

Problem For games of any complexity, you can’t search the whole tree Solution Look ahead a fixed number of plys (levels) Evaluate according to some heuristic estimate Develop a criterion for pruning subtrees that don’t require examination αβ Pruning

Instead of representing wins, numbers represent the relative goodness of nodes. At any junction Max chooses highest Min chooses lowest Higher means better for max Lower means better for min Recast

What should Max do? 8 Max g 4 8 j k 9 t n m z 4 8 12 r p q Min 7 3 9 beta n m z alpha 4 8 12 r p q Min 7 3 9

Situation Max’s turn at node g Left subtree of g has been explored If max chooses j, min will choose m So the best max can do by going left is 8. Call this α Now Examine K and its left subtree n with a value of 4 If max chooses k, the worst min can do is 4. Why? T may be < 4. If it is min will choose it. If not, min will choose 4 So the worst min can do, if max goes right is 4. Call this β Situation

Question Must max expand the rst(K)? No. min is guaranteed 4. But if max chose j, min is guaranteed 8 So max is better off by going left More formally: Val(k) = min(4, val(t)) <= 4 Val(g) = max(8,val(k)) = max(8, min(4,val(t)) = 8 Question

Max Principle If you’re Max: Search can be stopped below any min node where β <= α of its max ancestor Max Principle

What should Min do? Min 4 k 9 4 n t d e p q r Beta 4 3 7 9 alpha 3

Situation Min’s turn at node k Left subtree of k has been explored If min chooses n, max will choose d So the best min can do by going left is 4. Call this β Now examine T and its left subtree P with a value of 7 If min chooses T, the worst max can do is 7. Why? Q or R may be > 7. If either is Max will choose one of them. If not, max will choose 7. So the worst max can do, if min goes right is 7. Call this α Situation

Question Should min explore Q and R No Max is guaranteed 7 if Min chooses T But if min chooses N, max gets only 4 Val(T) = max(7,val(Q), val(R)) >= 7 Val(k) = min(4,val(T)) = 4 Question

Min Principle If you’re min: Search can be stopped below any max node where α >= β of its min ancestor Min Principle

To Summarize Max’s turn Max principle Min’s turn Min principle β is min’s guaranteed score (the worst min can do) α is best max can do Max principle Search can be stopped below any min node where β <= α of its max ancestor Min’s turn α is max’s guaranteed score (the worst max can do) β is best min can do Min principle Search can be stopped below any max node where α >= β of its min ancestor To Summarize

On White Board A Few Examples

AB Prune (Nilsson, p. 205) Similarity between 2 and 2’ Arguments for min/min principles (Slides 15, 19) AB Prune (Nilsson, p. 205)

Need for A-B prune Combinatorial Explosion Number of nodes produced by a full search of the chess state space: 10120 Not just a big number Comparable to Number of molecules in the universe Number of nanoseconds since the big bang Need for A-B prune

Best Case Performance Call ND the number of terminal nodes D the depth of the search space ND the number of terminal nodes B the branching factor Best case AB performance: ND = 2BD/2 – 1 for even D ND = 2B(D+1)/2 + B(D-1)/2 for odd D Best Case Performance

Suppose B = 5, D = 6 w/out alpha/beta ND= 56 = 15625 w/alpha/beta ND= 2* 53 - 1 = 249 Approx. 1.6% of the terminal nodes that would have been examined without AB prune Example

Average Performance AB prune reduces branching factor B to B3/4 Suppose B = 5, Bab = 3.34 Suppose D = 6 Then ND = 56 = 15625 NDAB = 3.346 = 1388 ≈ 8.8% without AB prune Average Performance

Clear relationship between branching factor and the size of the search space Let T = number of nodes in a full binary tree T = 20 + 21 + 22 + … + 2D-1 = 2D – 1 Easily proved through induction Binary Trees

T = B0 +B1 + B2 + … + BD = B(BD - 1)/(B-1) + 1 Also provable through induction Extend to arbitrary B

To Sum Up D is the depth of the search space B is the average number of descendants at each level Size of search space = B(BD -1)/(B-1) + 1 Grows very fast As branching factor increases As depth increases Combinatorial Explosion: search space grows too fast to be exhaustively searched But we want to search deeply (large D) Conclusion: reduce B through AB pruning To Sum Up