University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.

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.
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
CMSC 671 Fall 2001 Class #8 – Thursday, September 27.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
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.
Adversarial Search: Game Playing Reading: Chapter next time.
ICS-171:Notes 6: 1 Notes 6: Two-Player Games and Search ICS 171 Winter 2001.
Adversarial Search CSE 473 University of Washington.
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.
Two-player games overview Computer programs which play 2-player games – –game-playing as search – –with the complication of an opponent General principles.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
Artificial Intelligence in Game Design
This time: Outline Game playing The minimax algorithm
Lecture 02 – Part C Game Playing: Adversarial Search
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.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
ICS-270a:Notes 5: 1 Notes 5: Game-Playing ICS 270a Winter 2003.
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
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
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.
Game Playing.
Game Playing ECE457 Applied Artificial Intelligence Spring 2007 Lecture #5.
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 Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Notes on Game Playing by Yun Peng of theYun Peng University of Maryland Baltimore County.
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.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
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.
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.
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
PENGANTAR INTELIJENSIA BUATAN (64A614)
Pengantar Kecerdasan Buatan
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Presentation transcript:

University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture 5

University College Cork (Ireland) Department of Civil and Environmental Engineering Today’s class o Game-playing R. Marinescu October-2009page 2

University College Cork (Ireland) Department of Civil and Environmental Engineering Overview o Computer programs which play 2-player games game-playing as search with the complication of an opponent o General principles of game-playing and search evaluation functions mini-max principle alpha-beta-pruning heuristic techniques o Status of Game-Playing Systems in chess, checkers, backgammon, Othello, etc, computers routinely defeat leading world players o Applications? think of “nature” as an opponent economics, war-gaming, medical drug treatment R. Marinescu October-2009page 3

University College Cork (Ireland) Department of Civil and Environmental Engineering History R. Marinescu October-2009page – Shannon paper 1951 – Turing paper 1958 – Bernstein program – Simon-Newell program (α – β McCarthy?) 1961 – Soviet program – MacHack 6 (MIT AI Lab) 70’s – NW Chess ’s – Crazy Blitz 90’s – Belle, Hitech, Deep Thought, Deep Blue

University College Cork (Ireland) Department of Civil and Environmental Engineering Solving 2-player games o Two players, perfect information o Examples: e.g., chess, checkers, tic-tac-toe o Configuration of the board = unique arrangement of “pieces” o Games as a Search Problem States = board configurations Operators = legal moves Initial State = current configuration Goal = winning configuration payoff function = gives numerical value of outcome of the game R. Marinescu October-2009page 5

University College Cork (Ireland) Department of Civil and Environmental Engineering Game tree search o Game tree: encodes all possible games o We are not looking for a path, only the next move to make (that hopefully leads to a winning position) o Our best move depends on what the other player does R. Marinescu October-2009page 6

University College Cork (Ireland) Department of Civil and Environmental Engineering Move generation R. Marinescu October-2009page 7

University College Cork (Ireland) Department of Civil and Environmental Engineering Example: partial game tree for Tic-Tac-Toe R. Marinescu October-2009page 8 MAX (O) MIN (X) MAX (O) MIN (X)

University College Cork (Ireland) Department of Civil and Environmental Engineering Scoring function R. Marinescu October-2009page 9 We will use the same scoring function for both players, simply negating the values to represent the opponent's scores.

University College Cork (Ireland) Department of Civil and Environmental Engineering Example: scoring function for Tic-Tac-Toe R. Marinescu October-2009page 10 Leaves are either win (+1), loss (-1) or draw (0)

University College Cork (Ireland) Department of Civil and Environmental Engineering Min-Max: an optimal procedure o Designed to find the optimal strategy for MAX player and find best move: 1. Generate the whole game tree to leaves 2. Apply scoring (payoff) function to leaves 3. Back-up values from leaves toward the root:  a MAX node computes the max of its child values  a MIN node computes the min of its child values 4. When value reaches the root: choose max value and the corresponding move. R. Marinescu October-2009page 11

University College Cork (Ireland) Department of Civil and Environmental Engineering Min-Max R. Marinescu October-2009page 12

University College Cork (Ireland) Department of Civil and Environmental Engineering Properties of Min-Max o Complete? Yes (if tree is finite) o Optimal? Yes (against an optimal opponent) o Time complexity? O(b d ) o Space complexity? O(bd) (depth-first exploration) o For chess, b ≈ 35, m ≈100 for "reasonable" games  exact solution completely infeasible Chess:  b ~ 35 (average branching factor)  d ~ 100 (depth of game tree for typical game)  b d ~ ~ nodes!! Tic-Tac-Toe  ~5 legal moves, total of 9 moves  5 9 = 1,953,125  9! = 362,880 (Computer goes first)  8! = 40,320 (Computer goes second) R. Marinescu October-2009page 13

University College Cork (Ireland) Department of Civil and Environmental Engineering Min-Max o Naïve Min-Max assumes that it is possible to search the full tree, where the scoring function of the leaves is either win (+1), loss (-1) or draw (0) o However: For most games, it is impossible to develop the whole search tree o Instead develop part of the tree (up to a certain depth or a number of plys) and evaluate promise of leaves using a static evaluation function. R. Marinescu October-2009page 14

University College Cork (Ireland) Department of Civil and Environmental Engineering Static evaluation function o The static evaluation function: Estimates how good the current board configuration is for a player. Typically, one figures how good it is for the player, and how good it is for the opponent, and subtracts the opponents score from the players Othello: Number of white pieces - Number of black pieces Chess: Value of all white pieces - Value of all black pieces o Typical values from -infinity (loss) to +infinity (win) or [-1, +1]. o If the board evaluation is X for a player, it’s -X for the opponent o Example: Evaluating chess boards, Checkers, Tic-tac-toe R. Marinescu October-2009page 15

University College Cork (Ireland) Department of Civil and Environmental Engineering Evaluation functions: chess R. Marinescu October-2009page 16 For Chess, typically a linear weighted sum of features e.g., weight of the piece (Q = 9, P=1, K=3, B=3.5, R=5)

University College Cork (Ireland) Department of Civil and Environmental Engineering Evaluation functions: Tic-Tac-Toe R. Marinescu October-2009page 17 Another example E(n) =

University College Cork (Ireland) Department of Civil and Environmental Engineering Backup values R. Marinescu October-2009page 18 Two-ply minimax applied to the opening move of tic-tac-toe

University College Cork (Ireland) Department of Civil and Environmental Engineering Backup values R. Marinescu October-2009page 19 Two-ply minimax applied to the X’s second move

University College Cork (Ireland) Department of Civil and Environmental Engineering Backup values R. Marinescu October-2009page 20 Two-ply minimax applied to X’s move near end game

University College Cork (Ireland) Department of Civil and Environmental Engineering Impact of tree depth R. Marinescu October-2009page 21

University College Cork (Ireland) Department of Civil and Environmental Engineering Deep Blue o 32 SP2 processors Each with 8 dedicated chess processors = 256 CP o 50 – 100 billion moves in 3 min ply search R. Marinescu October-2009page 22

University College Cork (Ireland) Department of Civil and Environmental Engineering α – β pruning o In Min-Max there is a separation between node generation and evaluation. R. Marinescu October-2009page 23 Backup Values

University College Cork (Ireland) Department of Civil and Environmental Engineering α – β pruning o Idea: Do depth-first search to generate partial game tree Give static evaluation function to leaves Compute bound on internal nodes o Alpha (α), Beta (β) bounds: α value for MAX node means that max real value is at least alpha β for MIN node means that MIN can guarantee a value below beta o Computation: Alpha of a MAX node is the maximum value of its seen children Beta of a MIN node is the lowest value seen of its child node R. Marinescu October-2009page 24

University College Cork (Ireland) Department of Civil and Environmental Engineering When to prune o Pruning Below a MIN node whose beta value is lower than or equal to the alpha value of its ancestors. Below a MAX node having an alpha value greater than or equal to the beta value of any of its MIN nodes ancestors. R. Marinescu October-2009page 25

University College Cork (Ireland) Department of Civil and Environmental Engineering α – β pruning R. Marinescu October-2009page 26

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 27

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 28

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 29

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 30

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 31

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 32

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 33

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 34

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 35

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 36

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 37

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 38

University College Cork (Ireland) Department of Civil and Environmental Engineering Example R. Marinescu October-2009page 39

University College Cork (Ireland) Department of Civil and Environmental Engineering α – β properties o Guaranteed same value as Min-Max o In a perfectly ordered tree, expected work is O(b d/2 ), vs O(b d ) for Min-Max, so can search twice as deep with the same effort o With good move orderings, the actual running time is close to the optimistic estimate R. Marinescu October-2009page 40

University College Cork (Ireland) Department of Civil and Environmental Engineering Game program o Move generator (ordered moves) 50% o Static evaluation 40% o Search control 10% R. Marinescu October-2009page 41 Openings End games databases [all in place by late 60’s]

University College Cork (Ireland) Department of Civil and Environmental Engineering Move generator o Legal moves o Ordered by Most valuable victim Least valuable aggressor o Killer heuristics R. Marinescu October-2009page 42

University College Cork (Ireland) Department of Civil and Environmental Engineering Static evaluation o Initially - very complex o 70’s - very simple (material) o Now - Deep searchers: moderately complex (hardware) PC programs: elaborate, hand tuned R. Marinescu October-2009page 43

University College Cork (Ireland) Department of Civil and Environmental Engineering Other games o Backgammon Involves randomness – dice rolls Machine-learning based player was able to draw the world champion human player o Bridge Involves hidden information – other players’ cards – and communication during bidding Computer players play well but do not bid well o Go No new elements but huge branching factor No good computer players exist R. Marinescu October-2009page 44

University College Cork (Ireland) Department of Civil and Environmental Engineering Observations o Computers excel in well-defined activities where rules are clear Chess Mathematics o Success comes after a long period of gradual refinement R. Marinescu October-2009page 45

University College Cork (Ireland) Department of Civil and Environmental Engineering Summary o Game playing is best modeled as a search problem o Game trees represent alternate computer/opponent moves o Evaluation functions estimate the quality of a given board configuration for the MAX player. o Min-Max is a procedure which chooses moves by assuming that the opponent will always choose the move which is best for them o Alpha-Beta is a procedure which can prune large parts of the search tree and allow search to go deeper o For many well-known games, computer algorithms based on heuristic search match or out-perform human world experts o Reading: R&N Chapter 6 R. Marinescu October-2009page 46