MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.

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)
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.
Artificial Intelligence
CS 484 – Artificial Intelligence
Adversarial Search Chapter 5.
Adversarial Search: Game Playing Reading: Chapter next time.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
Artificial Intelligence in Game Design
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:
Game Playing CSC361 AI CSC361: Game Playing.
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)
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.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
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.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Lecture 5 Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
KU NLP Heuristic Search Heuristic Search and Expert Systems (1) q An interesting approach to implementing heuristics is the use of confidence.
Game Playing.
Games CPS 170 Ron Parr. Why Study Games? Many human activities can be modeled as games –Negotiations –Bidding –TCP/IP –Military confrontations –Pursuit/Evasion.
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.
Game-playing AIs Part 1 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part I (this set of slides)  Motivation  Game Trees  Evaluation.
Game Playing. Towards Intelligence? Many researchers attacked “intelligent behavior” by looking to strategy games involving deep thought. Many researchers.
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.
Games 1 Alpha-Beta Example [-∞, +∞] Range of possible values Do DF-search until first leaf.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Knowledge Search CPTR 314.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
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 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.
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
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.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
State Space 4 Chapter 4 Adversarial Games.
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
NIM - a two person game n objects are in one pile
Games & Adversarial Search
Games & Adversarial Search
Unit II Game Playing.
Presentation transcript:

MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2

MOTIVATIONS Breadth-first, depth-first, hill-climbing, best-first, and A* assume a non-hostile search space. The goals just sit there somewhere in the graph. The goals do not try to elude you. The 8-puzzle game did not try to stop you from reaching the goal. Your tic-tac-toe opponents reacted to your moves randomly. But in a real 2-person game, you opponent does try to beat you and make it difficult for you to reach your goal. Minimax search can be applied in an adversarial search space. Alpha-beta pruning can be used to cut bad branches (moves) in the game tree to improve minimax search time.

OBJECTIVES 1.Adversarial search space: MAX vs. MIN 2.A simple game tree: Nim-7 3.Minimax on Nim-7 4.Minimax on tic-tac-toe looking 3 plies ahead 5.Alpha-beta pruning

TWO PEOPLE GAMES Solved games  Tic-tac-toe  Four In A Line  Checkers Impressive games played by robots  Othello bot is much stronger than any human player  Computer chess beat the human world champions  TD-Gammon ranked among top 3 players in the backgammon world Future bot challenges to humans  Poker bots play respectfully at world-class level  Computer bridge programs play competitively at national level  Go bots are getting more serious in the amateur ranking

COMPLETE GAME TREE FOR NIM-7 7 coins are placed on a table between the two opponents A move consists of dividing a pile of coins into two nonempty piles of different sizes For example, 6 coins can be divided into piles of 5 and 1 or 4 and 2, but not 3 and 3 The first player who can no longer make a move loses the game P1 starts P2 replies P1 P2 P1 P2 loses P1 loses P2 loses

Node score = 0 means MIN wins. 1 means MAX wins. Bold edges indicate forced win for MAX, Player2. moves first to minimize to maximize MAX wins MIN wins MIN vs. MAX in a Nim game MIN wins The best that MIN (Player1) can do is to lose unless Player2 makes a mistake.

MINIMAX TO FIXED PLY DEPTH Instead of Nim-7, image the chess game tree. Chess game tree is too deep.  cannot expand the current node to terminating (leaf) nodes for checkmate. Use fixed ply depth look-ahead.  Search from current position to all possible positions that are, e.g., 3-plies ahead. Use heuristic to evaluate all these future positions.  P=1, N=B=3, R=5, Q=9  Assign certain weight to certain features of the position (dominance of the center, mobility of the queen, etc.)  summarize these factors into a single number. Then propagating the scores back to the current node.

Use heuristic h(n) for each of these future positions. Back propagate the scores up the tree. = current node score MAX calculates the current node score hopes for the best also hopes for the best Look 3 plies ahead. A stronger heuristic will beat a weaker heuristic. A farther look-ahead will beat a near-sighted look-ahead. Computer chess routinely uses complex heuristics analyzing material and positional advantages and looks 40 plies ahead.

Heuristic measuring for adversarial tic-tac-toe Maximize E(n) E(n) = 0 when my opponent and I have equal number of possibilities.

Tic-tac-toe, MAX vs MIN, 2-ply look-ahead MIN tries his best to minimize. MAX hopes to win by maximizing. Fig MAX's score at the opening is 1. So according to this heuristic, Play 1 has advantage.

MAX makes his first move MAX hopes to win by maximizing. But MIN then builds another minimax tree with 2 plies look-ahead from here and decided to reply with MAX though MIN's best reply was

MAX's 2nd move: look ahead analysis Fig. 4.24

MAX's 3rd move: look ahead analysis −∞ means MIN wins. +∞ means MAX wins. Fig. 4.25

Alpha-beta pruning example Unevaluated nodes Minimax without pruning Depth-first search Visit C, A, F, Visit G, heuristics evaluates to 2 Visit H, heuristics evaluates to 3 Back up {2,3} to F. max(F)=3 Back up to A. β(A)=3. Temporary min(A) is 3. 3 is the ceiling for node A's score. Visit B according to depth-first order. Visit I. Evaluates to 5. Max(B)>=5. α(B)=5. It does not matter what the value of J is, min(A)=3. β-prune J. Alpha-beta pruning improves search efficiency of minimax without sacrificing accuracy. F GHI J

ALPHA-BETA PRUNING Proceed in a depth-first fashion in the n-ply look-ahead search tree. Find the score for the top of this tree. During the search, creates two values alpha and beta α-value associated with MAX can never decrease  MAX's eventually score is at least as good as the current α-value β-value associated with of MIN can never increase  MIN's eventually score is at least as good as the current β-value α-prune:  -value <=  -value of a MAX ancestor β -prune: Any MAX node having  -value <=  -value of any MIN ancestor min(A) = -1 max(S) must >= -1 Lower bound:  -value of S = -1 h(C) = -2 min (B) <= -2 Upper bound:  -value = -2 Final value of B can never exceed current value of S. We can prune the other children of B. A B S MA X C  -value = - 2 min(B)≤-2  -value of S = -1 max(S)≥-1 MIN α -prune

CONCLUSION Minimax search is designed for the adversarial search space, MAX vs MIN. Before MAX makes a move, he looks n plies ahead in a DFS manner. Apply heuristic function for the states at the end of the look ahead level. Propagate these values back up to the current state.  Use alpha-beta pruning to cut bad branches (moves) in the game tree to improve search time. Choose the move that maximizes the current node score. Then it is MIN's turn of doing similar look-ahead and pruning to decide his move. The players alternate until game over.