Games vs. search problems. Adversarial Search. Types of games. Outline

Similar documents
Game playing. Chapter 6. Chapter 6 1

Outline. Game playing. Types of games. Games vs. search problems. Minimax. Game tree (2-player, deterministic, turns) Games

Games vs. search problems. Game playing Chapter 6. Outline. Game tree (2-player, deterministic, turns) Types of games. Minimax

Game playing. Chapter 6. Chapter 6 1

CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH. Santiago Ontañón

Game playing. Chapter 5. Chapter 5 1

CS 380: ARTIFICIAL INTELLIGENCE

Game playing. Outline

Game Playing. Philipp Koehn. 29 September 2015

ADVERSARIAL SEARCH. Chapter 5

Game Playing: Adversarial Search. Chapter 5

Game Playing. Dr. Richard J. Povinelli. Page 1. rev 1.1, 9/14/2003

Game playing. Chapter 5, Sections 1{5. AIMA Slides cstuart Russell and Peter Norvig, 1998 Chapter 5, Sections 1{5 1

Game playing. Chapter 5, Sections 1 6

Lecture 5: Game Playing (Adversarial Search)

Adversarial search (game playing)

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 4: Search 3.

Artificial Intelligence. Topic 5. Game playing

Ch.4 AI and Games. Hantao Zhang. The University of Iowa Department of Computer Science. hzhang/c145

Last update: March 9, Game playing. CMSC 421, Chapter 6. CMSC 421, Chapter 6 1

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search

Adversarial Search (a.k.a. Game Playing)

CS 188: Artificial Intelligence

Programming Project 1: Pacman (Due )

Today. Nondeterministic games: backgammon. Algorithm for nondeterministic games. Nondeterministic games in general. See Russell and Norvig, chapter 6

Games CSE 473. Kasparov Vs. Deep Junior August 2, 2003 Match ends in a 3 / 3 tie!

Adversarial Search Lecture 7

Game Playing. Why do AI researchers study game playing? 1. It s a good reasoning problem, formal and nontrivial.

CS 188: Artificial Intelligence Spring Game Playing in Practice

Adversarial Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 9 Feb 2012

COMP219: Artificial Intelligence. Lecture 13: Game Playing

Adversarial Search and Game Playing

Adversarial Search. CMPSCI 383 September 29, 2011

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro) 1

CS 188: Artificial Intelligence Spring 2007

CSE 473: Artificial Intelligence. Outline

6. Games. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Mechanical Turk. Origins. origins. motivation. minimax search

Adversarial Search. Human-aware Robotics. 2018/01/25 Chapter 5 in R&N 3rd Ø Announcement: Slides for this lecture are here:

Game-Playing & Adversarial Search

Artificial Intelligence 1: game playing

CS 188: Artificial Intelligence Spring Announcements

Announcements. Homework 1. Project 1. Due tonight at 11:59pm. Due Friday 2/8 at 4:00pm. Electronic HW1 Written HW1

Game Playing State-of-the-Art

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence

Adversarial Search and Game- Playing C H A P T E R 6 C M P T : S P R I N G H A S S A N K H O S R A V I

Adversarial Search. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 5

CSE 573: Artificial Intelligence Autumn 2010

Intuition Mini-Max 2

Artificial Intelligence

Game Playing State-of-the-Art CSE 473: Artificial Intelligence Fall Deterministic Games. Zero-Sum Games 10/13/17. Adversarial Search

Artificial Intelligence Adversarial Search

Artificial Intelligence

CS 5522: Artificial Intelligence II

Adversarial Search. Read AIMA Chapter CIS 421/521 - Intro to AI 1

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram

Game Playing State-of-the-Art. CS 188: Artificial Intelligence. Behavior from Computation. Video of Demo Mystery Pacman. Adversarial Search

CS 331: Artificial Intelligence Adversarial Search II. Outline

Game Playing State of the Art

CS 188: Artificial Intelligence. Overview

CS440/ECE448 Lecture 9: Minimax Search. Slides by Svetlana Lazebnik 9/2016 Modified by Mark Hasegawa-Johnson 9/2017

CS 188: Artificial Intelligence

CS 771 Artificial Intelligence. Adversarial Search

Outline. Game Playing. Game Problems. Game Problems. Types of games Playing a perfect game. Playing an imperfect game

Announcements. CS 188: Artificial Intelligence Spring Game Playing State-of-the-Art. Overview. Game Playing. GamesCrafters

Artificial Intelligence

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro, Diane Cook) 1

Game-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA

School of EECS Washington State University. Artificial Intelligence

CITS3001. Algorithms, Agents and Artificial Intelligence. Semester 2, 2016 Tim French

Artificial Intelligence

Artificial Intelligence

Games and Adversarial Search

Adversarial Search and Game Playing. Russell and Norvig: Chapter 5

CSE 573: Artificial Intelligence

CSE 473: Artificial Intelligence Autumn 2011

Solving Problems by Searching: Adversarial Search

Artificial Intelligence. Minimax and alpha-beta pruning

CSE 40171: Artificial Intelligence. Adversarial Search: Games and Optimality

Adversarial Search Aka Games

CS 4700: Foundations of Artificial Intelligence

Games vs. search problems

Lecture 14. Questions? Friday, February 10 CS 430 Artificial Intelligence - Lecture 14 1

Foundations of Artificial Intelligence

Games and Adversarial Search II

Foundations of Artificial Intelligence

Adversarial Search (Game Playing)

Adversarial Search 1

CSE 473: Ar+ficial Intelligence

Ar#ficial)Intelligence!!

Game Playing AI Class 8 Ch , 5.4.1, 5.5

Adversarial Search. Rob Platt Northeastern University. Some images and slides are used from: AIMA CS188 UC Berkeley

Contents. Foundations of Artificial Intelligence. Problems. Why Board Games?

CSE 40171: Artificial Intelligence. Adversarial Search: Game Trees, Alpha-Beta Pruning; Imperfect Decisions

2/5/17 ADVERSARIAL SEARCH. Today. Introduce adversarial games Minimax as an optimal strategy Alpha-beta pruning Real-time decision making

Pengju

Outline. Introduction. Game-Tree Search. What are games and why are they interesting? History and State-of-the-art in Game Playing

Set 4: Game-Playing. ICS 271 Fall 2017 Kalev Kask

Path Planning as Search

CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5

Transcription:

Games vs. search problems Unpredictable opponent solution is a strategy specifying a move for every possible opponent reply dversarial Search Chapter 5 Time limits unlikely to find goal, must approximate Plan of attack: Computer considers possible lines of play (Babbage, 1846) lgorithm for perfect play (Zermelo, 191; Von Neumann, 1944) Finite horizon, approximate evaluation (Zuse, 1945; Wiener, 1948; Shannon, 1950) First chess program (Turing, 1951) Machine learning to improve evaluation accuracy (Samuel, 195 57) Pruning to allow deeper search (McCarthy, 1956) Chapter 5 1 Chapter 5 Outline Types of games Games Perfect play minimax decisions α β pruning Resource limits and approximate evaluation perfect information imperfect information deterministic chess, checkers, go, othello battleships, blind tictactoe chance backgammon monopoly bridge, poker, scrabble nuclear war Games of chance Games of imperfect information Chapter 5 Chapter 5 4

Game tree (-player, deterministic, turns) Minimax algorithm M () function Minimax-Decision(state) returns an action inputs: state, current state in game (O) M () (O) TERL O O... O O O O............... O O O... O O O O O O O return the a in ctions(state) maximizing Min-Value(Result(a,state)) function Max-Value(state) returns a utility value if Terminal-Test(state) then return Utility(state) v for a, s in Successors(state) do v Max(v, Min-Value(s)) return v function Min-Value(state) returns a utility value if Terminal-Test(state) then return Utility(state) v for a, s in Successors(state) do v Min(v, Max-Value(s)) return v Utility 1 0 +1 Chapter 5 5 Chapter 5 7 Minimax Properties of minimax Perfect play for deterministic, perfect-information games Idea: choose move to position with highest minimax value = best achievable payoff against best play Complete?? E.g., -ply game: M 1 11 1 1 1 1 1 8 4 6 5 Chapter 5 6 Chapter 5 8

Properties of minimax Complete?? Only if tree is finite (chess has specific rules for this). ps. a finite strategy can exist even in an infinite tree! Optimal?? Properties of minimax Complete?? Yes, if tree is finite (chess has specific rules for this) Optimal?? Yes, against an optimal opponent. Otherwise?? Time complexity?? O(b m ) Space complexity?? Chapter 5 9 Chapter 5 11 Properties of minimax Complete?? Yes, if tree is finite (chess has specific rules for this) Optimal?? Yes, against an optimal opponent. Otherwise?? Time complexity?? Properties of minimax Complete?? Yes, if tree is finite (chess has specific rules for this) Optimal?? Yes, against an optimal opponent. Otherwise?? Time complexity?? O(b m ) Space complexity?? O(bm) (depth-first exploration) For chess, b 5, m 100 for reasonable games exact solution completely infeasible But do we need to explore every path? Chapter 5 10 Chapter 5 1

α β pruning example α β pruning example M M 1 8 1 8 Chapter 5 1 Chapter 5 15 α β pruning example α β pruning example M M 5 1 8 1 8 5 Chapter 5 Chapter 5 16

α β pruning example Why is it called α β? M M 5...... 1 8 5 M V α is the best value (to max) found so far off the current path If V is worse than α, max will avoid it prune that branch Define β similarly for min Figure 5.5, p. 168. Chapter 5 17 Chapter 5 19 Why is it called α β? The α β algorithm [α, β] range: [lowerbound, upperbound] (a) [, + ] (b) [, + ] function lpha-beta-decision(state) returns an action return the a in ctions(state) maximizing Min-Value(Result(a,state)) [, ] B [, ] B 1 (c) [, + ] (d) [, + ] [, ] [, ] [, ] B B 1 8 1 8 (e) [, ] (f) [, ] C function Max-Value(state, α, β) returns a utility value inputs: state, current state in game α, the value of the best alternative for max along the path to state β, the value of the best alternative for min along the path to state if Terminal-Test(state) then return Utility(state) v foreach a in ctions(state) do v Max(v, Min-Value(Result(s,a), α, β)) if v β then return v α Max(α, v) return v [, ] [, ] [, ] B C D [, ] [, ] [, ] B C D function Min-Value(state, α, β) returns a utility value same as Max-Value but with roles of α,β reversed 1 8 1 8 5 Chapter 5 18 Chapter 5 0

Properties of α β Evaluation functions Pruning does not affect final result Good move ordering improves effectiveness of pruning With perfect ordering, time complexity = O(b m/ ) doubles solvable depth with constant time constraint simple example of the value of reasoning about which computations are relevant (a form of metareasoning) Unfortunately, 5 50 is still impossible! Black to move White slightly better White to move Black winning For chess, typically linear weighted sum of features Eval(s) = w 1 f 1 (s) + w f (s) +... + w n f n (s) e.g., w 1 = 9 with f 1 (s) = (number of white queens) (number of black queens), etc. Chapter 5 1 Chapter 5 Resource limits Digression: Exact values don t matter Standard approach: M Use Cutoff-Test instead of Terminal-Test e.g., depth limit (perhaps add quiescence search) Use Eval instead of Utility i.e., evaluation function that estimates desirability of position 1 1 0 Suppose we have 100 seconds, explore 10 4 nodes/second 10 6 nodes per move 5 8/ α β reaches depth 8 pretty good chess program 1 4 1 0 0 400 Behaviour is preserved under any monotonic transformation of Eval Only the order matters: payoff in deterministic games acts as an ordinal utility function Chapter 5 Chapter 5 4

Deterministic games 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 44,748,401,47 positions. Chess: Deep Blue defeated human world champion Gary Kasparov in a sixgame match in 1997. Deep Blue searches 00 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 compete against computers, which are too good. Go: human champions refuse to compete against computers, which are too bad. In go, b > 00, so most programs use pattern knowledge bases to suggest plausible moves. Nondeterministic games in general In nondeterministic games, chance introduced by dice, card-shuffling Simplified example with coin-flipping: M CHNCE 1 0.5 0.5 0.5 0.5 4 0 4 7 4 6 0 5 Chapter 5 5 Chapter 5 7 Nondeterministic games: backgammon lgorithm for nondeterministic games 0 1 4 5 6 7 8 9 10 11 1 Expectiminimax gives perfect play Just like Minimax, except we must also handle chance nodes:... if state is a Max node then return the highest ExpectiMinimax-Value of Successors(state) if state is a Min node then return the lowest ExpectiMinimax-Value of Successors(state) if state is a chance node then return average of ExpectiMinimax-Value of Successors(state)... 5 4 1 0 19 18 17 16 15 1 Chapter 5 6 Chapter 5 8

Nondeterministic games in practice Dice rolls increase b: 1 possible rolls with dice Backgammon 0 legal moves (can be 6,000 with 1-1 roll) depth 4 = 0 (1 0) 1. 10 9 s depth increases, probability of reaching a given node shrinks value of lookahead is diminished α β pruning is much less effective TDGammon uses depth- search + very good Eval world-champion level Summary Games are fun to work on! (and dangerous) They illustrate several important points about I perfection is unattainable must approximate good idea to think about what to think about uncertainty constrains the assignment of values to states optimal decisions depend on information state, not real state Games are to I as grand prix racing is to automobile design Chapter 5 9 Chapter 5 1 Digression: Exact values DO matter M DICE.1 1..9.1.9.1 1 40.9.9.1.9.1 1 4 0 0 1 400 1 1 4 4 0 0 0 0 1 1 400 400 Behaviour is preserved only by positive linear transformation of Eval Hence Eval should be proportional to the expected payoff Chapter 5 0