Mini-Max search Alpha-Beta pruning General concerns on games

Slides:



Advertisements
Similar presentations
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Advertisements

February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
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.
Adversarial Search CSE 473 University of Washington.
Artificial Intelligence for Games Game playing Patrick Olivier
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
Game Playing CSC361 AI CSC361: Game Playing.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Games & Adversarial Search Chapter 6 Section 1 – 4.
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 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.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
Game Playing.
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.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Minimax with Alpha Beta Pruning The minimax algorithm is a way of finding an optimal move in a two player game. Alpha-beta pruning is a way of finding.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Game Playing: Adversarial Search chapter 5. Game Playing: Adversarial Search  Introduction  So far, in problem solving, single agent search  The machine.
Adversarial Search 2 (Game Playing)
Adversarial Search In this lecture, we introduce a new search scenario: game playing 1.two players, 2.zero-sum game, (win-lose, lose-win, draw) 3.perfect.
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.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Artificial Intelligence AIMA §5: Adversarial Search
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Games and adversarial search (Chapter 5)
Instructor: Vincent Conitzer
4. Games and adversarial search
Games and Adversarial Search
Last time: search strategies
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
Games and adversarial search (Chapter 5)
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Pengantar Kecerdasan Buatan
State Space 4 Chapter 4 Adversarial Games.
Game Playing in AI by: Gaurav Phapale 05 IT 6010
Games & Adversarial Search
Games & Adversarial Search
Artificial Intelligence Chapter 12 Adversarial Search
Game playing.
Tutorial 5 Adversary Search
Alpha-Beta Search.
Games & Adversarial Search
Games & Adversarial Search
Alpha-Beta Search.
Instructor: Vincent Conitzer
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Alpha-Beta Search.
Pruned Search Strategies
Game Playing Fifth Lecture 2019/4/11.
Alpha-Beta Search.
Artificial Intelligence
Search.
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Alpha-Beta Search.
Games & Adversarial Search
Games & Adversarial Search
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Mini-Max search Alpha-Beta pruning General concerns on games Game Playing Mini-Max search Alpha-Beta pruning General concerns on games

Why study board games ? One of the oldest subfields of AI (Shannon and Turing, 1950) Abstract and pure form of competition that seems to require intelligence Easy to represent the states and actions Very little world knowledge required ! Game playing is a special case of a search problem, with some new requirements.

Types of games Chance Deterministic Imperfect information Chess, checkers, go, othello Backgammon, monopoly Sea battle Bridge, poker, scrabble, nuclear war

Why new techniques for games? “Contingency” problem: We don’t know the opponents move ! The size of the search space: Chess : ~15 moves possible per state, 80 ply 1580 nodes in tree Go : ~200 moves per state, 300 ply 200300 nodes in tree Game playing algorithms: Search tree only up to some depth bound Use an evaluation function at the depth bound Propagate the evaluation upwards in the tree

MINI MAX Restrictions: 2 players: MAX (computer) and MIN (opponent) deterministic, perfect information Select a depth-bound (say: 2) and evaluation function - Construct the tree up till the depth-bound MAX MIN Select this move 3 - Compute the evaluation function for the leaves 2 1 3 - Propagate the evaluation function upwards: - taking minima in MIN - taking maxima in MAX 2 5 3 1 4

The MINI-MAX algorithm: Initialise depthbound; Minimax (board, depth) = IF depth = depthbound THEN return static_evaluation(board); ELSE IF maximizing_level(depth) THEN FOR EACH child child of board compute Minimax(child, depth+1); return maximum over all children; ELSE IF minimizing_level(depth) return minimum over all children; Call: Minimax(current_board, 0)

Alpha-Beta Cut-off Generally applied optimization on Mini-max. Instead of: first creating the entire tree (up to depth-level) then doing all propagation Interleave the generation of the tree and the propagation of values. Point: some of the obtained values in the tree will provide information that other (non-generated) parts are redundant and do not need to be generated.

Alpha-Beta idea: Principles: generate the tree depth-first, left-to-right propagate final values of nodes as initial estimates for their parent node. MIN MAX 2 2 - The MIN-value (1) is already smaller than the MAX-value of the parent (2) 1 - The MIN-value can only decrease further, 2 =2 1 - The MAX-value is only allowed to increase, 5 - No point in computing further below this node

Terminology: - The (temporary) values at MAX-nodes are ALPHA-values - The (temporary) values at MIN-nodes are BETA-values MIN MAX 2 2 5 =2 2 1 1 Alpha-value Beta-value

The Alpha-Beta principles (1): - If an ALPHA-value is larger or equal than the Beta-value of a descendant node: stop generation of the children of the descendant MIN MAX 2 2 5 =2 2 1 1 Alpha-value Beta-value 

The Alpha-Beta principles (2): - If an Beta-value is smaller or equal than the Alpha-value of a descendant node: stop generation of the children of the descendant MIN MAX 2 2 5 =2 2 3 1 Alpha-value Beta-value 

Mini-Max with  at work: 8 7 3 9 1 6 2 4 5  4 16  5 31 39 = 5 MAX 6  8  5 23 15 = 4 30 = 5  3 38 MIN 33  1 2  8 10  2 18  1 25  3 35  2 12  4 20  3 5 = 8 8  9 27  9 29  6 37 = 3 14 = 4 22 = 5 MAX 1 3 4 7 9 11 13 17 19 21 24 26 28 32 34 36 11 static evaluations saved !!

“DEEP” cut-offs - For game trees with at least 4 Min/Max layers: the Alpha - Beta rules apply also to deeper levels. 4  4  4 2  2

The Gain: Best case: - If at every layer: the best node is the left-most one MAX MIN Only THICK is explored

Example of a perfectly ordered tree MAX MIN 21 21 12 3 21 24 27 12 15 18 3 6 9 21 20 19 24 23 22 27 26 25 12 11 10 15 14 13 18 17 16 3 2 1 6 5 4 9 8 7

How much gain ? # (static evaluations) = - Alpha / Beta : best case : 2 bd/2 - 1 (if d is even) b(d+1)/2 + b(d-1)/2 - 1 (if d is odd) - The proof is by induction. - In the running example: d=3, b=3 : 11 !

Best case gain pictured: 10 100 1000 10000 100000 1 2 3 4 5 6 7 # Static evaluations Depth No pruning b = 10 Alpha-Beta Best case - Note: a logarithmic scale. - Conclusion: still exponential growth !! - Worst case?? For some trees alpha-beta does nothing, For some trees: impossible to reorder to avoid cut-offs

The horizon effect. Because of the depth-bound Queen lost Pawn lost horizon = depth bound of mini-max Because of the depth-bound we prefer to delay disasters, although we don’t prevent them !! solution: heuristic continuations

Time bounds: How to play within reasonable time bounds? Even with fixed depth-bound, times can vary strongly! Solution: Iterative Deepening !!! Remember: overhead of previous searches = 1/b Good investment to be sure to have a move ready.

Games of chance Ex.: Backgammon: Form of the game tree:

State of the art Drawn from an article by Mathew Ginsberg, Scientific American, Winter 1998, Special Issue on Exploring Intelligence

State of the art (2)

State of the art (3)

Win of deep blue predicted: Computer chess ratings studied around 90ies: 1500 2000 2500 3000 3500 2 4 6 8 10 12 14 Chess Rating Depth in ply Kasparov ? Further increase of depth was likely to win !