Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.

Slides:



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

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.
This lecture topic: Game-Playing & Adversarial Search
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CS 484 – Artificial Intelligence
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.
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
Games and adversarial search
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Game Tree Search based on Russ Greiner and Jean-Claude Latombe’s notes.
Adversarial Search: Game Playing Reading: Chess paper.
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”
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
CSC 412: AI Adversarial Search
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Adversarial Search Chapter 5 Adapted from Tom Lenaerts’ lecture notes.
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
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.
Adversarial Search CS30 David Kauchak Spring 2015 Some material borrowed from : Sara Owsley Sood and others.
Game Playing.
AD FOR GAMES Lecture 4. M INIMAX AND A LPHA -B ETA R EDUCTION Borrows from Spring 2006 CS 440 Lecture Slides.
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.
Adversarial Search CS311 David Kauchak Spring 2013 Some material borrowed from : Sara Owsley Sood and others.
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.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.
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.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Quiz 4 : Minimax Minimax is a paranoid algorithm. True
CSCI 4310 Lecture 6: Adversarial Tree Search. Book Winston Chapter 6.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
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. Game playing u Multi-agent competitive environment u The most common games are deterministic, turn- taking, two-player, zero-sum game.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
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.
Adversarial Search CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and Java.
Chapter 5 Adversarial Search. 5.1 Games Why Study Game Playing? Games allow us to experiment with easier versions of real-world situations Hostile agents.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
4. Games and adversarial search
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.
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Game Playing Fifth Lecture 2019/4/11.
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Games & Adversarial Search
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides

Motivation ● Want to create programs to play games ● Want to play optimally ● Want to be able to do this in a reasonable amount of time

Types of Games Backgammon Monopoly Chess Checkers Go Othello Card GamesBattleship Fully Observable Partially Observable Deterministic Nondeterministic (Chance) Minimax is for deterministic, fully observable games

Basic Idea ● Search problem  Searching a tree of the possible moves in order to find the move that produces the best result  Depth First Search algorithm ● Assume the opponent is also playing optimally  Try to guarantee a win anyway!

Required Pieces for Minimax ● An initial state  The positions of all the pieces  Whose turn it is ● Operators  Legal moves the player can make ● Terminal Test  Determines if a state is a final state ● Utility Function

Utility Function ● Gives the utility of a game state  utility(State) ● Examples  -1, 0, and +1, for Player 1 loses, draw, Player 1 wins, respectively  Difference between the point totals for the two players  Weighted sum of factors (e.g. Chess) ● utility(S) = w 1 f 1 (S) + w 2 f 2 (S) w n f n (S)  f 1 (S) = (Number of white queens) – (Number of black queens), w 1 = 9  f 2 (S) = (Number of white rooks) – (Number of black rooks), w 2 = 5 ...

Two Agents ● MAX  Wants to maximize the result of the utility function  Winning strategy if, on MIN's turn, a win is obtainable for MAX for all moves that MIN can make ● MIN  Wants to minimize the result of the evaluation function  Winning strategy if, on MAX's turn, a win is obtainable for MIN for all moves that MAX can make

Basic Algorithm

Example ● Coins game  There is a stack of N coins  In turn, players take 1, 2, or 3 coins from the stack  The player who takes the last coin loses

Coins Game: Formal Definition ● Initial State: The number of coins in the stack ● Operators: 1. Remove one coin 2. Remove two coins 3. Remove three coins ● Terminal Test: There are no coins left on the stack ● Utility Function: F(S)  F(S) = 1 if MAX wins, 0 if MIN wins

N = 4 K = N = 3 K = N = 2 K = N = 1 K = N = 0 K = N = 1 K = N = 2 K = N = 0 K = N = 0 K = N = 1 K = N = 3 K = N = 1 K = N = 0 K = N = 0 K = N = 0 K = 1F(S)=0 F(S)=1 MAX MIN

N = 4 K = 1 N = 3 K = 0 N = 2 K = 0 N = 1 K = 1 N = 0 K = 1 N = 1 K = 0 N = 2 K = 1 N = 0 K = 1 N = 0 K = 1 N = 1 K = 0 N = 3 K = 0 N = 1 K = 1 N = 0 K = 0 N = 0 K = N = 0 K = 1 1F(S)=0 F(S)=1 MAX MIN Solution

Analysis ● Max Depth: 5 ● Branch factor: 3 ● Number of nodes: 15 ● Even with this trivial example, you can see that these trees can get very big  Generally, there are O(b d ) nodes to search for ● Branch factor b: maximum number of moves from each node ● Depth d: maximum depth of the tree  Exponential time to run the algorithm!  How can we make it faster?

Alpha-Beta Pruning ● Main idea: Avoid processing subtrees that have no effect on the result ● Two new parameters  α: The best value for MAX seen so far  β: The best value for MIN seen so far ● α is used in MIN nodes, and is assigned in MAX nodes ● β is used in MAX nodes, and is assigned in MIN nodes

Alpha-Beta Pruning ● MAX (Not at level 0)  If a subtree is found with a value k greater than the value of β, then we do not need to continue searching subtrees ● MAX can do at least as good as k in this node, so MIN would never choose to go here! ● MIN  If a subtree is found with a value k less than the value of α, then we do not need to continue searching subtrees ● MIN can do at least as good as k in this node, so MAX would never choose to go here!

Algorithm

N = 4 K = N = 3 K = N = 2 K = N = 1 K = N = 0 K = N = 1 K = N = 2 K = N = 0 K = N = 0 K = N = 1 K = N = 3 K = N = 1 K = N = 0 K = N = 0 K = N = 0 K = 1F(S)=0 F(S)=1 MAX MIN α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β = α = β =

N = 4 K = 0 1 N = 3 K = 1 0 N = 2 K = 1 0 N = 1 K = 1 N = 0 K = 1 N = 1 K = 0 N = 2 K = 1 N = 0 K = 1 N = 0 K = 1 N = 1 K = N = 3 K = 0 N = 1 K = 1 N = 0 K = N = 0 K = N = 0 K = 1 1F(S)=0 F(S)=1 MAX MIN α = β = 1 0 α = 0 β = α = 0 β = 1 0 α = β = 0 α = 1 β = α = 0 β = 0 α = 0 β = 0 α = 0 β = 1 α = 0 β = α = 0 β = 0 α = 0 β = α = 1 β = 0 α = β = α = 1 β = 0 α = 0 β = 1

Nondeterministic Games ● Minimax can also be used for nondeterministic games (those that have an element of chance) ● There is an additional node added (Random node) ● Random node is between MIN and MAX (and vice versa) ● Make subtrees over all of the possibilities,and average the results

Example N = 2 K = 8.6 K = 5K = 11K = 2K = 7 K =.4*5 +.6*11 = 8.6 Random Node K =.4*2 +.6*7 = Weighted coin.6 Heads (1).4 Tails (0)

Our Project ● We will focus on deterministic, two-player, fully observable games ● We will be trying to learn the evaluator function, in order to save time when playing the game  Training on data from Minimax runs (Neural Network)  Having the program play against itself (Genetic Algorithms)

Conclusion ● Minimax finds optimal play for deterministic, fully observable, two-player games ● Alpha-Beta reduction makes it faster