Chapter 6, Sec. 1 - 4 Adversarial Search.

Slides:



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

Artificial Intelligence 1: game playing Lecturer: Tom Lenaerts SWITCH, Vlaams Interuniversitair Instituut voor Biotechnologie.
Game Playing CS 63 Chapter 6
Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Alpha-Beta Search. 2 Two-player games The object of a search is to find a path from the starting position to a goal position In a puzzle-type problem,
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!
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 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.
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.
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
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.
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.
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.
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.
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.
Artificial Intelligence AIMA §5: Adversarial Search
Game Playing Why do AI researchers study game playing?
Games and adversarial search (Chapter 5)
Game Playing Why do AI researchers study game playing?
EA C461 – Artificial Intelligence Adversarial Search
Announcements Homework 1 Full assignment posted..
4. Games and adversarial search
PENGANTAR INTELIJENSIA BUATAN (64A614)
Games and adversarial search (Chapter 5)
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Adversarial Search Chapter 5.
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
Artificial Intelligence
Games & Adversarial Search
Games & Adversarial Search
Artificial Intelligence
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:

Chapter 6, Sec. 1 - 4 Adversarial Search

Outline Optimal decisions α-β pruning Imperfect, real-time decisions

Games vs. search problems Competitive multiagent environment in which the agents’ goals are in conflict: adversarial search problem - games. Games in AI: deterministic, turn-taking, 2-player, zero-sum games of perfect information – i.e. deterministic, fully observable environments in which there two agents whose actions must alternate and in which the utility values at the end of the game are always equal and opposite. "Unpredictable" opponent  solution is a strategy specifying a move for every possible opponent reply. Time limits  unlikely to find goal, must approximate. how to make the best possible use of time? The optimal move and an algorithm for finding it the techniques for choosing a good move within the time limits Pruning allows us to ignore portions of the search tree that make no difference to the final choice Heuristic evaluation functions allow us to approximate the true utility of a state without doing a complete search.

Types of games deterministic chance Perfect information Chess, checkers, go, othello backgammon, monopoly Imperfect information Bridge, poker, scrabble, nuclear war

Optimal decisions in game A game can be formally defined as a kind of search problem with the following components: Initial state: includes the board position and identifies the player to move Successor function: returns a list of (move, state) pairs, each indicating a legal move and resulting state. Terminal test: determines when the game is over – terminal states. Utility function ( an objective function or payoff function): gives a numeric value for the terminal states. -- +x, -x, 0 A game tree for tic-tac-toe: Play alternates b/t MAX’s placing an X and MIN’s placing an O until we reach leaf nodes of terminal states. The # on each leaf node: the utility value of the terminal state from the point of view of MAX.

Continued... Optimal decisions Cf) In a normal search problem, the optimal solution would be a sequence of moves leading to a goal state in the minimum path cost. In a game, a player must find a contingent strategy for every possible response by opponent An optimal strategy leads to outcomes at last as good as any other strategy when one is playing an infallible opponent. In a game tree of tic-tac-toe, the optimal strategy can be determined by examining the minimax value of each node, which is the utility (for MAX) of being in the corresponding state, assuming that both players play optimally from there to the end. if n is a terminal state if n is a MAX node if n is a MIN node Given a choice, MAX prefer to move to a state of maximum value, whereas MIN prefers a state of minimum value.

Game tree (2-player, deterministic, turns) The top node: the initial state Alternative moves by MIN(O) and MAX(X), until we eventually reach terminal states, which can be assigned utilities according to the rules of the game.

Minimax algorithm Compute the minimax decision from the current state. Perfect play for deterministic games, perfect-information game. Idea: choose move to position with highest minimax value = best achievable payoff against best play E.g., 2-ply game:

Minimax algorithm -- the minimax decision from the current state

Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(bm) Space complexity? O(bm) (depth-first exploration) The # of game states it has to examine is exponential in the # of moves. For chess, b ≈ 35, m ≈100 for "reasonable" games  exact solution completely infeasible

α-β pruning Compute the correct minimax decision w/o looking at every node in the game tree => reduce the # of states examined. Prunes away branches of the game tree that can’t possibly influence the final decision. General principle: Consider a node n somewhere in the tree, s.t. Player has a choice of moving to that node. If Player has a better choice m either at the parent node of n or at any choice point further up, then n will never be reached in actual play.

α-β pruning example

Continued… α-β pruning example

Continued… α-β pruning example

Continued… α-β pruning example

Continued… α-β pruning example

Properties of α-β pruning Pruning does not affect final result Good move ordering improves effectiveness of pruning -- highly dependent on the order of successors examined. It might be worthwhile to try to examine first the successor that are likely to be best. With "perfect ordering – the best-first” of successor’s examination, time complexity = O(bm/2) Effective branching factor:  b doubles depth of search w/i the same amount of time. Can easily reach depth 8 and play good chess. With random examination, the total # of nodes examined will be O(b3m/4) A simple example of the value of reasoning about which computations are relevant (a form of metareasoning)

Why is it called α-β? α is the value of the best (i.e., highest-value) choice found so far at any choice point along the path for MAX  is the value of the best (i.e. lowest-value) choice found so far at any choice point along the path for MIN. If V is worse than α, MAX will avoid it  prune that branch Define β similarly for MIN

The α-β algorithm

Resource limits Suppose we have 100 seconds, explore 104 nodes/sec  106 nodes per move Alpha-beta pruning still has to search all the way to terminal states for at least a portion of the search space. Standard approach: cutoff test: Cut off the search earlier and decide when to apply evaluation function, turning nonterminal nodes into terminal leaves. e.g., depth limit (perhaps add quiescence search) evaluation function = estimated desirability(utility) of position

Evaluation functions Returns an estimate of the expected utility of the game from a position. Requirements The eval-fn should order the terminal states in the same way as the true utility function; otherwise, an agent using it might select suboptimal moves even if it can see ahead all the way to the end of the game. The computation must not take too long. For nonterminal states, the eval-fn should be strongly correlated with the actual chances of winning. => Make a guess a/b the final outcome. Categories of states defined by features which are calculated by eval-fn and the states in each category have the same values for all the features as a single value which reflects the proportion of states with each outcome – the weighted average or expected value. The expected value determined for each category, resulting in an eval-fn that works for any state. – too much to estimate all the probabilities of winning for too may categories Compute separate numerical contributions from each feature and then combine them to find the total value. -- a weighted linear function Eval(s)=w1 f1 (s)+w2 f2 (s)+ …. +wn fn (s)

Eval(s) = w1 f1(s) + w2 f2(s) + … + wn fn(s) Evaluation functions For chess, typically linear weighted sum of features Eval(s) = w1 f1(s) + w2 f2(s) + … + wn fn(s) e.g., w1 = 9 with f1(s) = (number of white queens) – (number of black queens), etc. Deciding the features and weights are from human chess-playing experience. The weights of the Eval-fn can be estimated by the machine learning techniques.

Cutting off search Modify -SEARCH so that it’ll call the Eval-fn when to cutt off the search. MinimaxCutoff is identical to MinimaxValue except Terminal? is replaced by Cutoff? Utility is replaced by Eval. E.g.) Apply a depth-limit. => the amount of time used won’t exceed what the rules of the game allow. Does it work in practice? bm = 106, b=35  m=4

Deterministic games in practice Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in 1994. Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions. Chess: Deep Blue defeated human world champion Garry Kasparov in a six-game match in 1997. 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 compete against computers, who are too good. Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves.

Summary Games are fun to work on! They illustrate several important points about AI perfection is unattainable  must approximate good idea to think about what to think about