Intelligence Artificial Intelligence Ian Gent Games 2: Alpha Beta.

Slides:



Advertisements
Similar presentations
Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Advertisements

Intelligence Artificial Intelligence Ian Gent Games 1: Game Tree Search.
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.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Games & Adversarial Search
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
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.
Search Strategies.  Tries – for word searchers, spell checking, spelling corrections  Digital Search Trees – for searching for frequent keys (in text,
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
All rights reservedL. Manevitz Lecture 31 Artificial Intelligence A/O* and Minimax L. Manevitz.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Adversarial Search and Game Playing Examples. Game Tree MAX’s play  MIN’s play  Terminal state (win for MAX)  Here, symmetries have been used to reduce.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Alpha-Beta Search. 2 Two-player games The object of a search is to find a path from the starting position to a goal position In a puzzle-type problem,
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.
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
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 Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
1 Computer Group Engineering Department University of Science and Culture S. H. Davarpanah
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Chapter 12 Adversarial Search. (c) 2000, 2001 SNU CSE Biointelligence Lab2 Two-Agent Games (1) Idealized Setting  The actions of the agents are interleaved.
Alpha-beta Search. Two-player games zThe object of a search is to find a path from the starting position to a goal position zIn a puzzle-type problem,
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
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.
Quiz 4 : Minimax Minimax is a paranoid algorithm. True
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.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Game-playing AIs Part 2 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part II  The Minimax Rule  Alpha-Beta Pruning  Game-playing.
Adversarial Search 2 (Game Playing)
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
Search: Games & Adversarial Search Artificial Intelligence CMSC January 28, 2003.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Iterative Deepening A*
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.
Games & Adversarial Search
Games & Adversarial Search
Artificial Intelligence Chapter 12 Adversarial Search
Game playing.
Games & Adversarial Search
Games & Adversarial Search
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Minimax strategies, alpha beta pruning
Mini-Max search Alpha-Beta pruning General concerns on games
Based on slides by: Rob Powers Ian Gent
Artificial Intelligence
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Unit II Game Playing.
Presentation transcript:

Intelligence Artificial Intelligence Ian Gent Games 2: Alpha Beta

Intelligence Artificial Intelligence Part I :The idea of Alpha Beta Search Part II: The details of Alpha Beta Search Part III: Results of using Alpha Beta Alpha Beta Search

3 Reminder zWe consider 2 player perfect information games zTwo players, Min and M  x zLeaf nodes given definite score zbacking up by MiniMax defines score for all nodes zUsually can’t search whole tree yUse static evaluation function instead zMiniMax hopelessly inefficient

4 What’s wrong with MiniMax zMinimax is horrendously inefficient zIf we go to depth d, branching rate b, ywe must explore b d nodes zbut many nodes are wasted zWe needlessly calculate the exact score at every node zbut at many nodes we don’t need to know exact score ze.g. outlined nodes are irrelevant

5 The Solution zStart propagating costs as soon as leaf nodes are generated zDon’t explore nodes which cannot affect the choice of move yI.e. don’t explore those that we can prove are no better than the best found so far zThis is the idea behind alpha-beta search

6 Alpha-Beta search zAlpha-Beta =  zUses same insight as branch and bound zWhen we cannot do better than the best so far ywe can cut off search in this part of the tree zMore complicated because of opposite score functions zTo implement this we will manipulate alpha and beta values, and store them on internal nodes in the search tree

7 Alpha and Beta values zAt a M  x node we will store an alpha value ythe alpha value is lower bound on the exact minimax score ythe true value might be   yif we know Min can choose moves with score <  xthen Min will never choose to let Max go to a node where the score will be  or more zAt a Min node,  value is similar but opposite zAlpha-Beta search uses these values to cut search

8 Alpha Beta in Action zWhy can we cut off search? zBeta = 1 < alpha = 2 where the alpha value is at an ancestor node zAt the ancestor node, Max had a choice to get a score of at least 2 (maybe more) zMax is not going to move right to let Min guarantee a score of 1 (maybe less)

9 Alpha and Beta values zM  x node has  value ythe alpha value is lower bound on the exact minimax score ywith best play M  x can guarantee scoring at least  zMin node has  value ythe beta value is upper bound on the exact minimax score ywith best play Min can guarantee scoring no more than  zAt Max node, if an ancestor Min node has  <  yMin’s best play must never let Max move to this node xtherefore this node is irrelevant yif  = , Min can do as well without letting Max get here xso again we need not continue

10 Alpha-Beta Pruning Rule zTwo key points: yalpha values can never decrease ybeta values can never increase zSearch can be discontinued at a node if: yIt is a Max node and xthe alpha value is  the beta of any Min ancestor xthis is beta cutoff yOr it is a Min node and xthe beta value is  the alpha of any Max ancestor xthis is alpha cutoff

11 Calculating Alpha-Beta values zAlpha-Beta calculations are similar to Minimax ybut the pruning rule cuts down search zUse concept of ‘final backed up value’ of node ythis might be the minimax value yor it might be an approximation where search cut off xless than the true minimax value at a Max node xmore than the true minimax value at a Min node xin either case, we don’t need to know the true value

12 Final backed up value zLike MiniMax zAt a Max node: ythe  value is equal to the: xlargest final backed up value of its successors xthis can be all successors (if no beta cutoff) xor all successors used until beta cutoff occurs zAt a Min node ythe  value is equal to the xsmallest final backed up value of its successors xmin of all successors until alpha cutoff occurs

13 Calculating alpha values zAt a M  x node yafter we obtain the final backed up value of the first child xwe can set  of the node to this value ywhen we get the final backed up value of the second child xwe can increase  if the new value is larger ywhen we have the final child, or if beta cutoff occurs xthe stored  becomes the final backed up value xonly then can we set the  of the parent Min node xonly then can we guarantee that  will not increase zNote the difference ysetting alpha value of current node as we go along yvs. propagating value up only when it is finalised

14 Calculating beta values zAt a Min node yafter we obtain the final backed up value of the first child xwe can set  of the node to this value ywhen we get the final backed up value of the second child xwe can decrease  if the new value is smaller ywhen we have the final child, or if alpha cutoff occurs xthe stored  becomes the final backed up value xonly then can we set the  of the parent Min node xonly then can we guarantee that  will not decrease zNote the difference ysetting beta value of current node as we go along yvs. propagating value up only when it is finalised

15 Move ordering Heuristics zVariable ordering heuristics irrelevant zvalue ordering heuristics = move ordering heuristic zThe optimal move ordering heuristic for alpha-beta.. y… is to consider the best move first yI.e. test the move which will turn out to have best final backed up value yof course this is impossible in practice zThe pessimal move ordering heuristic … y… is to consider the worst move first yI.e. test move which will have worst final backed up value

16 Move ordering Heuristics zIn practice we need quick and dirty heuristics zwill neither be optimal nor pessimal zE.g. order moves by static evaluation function yif it’s reasonable, most promising likely to give good score yshould be nearer optimal than random zIf static evaluation function is expensive yneed even quicker heuristics zIn practice move ordering heuristics vital

17 Theoretical Results zWith pessimal move ordering, yalpha beta makes no reduction in search cost zWith optimal move ordering yalpha beta cuts the amount of search to the square root yI.e. From bd to  bd = bd/2 yEquivalently, we can search to twice the depth xat the same cost zWith heuristics, performance is in between zalpha beta search vital to successful computer play in 2 player perfect information games

18 Summary and Next Lecture zGame trees are similar to search trees ybut have opposing players zMinimax characterises the value of nodes in the tree ybut is horribly inefficient zUse static evaluation when tree too big zAlpha-beta can cut off nodes that need not be searched ycan allow search up to twice as deep as minimax zNext Time: y Chinook, world champion Checkers player