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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
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
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
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
CMSC 671 Fall 2001 Class #8 – Thursday, September 27.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing Games require different search procedures. Basically they are based on generate and test philosophy. At one end, generator generates entire.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search: Game Playing Reading: Chapter next time.
Adversarial Search Chapter 6. History Much of the work in this area has been motivated by playing chess, which has always been known as a "thinking person's.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Adversarial Search Chapter 6.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Adversarial Search and Game Playing Examples. Game Tree MAX’s play  MIN’s play  Terminal state (win for MAX)  Here, symmetries have been used to reduce.
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.
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
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
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.
KU NLP Heuristic Search Heuristic Search and Expert Systems (1) q An interesting approach to implementing heuristics is the use of confidence.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
Game Playing.
Games CPS 170 Ron Parr. Why Study Games? Many human activities can be modeled as games –Negotiations –Bidding –TCP/IP –Military confrontations –Pursuit/Evasion.
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.
1 Computer Group Engineering Department University of Science and Culture S. H. Davarpanah
Chapter 12 Adversarial Search. (c) 2000, 2001 SNU CSE Biointelligence Lab2 Two-Agent Games (1) Idealized Setting  The actions of the agents are interleaved.
For Wednesday Read Weiss, chapter 12, section 2 Homework: –Weiss, chapter 10, exercise 36 Program 5 due.
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.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
CSCI 4310 Lecture 6: Adversarial Tree Search. Book Winston Chapter 6.
GAME PLAYING 1. There were two reasons that games appeared to be a good domain in which to explore machine intelligence: 1.They provide a structured task.
Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search 2 (Game Playing)
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!)
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
Search: Games & Adversarial Search Artificial Intelligence CMSC January 28, 2003.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Last time: search strategies
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Pengantar Kecerdasan Buatan
Artificial Intelligence Chapter 12 Adversarial Search
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Mini-Max search Alpha-Beta pruning General concerns on games
Adversarial Search CS 171/271 (Chapter 6)
CS51A David Kauchak Spring 2019
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

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 is possible. Many games can be modeled very easily, although game playing turns out to be very hard.

3 2 Player Games Requires reasoning under uncertainty. Two general approaches: –Assume nothing more than the rules of the game are important - reduces to a search problem. –Try to encode strategies using some type of pattern-directed system (perhaps one that can learn).

4 Search and Games Each node in the search tree corresponds to a possible state of the game. Making a move corresponds to moving from the current state (node) to a child state (node). Figuring out which child is best is the hard part. The branching factor is the number of possible moves (children).

5 Search Tree Size For most interesting games it is impossible to look at the entire search tree. Chess: –branching factor is about 35 –typical match includes about 100 moves. –Search tree for a complete game:

6 Heuristic Search Must evaluate each choice with less than complete information. For games we often evaluate the game tree rooted at each choice. There is a tradeoff between the number of choices analyzed and the accuracy of each analysis.

7 Game Trees

8 Plausible Move Generator Sometimes it is possible to develop a move generator that will (with high probability) generate only those moves worth consideration. This reduces the branching factor, which means we can spend more time analyzing each of the plausible moves.

9 Recursive State Evaluation We want to rank the plausible moves (assign a value to each resulting state). For each plausible move, we want to know what kind of game states could follow the move (Wins? Loses?). We can evaluate each plausible move by taking the value of the best of the moves that could follow it.

10 Assume the adversary is good. To evaluate an adversary’s move, we should assume they pick a move that is good for them. To evaluate how good their moves are, we should assume we will do the best we can after their move (and so on…)

11 Static Evaluation Function At some point we must stop evaluating states recursively. At each leaf node we apply a static evaluation function to come up with an estimate of how good the node is from our perspective. We assume this function is not good enough to directly evaluate each choice, so we instead use it deeper in the tree.

12 Example evaluation functions Tic-Tac-Toe: number of rows, columns or diagonals with 2 of our pieces. Checkers: number of pieces we have - the number of pieces the opponent has. Chess: weighted sum of pieces: –king=1000, queen=10, bishop=5, knight=5,...

13 Minimax Depth-first search with limited depth. Use a static evaluation function for all leaf states. Assume the opponent will make the best move possible.

14 Minimax Search Tree A EFG B HI C JK D Our Move Maximizing Ply Opponent’s Move Minimizing Ply

15 Minimax Algorithm Minimax(curstate, depth, player): If (depth==max) Return static(curstate,player) generate successor states s[1..n] If (player==ME) Return max of Minimax(s[i],depth+1,OPPONENT) Else Return min of Minimax(s[i],depth+1,ME)

16 The Game of MinMax Start in the center square. Player MAX picks any number in the current row. Player MIN picks any number in the resulting column. The game ends when a player cannot move. MAX wins if the sum of numbers picked is > 0.

17

MAX’s Turn Max Min Max

19 Pruning We can use a branch-and-bound technique to reduce the number of states that must be examined to determine the value of a tree. We keep track of a lower bound on the value of a maximizing node, and don’t bother evaluating any trees that cannot improve this bound.

Max Min Max Pruning in MinMax

21 Pruning Minimizing Nodes Keep track of an upper bound on the value of a minimizing node. Don’t bother with any subtrees that cannot improve (lower) the bound.

22 Minimax with Alpha-Beta Cutoffs Alpha is the lower bound on maximizing nodes. Beta is the upper bound on minimizing nodes. Both alpha and beta get passed down the tree during the Minimax search.

23 Usage of Alpha & Beta At minimizing nodes, we stop evaluating children if we get a child whose value is less than the current lower bound (alpha). At maximizing nodes, we stop evaluating children as soon as we get a child whose value is greater than the current upper bound (beta).

24 Alpha & Beta At the root of the search tree, alpha is set to -  and beta is set to + . Maximizing nodes update alpha from the values of children. Minimizing nodes update beta from the value of children. If alpha > beta, stop evaluating children.

25 Movement of Alpha and Beta Each node passes the current value of alpha and beta to each child node evaluated. Children nodes update their copy of alpha and beta, but do not pass alpha or beta back up the tree. Minimizing nodes return beta as the value of the node. Maximizing nodes return alpha as the value of the node.

26 A BC DEFGH IJMN KL

27 The Effectiveness of Alpha-Beta The effectiveness depends on the order in which children are visited. In the best case, the effective branching factor will be reduced from b to sqrt(b). In an average case (random values of leaves) the branching factor is reduced to b/logb.

28 The Horizon Effect Using a fixed depth search can lead to the following: –A bad event is inevitable. –The event is postponed by selecting only those moves in which the event is not visible (it is over the horizon). –Extending the depth only moves the horizon, it doesn’t eliminate the problem.

29 Quiescence Using a fixed depth search can lead to other problems: –it’s not fair to evaluate a board in the middle of an exchange of Chess pieces. –What if we choose an odd number for the search depth on the game of MinMax? The evaluation function should only be applied to states that are quiescent (relatively stable).

30 Pattern-Directed Play Encode a bunch of patterns and some information that indicates what move should be selected if the game state ever matches the pattern. Book play: often used in Chess programs for the beginning and ending of games.

31 Iterative Deepening Many games have time constraints. It is hard to estimate how long the search to a fixed depth will take (due to pruning). Ideally we would like to provide the best answer we can, knowing that time could run out at any point in the search. One solution is to evaluate the choices with increasing depths.

32 Iterative Deepening There is lots of repetition! The repeated computation is small compared to the new computation. Example: branching factor 10 –depth 3: 1,000 leaf nodes –depth 4: 10,000 leaf nodes –depth 5: 100,000 leaf nodes

33 A* Iterative Deepening Iterative deepening can also be used with A*. 1. Set THRESHOLD to be f(start_state). 2. Depth-first search, don’t explore any nodes whose f value is greater than THRESHOLD. 3. If no solution is found, increase THRESHOLD and go back to step 2.