Adversarial Search CSE 473 University of Washington.

Slides:



Advertisements
Similar presentations
Chapter 6, Sec Adversarial Search.
Advertisements

Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
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.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4. Warm Up Let’s play some games!
CptS 440 / 540 Artificial Intelligence Adversarial Search.
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Solving Problems by Searching Paula Matuszek Spring, 2010 Slides based on Hwee Tou.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
COMP-4640: Intelligent & Interactive Systems Game Playing A game can be formally defined as a search problem with: -An initial state -a set of operators.
1 Game Playing. 2 Outline Perfect Play Resource Limits Alpha-Beta pruning Games of Chance.
Adversarial Search Game Playing Chapter 6. Outline Games Perfect Play –Minimax decisions –α-β pruning Resource Limits and Approximate Evaluation Games.
Adversarial Search Chapter 6.
Artificial Intelligence for Games Game playing Patrick Olivier
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
An Introduction to Artificial Intelligence Lecture VI: Adversarial Search (Games) Ramin Halavati In which we examine problems.
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
EIE426-AICV 1 Game Playing Filename: eie426-game-playing-0809.ppt.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
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.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
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.
CSC 412: AI Adversarial Search
CHAPTER 6 : ADVERSARIAL SEARCH
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Game Playing.
1 Game Playing Why do AI researchers study game playing? 1.It’s a good reasoning problem, formal and nontrivial. 2.Direct comparison with humans and other.
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.
Instructor: Vincent Conitzer
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
CSE373: Data Structures & Algorithms Lecture 23: Intro to Artificial Intelligence and Game Theory Based on slides adapted Luke Zettlemoyer, Dan Klein,
Paula Matuszek, CSC 8520, Fall Based in part on aima.eecs.berkeley.edu/slides-ppt 1 CS 8520: Artificial Intelligence Adversarial Search Paula Matuszek.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides)
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.
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.
5/4/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 9, 5/4/2005 University of Washington, Department of Electrical Engineering Spring 2005.
Game Playing Why do AI researchers study game playing?
EA C461 – Artificial Intelligence Adversarial Search
Games and adversarial search (Chapter 5)
Adversarial Search Chapter 5.
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
Games & Adversarial Search
Games & Adversarial Search
Instructor: Vincent Conitzer
Games CSE 473 – Autumn 2003.
Game Playing Fifth Lecture 2019/4/11.
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4.
Presentation transcript:

Adversarial Search CSE 473 University of Washington

© D. Weld, D. Fox 2 Contents Board Games Minimax Search Alpha-Beta Search Games with an Element of Chance

© D. Weld, D. Fox 3 Games Overview chess, checkers, go, othello backgammon, monopoly bridge, poker, scrabble Imperfect information Perfect information deterministic chance

© D. Weld, D. Fox 4 Games & Game Theory When there is more than one agent, the future is not anymore easily predictable for the agent In competitive environments (conflicting goals), adversarial search becomes necessary In AI, we usually consider special type of games: board games, which can be characterized as deterministic, turn-taking, two-player, zero-sum games with perfect information

© D. Weld, D. Fox 5 Games as Search  Components:  States:  Initial state:  Successor function:  Terminal test:  Utility function:

© D. Weld, D. Fox 6 Games as Search  Components:  States: board configurations  Initial state: the board position and which player will move  Successor function: returns list of (move, state) pairs, each indicating a legal move and the resulting state  Terminal test: determines when the game is over  Utility function: gives a numeric value in terminal states (eg, -1, 0, +1 in chess for loss, tie, win)

© D. Weld, D. Fox 7 Games as Search  Components:  States: board configurations  Initial state: the board position and which player will move  Successor function: returns list of (move, state) pairs, each indicating a legal move and the resulting state  Terminal test: determines when the game is over  Utility function: gives a numeric value in terminal states (eg, -1, 0, +1 in chess for loss, tie, win)  Convention: first player is MAX, 2nd player is MIN  State utility values from MAX’s perspective  Initial state and legal moves define the game tree

© D. Weld, D. Fox 8 Tic-Tac-Toe Example

© D. Weld, D. Fox 9

10

© D. Weld, D. Fox 11

© D. Weld, D. Fox 12

© D. Weld, D. Fox 13

© D. Weld, D. Fox 14

© D. Weld, D. Fox 15

© D. Weld, D. Fox 16

© D. Weld, D. Fox 17 Properties of minimax Complete? Optimal? Time complexity? Space complexity?

© D. Weld, D. Fox 18 Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(b m ) Space complexity? O(bm) (depth-first exploration)

© D. Weld, D. Fox 19 Good enough?  Chess:  branching factor b≈35  game length m≈100  search space b m ≈ ≈  The Universe:  number of atoms ≈  age ≈ milliseconds

© D. Weld, D. Fox 20 Alpha-Beta Pruning

© D. Weld, D. Fox 21

© D. Weld, D. Fox 22

© D. Weld, D. Fox 23

© D. Weld, D. Fox 24

© D. Weld, D. Fox 25

© D. Weld, D. Fox 26 Alpha-Beta MaxVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in successors(state)){ child = MinVal(s,alpha,beta); alpha = max(alpha,child); if (alpha>=beta) return child; } return alpha; } alpha = the highest (best) value for MAX along path beta = the lowest (best) value for MIN along path

© D. Weld, D. Fox 27 Alpha-Beta MinVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in successors(state)){ child = MaxVal(s,alpha,beta); beta = min(beta,child); if (beta <=alpha) return child; } return beta; } alpha = the highest (best) value for MAX along path beta = the lowest (best) value for MIN along path

© D. Weld, D. Fox 28

© D. Weld, D. Fox 29

© D. Weld, D. Fox 30

© D. Weld, D. Fox 31

© D. Weld, D. Fox 32

© D. Weld, D. Fox 33

© D. Weld, D. Fox 34

© D. Weld, D. Fox 35

© D. Weld, D. Fox 36

© D. Weld, D. Fox 37

© D. Weld, D. Fox 38 Properties of α-β Still optimal, pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(b m/2 )  doubles depth of search A simple example of the value of reasoning about which computations are relevant (a form of metareasoning)

© D. Weld, D. Fox 39 Good enough?  Chess:  branching factor b≈35  game length m≈100  search space b m/2 ≈ ≈  The Universe:  number of atoms ≈  age ≈ milliseconds

© D. Weld, D. Fox 40 Partial State Spaces Strategies: search to a fixed depth iterative deepening (most common) stop only at ‘quiescent’ nodes

© D. Weld, D. Fox 41

© D. Weld, D. Fox 42 Evaluation Function  When search space is too large, create game tree up to a certain depth only.  Art is to evaluate positions that are not terminal states.  Example of simple evaluation criteria in chess:  Material worth: pawn=1, knight =3, rook=5, queen=9.  Other: king safety, good pawn structure  Rule of thumb: 3-point advantage = certain victory eval(s) = w1 * material(s) + w2 * mobility(s) + w3 * king safety(s) + w4 * center control(s) +...

© D. Weld, D. Fox 43 Cutting off search  Does it work in practice? b m = 10 6, b=35  m=4  4-ply lookahead is a hopeless chess player!  4-ply ≈ human novice  8-ply ≈ typical PC, human master  12-ply ≈ Deep Blue, Kasparov

© D. Weld, D. Fox 44 Transposition Tables Game trees contain repeated states In chess, e.g., the game tree may have nodes, but there are only different board positions Similar to closed list in search, maintain a transposition table  Got its name from the fact that the same state is reached by a transposition of moves.

© D. Weld, D. Fox 45 Game Playing in Practice  Checkers: Chinook ended 40 year reign of human world champion Marion Tinsley in 1994; used an endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 443,748,401,247 positions (!)  Chess: Deep Blue defeated human world champion Gary Kasparov in a 6 game match in Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply  Othello: human champions refuse to play against computers because software is too good  Go: human champions refuse to play against computers because software is too bad

© D. Weld, D. Fox 46 Summary of Deterministic Games Basic idea: minimax -- too slow for most games Alpha-Beta pruning can increase max depth by factor up to 2 Limited depth search may be necessary Static evaluation functions necessary for limited depth search and help alpha-beta Opening game and End game databases can help Computers can beat humans in some games (checkers, chess, othello) but not in others (Go)

© D. Weld, D. Fox 47 Other Games chess, checkers, go, othello backgammon, monopoly bridge, poker, scrabble Imperfect information Perfect information deterministic chance

© D. Weld, D. Fox 48 Games that Include an Element of Chance White has just rolled 6-5 and has 4 legal moves.

© D. Weld, D. Fox 49 Game Tree for Games with an Element of Chance  In addition to MIN- and MAX nodes, we need chance nodes (e.g., for rolling dice).  Search costs increase: Instead of O(b d ), we get O((bn) d ), where n is the number of chance outcomes.

© D. Weld, D. Fox 50 Imperfect Information E.g. card games, where opponents’ initial cards are unknown Idea: For all deals consistent with what you can see  compute the minimax value of available actions for each of possible deals  compute the expected value over all deals