Minimax strategies, alpha beta pruning

Slides:



Advertisements
Similar presentations
Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Advertisements

Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Games & Adversarial Search
Adversarial Search Chapter 5.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
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)
Game Tree Search based on Russ Greiner and Jean-Claude Latombe’s notes.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
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.
1 Computer Group Engineering Department University of Science and Culture S. H. Davarpanah
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
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
CSE373: Data Structures & Algorithms Lecture 23: Intro to Artificial Intelligence and Game Theory Based on slides adapted Luke Zettlemoyer, Dan Klein,
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.
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 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
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)
EA C461 – Artificial Intelligence Adversarial Search
Announcements Homework 1 Full assignment posted..
Instructor: Vincent Conitzer
4. Games and adversarial search
Last time: search strategies
PENGANTAR INTELIJENSIA BUATAN (64A614)
Games and adversarial search (Chapter 5)
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
Adversarial Search Chapter 5.
Expectimax Lirong Xia. Expectimax Lirong Xia Project 2 MAX player: Pacman Question 1-3: Multiple MIN players: ghosts Extend classical minimax search.
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
Artificial Intelligence
Game playing.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Alpha-Beta Search.
Games & Adversarial Search
Games & Adversarial Search
Lecture 1C: Adversarial Search(Game)
Artificial Intelligence
Alpha-Beta Search.
Instructor: Vincent Conitzer
Expectimax Lirong Xia.
Game Playing Fifth Lecture 2019/4/11.
Instructor: Vincent Conitzer
Based on slides by: Rob Powers Ian Gent
Warm Up How would you search for moves in Tic Tac Toe?
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4.
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Minimax strategies, alpha beta pruning Lirong Xia

How to find good heuristics? No really mechanical way art more than science General guideline: relaxing constraints e.g. Pacman can pass through the walls Mimic what you would do

Arc Consistency of a CSP A simple form of propagation makes sure all arcs are consistent: If V loses a value, neighbors of V need to be rechecked! Arc consistency detects failure earlier than forward checking Can be run as a preprocessor or after each assignment Might be time-consuming X X X Delete from tail!

Limitations of Arc Consistency After running arc consistency: Can have one solution left Can have multiple solutions left Can have no solutions left (and not know it)

“Sum to 2” game Player 1 moves, then player 2, finally player 1 again Move = 0 or 1 Player 1 wins if and only if all moves together sum to 2 Player 1 1 Player 2 Player 2 1 1 Player 1 Player 1 Player 1 Player 1 1 1 1 1 -1 -1 -1 1 -1 1 1 -1 Player 1’s utility is in the leaves; player 2’s utility is the negative of this

Today’s schedule Adversarial game Minimax search Alpha-beta pruning algorithm

Adversarial Games Deterministic, zero-sum games: Minimax search: Tic-tac-toe, chess, checkers The MAX player maximizes result The MIN player minimizes result Minimax search: A search tree Players alternate turns Each node has a minimax value: best achievable utility against a rational adversary

Computing Minimax Values This is DFS Two recursive functions: max-value maxes the values of successors min-value mins the values of successors Def value (state): If the state is a terminal state: return the state’s utility If the agent at the state is MAX: return max-value(state) If the agent at the state is MIN: return min-value(state) Def max-value(state): Initialize max = -∞ For each successor of state: Compute value(successor) Update max accordingly return max Def min-value(state): similar to max-value Next agent 应该是指父亲节点。。。

Minimax Example 3 3 2 2

Tic-tac-toe Game Tree

Renju 15*15 5 horizontal, vertical, or diagonal in a row win no double-3 or double-4 moves for black otherwise black’s winning strategy was computed L. Victor Allis 1994 (PhD thesis)

Minimax Properties Time complexity? Space complexity? For chess, Exact solution is completely infeasible But, do we need to explore the whole tree?

Resource Limits Cannot search to leaves Depth-limited search Instead, search a limited depth of tree Replace terminal utilities with an evaluation function for non-terminal positions Guarantee of optimal play is gone

Evaluation Functions Functions which scores non-terminals Ideal function: returns the minimax utility of the position In practice: typically weighted linear sum of features: e.g. , etc. Next agent 应该是指父亲节点。。。

Minimax with limited depth Suppose you are the MAX player Given a depth d and current state Compute value(state, d) that reaches depth d at depth d, use a evaluation function to estimate the value if it is non-terminal

Improving minimax: pruning

Pruning in Minimax Search An ancestor is a MAX node already has an option than my current solution my future solution can only be smaller

Alpha-beta pruning Pruning = cutting off parts of the search tree (because you realize you don’t need to look at them) When we considered A* we also pruned large parts of the search tree Maintain α = value of the best option for the MAX player along the path so far β = value of the best option for the MIN player along the path so far Initialized to be α = -∞ and β = +∞ Maintain and update α and β for each node α is updated at MAX player’s nodes β is updated at MIN player’s nodes

Alpha-Beta Pruning General configuration We’re computing the MIN-VALUE at n We’re looping over n’s children n’s value estimate is dropping α is the best value that MAX can get at any choice point along the current path If n becomes worse than α, MAX will avoid it, so can stop considering n’s other children Define β similarly for MIN α is usually smaller than β Once α >= β, return to the upper layer

Alpha-Beta Pruning Example is MAX’s best alternative here or above is MIN’s best alternative here or above

Alpha-Beta Pruning Example is MAX’s best alternative here or above is MIN’s best alternative here or above

Alpha-Beta Pseudocode

Alpha-Beta Pruning Properties This pruning has no effect on final result at the root Values of intermediate nodes might be wrong! Important: children of the root may have the wrong value Good children ordering improves effectiveness of pruning With “perfect ordering”: Time complexity drops to O(bm/2) Doubles solvable depth! Your action looks smarter: more forward-looking with good evaluation function Full search of, e.g. chess, is still hopeless…

Project 2 Q1: write an evaluation function for (state,action) pairs the evaluation function is for this question only Q2: minimax search with arbitrary depth and multiple MIN players (ghosts) evaluation function on states has been implemented for you Q3: alpha-beta pruning with arbitrary depth and multiple MIN players (ghosts)

Recap Minimax search Alpha-beta pruning Project 1 due midnight today with limited depth evaluation function Alpha-beta pruning Project 1 due midnight today Project 2 due in two weeks