ITCS 3153 Artificial Intelligence Lecture 9 Adversarial Search Chapter 6 Lecture 9 Adversarial Search Chapter 6.

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.
For Friday Finish chapter 5 Program 1, Milestone 1 due.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
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 Reading: Chapter next time.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Adversarial Search Chapter 6.
Artificial Intelligence for Games Game playing Patrick Olivier
An Introduction to Artificial Intelligence Lecture VI: Adversarial Search (Games) Ramin Halavati In which we examine problems.
CS 416 Artificial Intelligence Lecture 8 Adversarial Search Chapter 6 Lecture 8 Adversarial Search Chapter 6.
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.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
Adversarial Search Board games. Games 2 player zero-sum games Utility values at end of game – equal and opposite Games that are easy to represent Chess.
CS 416 Artificial Intelligence Lecture 8 Adversarial Search Chapter 6 Lecture 8 Adversarial Search Chapter 6.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
This time: Outline Game playing The minimax algorithm
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
Adversarial Search: Game Playing Reading: Chess paper.
double AlphaBeta(state, depth, alpha, beta) begin if depth
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.
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.
CSC 412: AI Adversarial Search
Adversarial Search Chapter 5 Adapted from Tom Lenaerts’ lecture notes.
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
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.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Games 1 Alpha-Beta Example [-∞, +∞] Range of possible values Do DF-search until first leaf.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.
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
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
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 Chapter 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Chapter 5: Adversarial Search & Game Playing
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.
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.
5/4/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 9, 5/4/2005 University of Washington, Department of Electrical Engineering Spring 2005.
EA C461 – Artificial Intelligence Adversarial Search
Adversarial Search Chapter 5.
Games & Adversarial Search
Artificial Intelligence
Games & Adversarial Search
Adversarial Search.
Games & Adversarial Search
Games & Adversarial Search
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:

ITCS 3153 Artificial Intelligence Lecture 9 Adversarial Search Chapter 6 Lecture 9 Adversarial Search Chapter 6

Games “Shall we play a game?” Let’s play tic-tac-toe “Shall we play a game?” Let’s play tic-tac-toe

Minimax

What data do we need to play? Initial State How does the game start?How does the game start? Successor Function A list of legal (move, state) pairs for each stateA list of legal (move, state) pairs for each state Terminal Test Determines when game is overDetermines when game is over Utility Function Provides numeric value for all terminal statesProvides numeric value for all terminal states Initial State How does the game start?How does the game start? Successor Function A list of legal (move, state) pairs for each stateA list of legal (move, state) pairs for each state Terminal Test Determines when game is overDetermines when game is over Utility Function Provides numeric value for all terminal statesProvides numeric value for all terminal states

Minimax Strategy Optimal Stragtegy Leads to outcomes at least as good as any other strategy when playing an infallible opponentLeads to outcomes at least as good as any other strategy when playing an infallible opponent Pick the option that most (max) minimizes the damage your opponent can doPick the option that most (max) minimizes the damage your opponent can do –maximize the worst-case outcome –because your skillful opponent will certainly find the most damaging move Optimal Stragtegy Leads to outcomes at least as good as any other strategy when playing an infallible opponentLeads to outcomes at least as good as any other strategy when playing an infallible opponent Pick the option that most (max) minimizes the damage your opponent can doPick the option that most (max) minimizes the damage your opponent can do –maximize the worst-case outcome –because your skillful opponent will certainly find the most damaging move

Minimax Algorithm MinimaxValue(n) =MinimaxValue(n) = Utility (n) if n is a terminal state max MinimaxValue(s) of all successors, s if n is a MAX node min MinimaxValue(s) of all successors, s if n is a MIN node Algorithm MinimaxValue(n) =MinimaxValue(n) = Utility (n) if n is a terminal state max MinimaxValue(s) of all successors, s if n is a MAX node min MinimaxValue(s) of all successors, s if n is a MIN node

Minimax

Minimax Algorithm We wish to identify minimax decision at the root Recursive evaluation of all nodes in game treeRecursive evaluation of all nodes in game tree Time complexity = O (b m )Time complexity = O (b m ) We wish to identify minimax decision at the root Recursive evaluation of all nodes in game treeRecursive evaluation of all nodes in game tree Time complexity = O (b m )Time complexity = O (b m )

Feasibility of minimax? How about a nice game of chess? Avg branching = 35 and avg # moves = 50 for each playerAvg branching = 35 and avg # moves = 50 for each player –O( ) time complexity = nodes  distinct nodes Minimax is impractical if directly applied to chess How about a nice game of chess? Avg branching = 35 and avg # moves = 50 for each playerAvg branching = 35 and avg # moves = 50 for each player –O( ) time complexity = nodes  distinct nodes Minimax is impractical if directly applied to chess

Pruning minimax tree Are there times when you know you need not explore a particular move? When the move is poor?When the move is poor? Poor compared to what?Poor compared to what? Poor compared to what you have explored so farPoor compared to what you have explored so far Are there times when you know you need not explore a particular move? When the move is poor?When the move is poor? Poor compared to what?Poor compared to what? Poor compared to what you have explored so farPoor compared to what you have explored so far

Alpha-beta pruning

 –the value of the best (highest) choice so far in search of MAX  –the value of the best (lowest) choice so far in search of MIN Order of considering successors matters (look at step f in previous slide)Order of considering successors matters (look at step f in previous slide) –If possible, consider best successors first  –the value of the best (highest) choice so far in search of MAX  –the value of the best (lowest) choice so far in search of MIN Order of considering successors matters (look at step f in previous slide)Order of considering successors matters (look at step f in previous slide) –If possible, consider best successors first

Realtime decisions What if you don’t have enough time to explore entire search tree? We cannot search all the way down to terminal state for all decision sequencesWe cannot search all the way down to terminal state for all decision sequences Use a heuristic to approximate (guess) eventual terminal stateUse a heuristic to approximate (guess) eventual terminal state What if you don’t have enough time to explore entire search tree? We cannot search all the way down to terminal state for all decision sequencesWe cannot search all the way down to terminal state for all decision sequences Use a heuristic to approximate (guess) eventual terminal stateUse a heuristic to approximate (guess) eventual terminal state

Evaluation Function The heuristic that estimates expected utility Cannot take too long (otherwise recurse to get answer)Cannot take too long (otherwise recurse to get answer) It should preserve the ordering among terminal statesIt should preserve the ordering among terminal states –otherwise it can cause bad decision making Define features of game state that assist in evaluationDefine features of game state that assist in evaluation –what are features of chess? The heuristic that estimates expected utility Cannot take too long (otherwise recurse to get answer)Cannot take too long (otherwise recurse to get answer) It should preserve the ordering among terminal statesIt should preserve the ordering among terminal states –otherwise it can cause bad decision making Define features of game state that assist in evaluationDefine features of game state that assist in evaluation –what are features of chess?

Truncating minimax search When do you recurse or use evaluation function? Cutoff-Test (state, depth) returns 1 or 0Cutoff-Test (state, depth) returns 1 or 0 –When 1 is returned, use evaluation function Cutoff beyond a certain depthCutoff beyond a certain depth Cutoff if state is stable (more predictable)Cutoff if state is stable (more predictable) Cutoff moves you know are bad (forward pruning)Cutoff moves you know are bad (forward pruning) When do you recurse or use evaluation function? Cutoff-Test (state, depth) returns 1 or 0Cutoff-Test (state, depth) returns 1 or 0 –When 1 is returned, use evaluation function Cutoff beyond a certain depthCutoff beyond a certain depth Cutoff if state is stable (more predictable)Cutoff if state is stable (more predictable) Cutoff moves you know are bad (forward pruning)Cutoff moves you know are bad (forward pruning)

Benefits of truncation Comparing Chess Using minimax5 plyUsing minimax5 ply Average Human6-8 plyAverage Human6-8 ply Using alpha-beta10 plyUsing alpha-beta10 ply Intelligent pruning14 plyIntelligent pruning14 ply Comparing Chess Using minimax5 plyUsing minimax5 ply Average Human6-8 plyAverage Human6-8 ply Using alpha-beta10 plyUsing alpha-beta10 ply Intelligent pruning14 plyIntelligent pruning14 ply

Games with chance How to include chance in game tree? Add chance nodesAdd chance nodes How to include chance in game tree? Add chance nodesAdd chance nodes

Expectiminimax Expectiminimax (n) = utility(n) if n is a terminal stateutility(n) if n is a terminal state if n is a MAX node if n is a MAX node if n is a MIN node if n is a MIN node if n is a chance node if n is a chance node Expectiminimax (n) = utility(n) if n is a terminal stateutility(n) if n is a terminal state if n is a MAX node if n is a MAX node if n is a MIN node if n is a MIN node if n is a chance node if n is a chance node

Pruning Can we prune search in games of chance? Think about alpha-beta pruningThink about alpha-beta pruning –don’t explore nodes that you know are worse than what you have –we don’t know what we have  chance node values are average of successors Can we prune search in games of chance? Think about alpha-beta pruningThink about alpha-beta pruning –don’t explore nodes that you know are worse than what you have –we don’t know what we have  chance node values are average of successors

History of Games Chess, Deep Blue IBM: 30 RS/6000 comps with 480 custom VLSI chess chipsIBM: 30 RS/6000 comps with 480 custom VLSI chess chips Deep Thought design came from Campbell and Hsu at CMUDeep Thought design came from Campbell and Hsu at CMU 126 mil nodes / s126 mil nodes / s 30 bil positions per move30 bil positions per move routine reaching depth of 14routine reaching depth of 14 iterative deepening alpha-beta searchiterative deepening alpha-beta search Chess, Deep Blue IBM: 30 RS/6000 comps with 480 custom VLSI chess chipsIBM: 30 RS/6000 comps with 480 custom VLSI chess chips Deep Thought design came from Campbell and Hsu at CMUDeep Thought design came from Campbell and Hsu at CMU 126 mil nodes / s126 mil nodes / s 30 bil positions per move30 bil positions per move routine reaching depth of 14routine reaching depth of 14 iterative deepening alpha-beta searchiterative deepening alpha-beta search

Deep Blue evaluation function had 8000 featuresevaluation function had 8000 features 4000 opening moves in memory4000 opening moves in memory 700,000 grandmaster games from which recommendations extracted700,000 grandmaster games from which recommendations extracted many endgames solved for all five piece combosmany endgames solved for all five piece combos evaluation function had 8000 featuresevaluation function had 8000 features 4000 opening moves in memory4000 opening moves in memory 700,000 grandmaster games from which recommendations extracted700,000 grandmaster games from which recommendations extracted many endgames solved for all five piece combosmany endgames solved for all five piece combos

Checkers Arthur Samuel of IBM, 1952 program learned by playing against itselfprogram learned by playing against itself beat a human in 1962 (but human clearly made error)beat a human in 1962 (but human clearly made error) 19 KB of memory19 KB of memory Ghz processor Ghz processor Arthur Samuel of IBM, 1952 program learned by playing against itselfprogram learned by playing against itself beat a human in 1962 (but human clearly made error)beat a human in 1962 (but human clearly made error) 19 KB of memory19 KB of memory Ghz processor Ghz processor

Chinook, Jonathan Schaeffer, 1990 Alpha-beta search on regular PCsAlpha-beta search on regular PCs database of all 444 billion endgame positions with 8 piecesdatabase of all 444 billion endgame positions with 8 pieces Played against Marion TinsleyPlayed against Marion Tinsley –world champion for over 40 years –lost only 3 games in 40 years –Chinook won two games, but lost match Rematch with Tinsley was incomplete for health reasonsRematch with Tinsley was incomplete for health reasons –Chinook became world champion Alpha-beta search on regular PCsAlpha-beta search on regular PCs database of all 444 billion endgame positions with 8 piecesdatabase of all 444 billion endgame positions with 8 pieces Played against Marion TinsleyPlayed against Marion Tinsley –world champion for over 40 years –lost only 3 games in 40 years –Chinook won two games, but lost match Rematch with Tinsley was incomplete for health reasonsRematch with Tinsley was incomplete for health reasons –Chinook became world champion

Othello Smaller search space (5 to 15 legal moves) Humans are no match for computers Smaller search space (5 to 15 legal moves) Humans are no match for computers

Backgammon Garry Tesauro, TD-Gammon, 1992 Reliably ranked in top-three players of worldReliably ranked in top-three players of world Garry Tesauro, TD-Gammon, 1992 Reliably ranked in top-three players of worldReliably ranked in top-three players of world

Discussion How reasonable is minimax? perfectly performing opponentperfectly performing opponent perfect knowledge of leaf node evaluationsperfect knowledge of leaf node evaluations strong assumptionsstrong assumptions How reasonable is minimax? perfectly performing opponentperfectly performing opponent perfect knowledge of leaf node evaluationsperfect knowledge of leaf node evaluations strong assumptionsstrong assumptions

Building alpha-beta tree Can we restrict the size of game tree? alpha-beta will blindly explore tree in depth-first fashion even if only one move is possible from rootalpha-beta will blindly explore tree in depth-first fashion even if only one move is possible from root even if multiple moves are possible, can we use a quick search to eliminate some entirely?even if multiple moves are possible, can we use a quick search to eliminate some entirely? utility vs. time tradeoff to decide when to explore new branches or to stay with what you haveutility vs. time tradeoff to decide when to explore new branches or to stay with what you have Can we restrict the size of game tree? alpha-beta will blindly explore tree in depth-first fashion even if only one move is possible from rootalpha-beta will blindly explore tree in depth-first fashion even if only one move is possible from root even if multiple moves are possible, can we use a quick search to eliminate some entirely?even if multiple moves are possible, can we use a quick search to eliminate some entirely? utility vs. time tradeoff to decide when to explore new branches or to stay with what you haveutility vs. time tradeoff to decide when to explore new branches or to stay with what you have

Metareasoning Reasoning about reasoning alpha-beta is one examplealpha-beta is one example –think before you think –think about utility of thinking about something before you think about it –don’t think about choices you don’t have to think about Reasoning about reasoning alpha-beta is one examplealpha-beta is one example –think before you think –think about utility of thinking about something before you think about it –don’t think about choices you don’t have to think about

Goal-directed reasoning / planning Minimax starts from root and moves forward using combinatorial search What about starting at goal and working backward We talked about difficulty of identifying goal states in bidirectional searchWe talked about difficulty of identifying goal states in bidirectional search We do not know how to combine the two in practical wayWe do not know how to combine the two in practical way Minimax starts from root and moves forward using combinatorial search What about starting at goal and working backward We talked about difficulty of identifying goal states in bidirectional searchWe talked about difficulty of identifying goal states in bidirectional search We do not know how to combine the two in practical wayWe do not know how to combine the two in practical way