Based on slides by: Rob Powers Ian Gent

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

For Friday Finish chapter 5 Program 1, Milestone 1 due.
Games & Adversarial Search
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
1 Game Playing. 2 Outline Perfect Play Resource Limits Alpha-Beta pruning Games of Chance.
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,
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
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.
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.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
AD FOR GAMES Lecture 4. M INIMAX AND A LPHA -B ETA R EDUCTION Borrows from Spring 2006 CS 440 Lecture Slides.
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 6 Adversarial Search. Adversarial Search Problem Initial State Initial State Successor Function Successor Function Terminal Test Terminal Test.
For Wednesday Read Weiss, chapter 12, section 2 Homework: –Weiss, chapter 10, exercise 36 Program 5 due.
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.
For Friday Finish chapter 6 Program 1, Milestone 1 due.
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.
Intelligence Artificial Intelligence Ian Gent Games 2: Alpha Beta.
Game tree search Chapter 6 (6.1 to 6.3 and 6.6) cover games. 6.6 covers state of the art game players in particular. 6.5 covers games that involve uncertainty.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Game tree search As ever, slides drawn from Andrew Moore’s Machine Learning Tutorials: as well as from Faheim Bacchus.
AIMA Code: Adversarial Search CSE-391: Artificial Intelligence University of Pennsylvania Matt Huenerfauth February 2005.
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.
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.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Last time: search strategies
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
CS 460 Spring 2011 Lecture 4.
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
Game playing.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
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
Artificial Intelligence
Adversarial Search and Game Playing Examples
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Alpha-Beta Search.
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Based on slides by: Rob Powers Ian Gent Min-Max Trees Yishay Mansour Based on slides by: Rob Powers Ian Gent

Two Players Games One Search Tree for both Players Even layers – Max Player move Odd Layers – Min Player move The state evaluated according to heuristic function.

MinMax search strategy Generate the whole game tree. (Or up to a constant depth) Evaluate Terminal states (Leafs) propagate Min-Max values up from leafs Search for MAX best next move, so that no matter what MIN does MAX will be better off For branching factor b and depth search d the complexity is O(bd)

MinMax first Example

1 1 -2 -1

MinMax evaluation function function MinMax-Decision(game) returns an operator for each op in Operator[game] do Value[op] := MinMax-Value(Apply(op,game),game) end return the op with the highest Value[op] function MinMax-Value(state,game) returns an utility value if Terminal-Test[game](state) then return Utility[game](state) else if MAX’s turn return the highest MinMax-Value of Successors(state) else (MIN’s turn) return the lowest MinMax-Value of Successors(state)

Cuting Off Search We want to prune the tree: stop exploring subtrees with values that will not influence the final MinMax root decision In the worst case, no pruning. The complexity is O(bd). In practice, O(bd/2), with branching factor of b1/2 instead of b.

Alpha Beta First Example

Alpha-Beta search cutoff rules Keep track and update two values so far: alpha is the value of best choice in the MAX path beta is the value of best choice in the MIN path Rule: do not expand node n when beta <= alpha for MAX node return beta for MIN node return alpha

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

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

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

Alpha-Beta Pruning Rule Two key points: alpha values can never decrease beta values can never increase Search can be discontinued at a node if: It is a Max node and the alpha value is  the beta of any Min ancestor this is beta cutoff Or it is a Min node and the beta value is  the alpha of any Max ancestor this is alpha cutoff

Alpha-Beta prunning function Max-Value(state,game,alpha,beta) returns minmax value of state if Cutoff-Test(state) then return Eval(state) for each s in Successor(state) do alpha := Max(alpha,Min-Value(s, game,alpha,beta)) if beta <= alpha then return beta end; return alpha function Min-Value(state,game,alpha,beta) returns beta := Min(beta,Max-Value(s, game,alpha,beta)) if beta <= alpha then return alpha end; return beta

#2b Left->Right = -, = +

#2b Left->Right = 7, = + = -, = 4 = 6, = + = 4, = 6 = -, = + = -, = 4 = 8, = + = 6, = 8 (Alpha pruning) = 4, = + = 8, = 6 = 4, = 3 = 4, = 8 = 5, = 6 (Alpha pruning) = 8, = + = 4, = 8 =5, =8 =5, =6

Beta Pruning 9 = 4, = + = -, = 4 = 4, = 8 = -, = + = 8, = + = 4, = 8 (Alpha pruning) = 4, = + = 8, = 6 = 4, = 3 = 4, = 8 (Alpha pruning) 9 = 8, = + = 4, = 8

Beta Pruning 9 = 4, = + = -, = 4 = 4, = 8 = -, = + = 8, = + = 9, = 8 (Beta pruning) (Alpha pruning) = 4, = + = 8, = 6 = 4, = 3 = 4, = 8 (Alpha pruning) 9 = 8, = + = 4, = 8

#2b Right->Left = -, = +

#2b Right->Left = 7, = + = 7, = 7 = 7, = 6 = -, = + (Alpha pruning) (Alpha pruning) = 7, = + = 7, = + (Alpha pruning) = 7, = -1 = 7, = + = 7, = 6 (Alpha pruning) =7, =+ =7, =+ =7, =+