Iterative Deepening A*

Slides:



Advertisements
Similar presentations
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Advertisements

Games & Adversarial Search
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Artificial Intelligence
CS 484 – Artificial Intelligence
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Two-player games overview Computer programs which play 2-player games – –game-playing as search – –with the complication of an opponent General principles.
Artificial Intelligence in Game Design
Mahgul Gulzai Moomal Umer Rabail Hafeez
All rights reservedL. Manevitz Lecture 31 Artificial Intelligence A/O* and Minimax L. Manevitz.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
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.
Monotonicity Admissible Search: “That finds the shortest path to the Goal” Monotonicity: local admissibility is called MONOTONICITY This property ensures.
Games & Adversarial Search Chapter 6 Section 1 – 4.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
Ocober 10, 2012Introduction to Artificial Intelligence Lecture 9: Machine Evolution 1 The Alpha-Beta Procedure Example: max.
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.
AD FOR GAMES Lecture 4. M INIMAX AND A LPHA -B ETA R EDUCTION Borrows from Spring 2006 CS 440 Lecture Slides.
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.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
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.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search 2 (Game Playing)
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
Adversarial Search In this lecture, we introduce a new search scenario: game playing 1.two players, 2.zero-sum game, (win-lose, lose-win, draw) 3.perfect.
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
Adversarial Search and Game-Playing
EA C461 – Artificial Intelligence Adversarial Search
Last time: search strategies
AI Classnotes #5, John Shieh, 2012
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.
Pengantar Kecerdasan Buatan
Artificial Intelligence Problem solving by searching CSC 361
Game Playing in AI by: Gaurav Phapale 05 IT 6010
Games & Adversarial Search
Artificial Intelligence
Artificial Intelligence Chapter 12 Adversarial Search
Game playing.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Alpha-Beta Search.
Games & Adversarial Search
Games & Adversarial Search
NIM - a two person game n objects are in one pile
Artificial Intelligence
Alpha-Beta Search.
The Alpha-Beta Procedure
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Alpha-Beta Search.
Alpha-Beta Search.
Mini-Max search Alpha-Beta pruning General concerns on games
Based on slides by: Rob Powers Ian Gent
Artificial Intelligence
Adversarial Search and Game Playing Examples
Games & Adversarial Search
Alpha-Beta Search.
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Iterative Deepening A* Algorithm A* has memory demands that increase exponentially with the depth of the goal node (unless our estimates are perfect). You remember that we improved the space efficiency of the breadth-first search algorithm by applying iterative deepening. Can we do a similar thing for the Algorithm A* ? Sure! February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Iterative Deepening A* In the first iteration, we determine a “cost cut-off” f’(n0) = g’(n0) + h’(n0) = h’(n0), where n0 is the start node. We expand nodes using the depth-first algorithm and backtrack whenever f’(n) for an expanded node n exceeds the cut-off value. If this search does not succeed, determine the lowest f’-value among the nodes that were visited but not expanded. Use this f’-value as the new cut-off value and do another depth-first search. Repeat this procedure until a goal node is found. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Let us now investigate… Two-Player Games February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Two-Player Games with Complete Trees We can use search algorithms to write “intelligent” programs that play games against a human opponent. Just consider this extremely simple (and not very exciting) game: At the beginning of the game, there are seven coins on a table. Player 1 makes the first move, then player 2, then player 1 again, and so on. One move consists of removing 1, 2, or 3 coins. The player who removes all remaining coins wins. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Two-Player Games with Complete Trees Let us assume that the computer has the first move. Then, the game can be described as a series of decisions, where the first decision is made by the computer, the second one by the human, the third one by the computer, and so on, until all coins are gone. The computer wants to make decisions that guarantee its victory (in this simple game). The underlying assumption is that the human always finds the optimal move. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Two-Player Games with Complete Trees 7 1 3 2 H 6 5 4 1 2 1 3 2 1 C C 5 4 4 1 1 2 3 3 2 1 H H 4 3 2 1 1 2 3 3 2 1 C 3 2 1 H H H 3 2 1 H C C C February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Two-Player Games with Complete Trees So the computer will start the game by taking three coins and is guaranteed to win the game. The most practical way of implementing such an algorithm is the Minimax procedure: Call the two players MIN and MAX. Mark each leaf of the search tree with -1, if it shows a victory of MIN, and with 1, if it shows a victory of MAX. Propagate these values up the tree using the rules: If the parent state is a MAX node, give it the maximum value among its children. If the parent state is a MIN node, give it the minimum value among its children. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Two-Player Games with Complete Trees (max) 7 1 H 6 5 4 (min) -1 -1 1 C (max) 5 4 4 3 2 1 1 -1 -1 1 1 1 H 4 3 2 1 3 2 1 C 1 C 1 C (min) 1 1 -1 -1 -1 -1 -1 -1 C (max) 3 2 1 -1 H -1 H -1 H -1 H -1 H -1 H 1 1 1 H (min) C 1 C 1 C 1 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Two-Player Games with Complete Trees The previous example shows how we can use the Minimax procedure to determine the computer’s best move. It also shows how we can apply depth-first search and a variant of backtracking to prune the search tree. Before we formalize the idea for pruning, let us move on to more interesting games. For such games, it is impossible to check every possible sequence of moves. The computer player then only looks ahead a certain number of moves and estimates the chance of winning after each possible sequence. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Introduction to Artificial Intelligence Lecture 9: Two-Player Games I Therefore, we need to define a static evaluation function e(p) that tells the computer how favorable the current game position p is from its perspective. In other words, e(p) will assume large values if a position is likely to result in a win for the computer, and low values if it predicts its defeat. In any given situation, the computer will make a move that guarantees a maximum value for e(p) after a certain number of moves. For this purpose, we can use the Minimax procedure with a specific maximum search depth (ply-depth k for k moves of each player). February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Introduction to Artificial Intelligence Lecture 9: Two-Player Games I For example, let us consider Tic-Tac-Toe (although it would still be possible to search the complete game tree for this game). What would be a suitable evaluation function for this game? We could use the number of lines that are still open for the computer (X) minus the ones that are still open for its opponent (O). February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Introduction to Artificial Intelligence Lecture 9: Two-Player Games I X O O X e(p) = 8 – 8 = 0 e(p) = 6 – 2 = 4 e(p) = 2 – 2 = 0 shows the weak-ness of this e(p) How about these? O X X O e(p) =  e(p) = -  February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

Introduction to Artificial Intelligence Lecture 9: Two-Player Games I February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Now let us specify how to prune the Minimax tree in the case of a static evaluation function. Use two variables alpha (associated with MAX nodes) and beta (associated with MIN nodes). These variables contain the best (highest or lowest, resp.) e(p) value at a node p that has been found so far. Notice that alpha can never decrease, and beta can never increase. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure There are two rules for terminating search: Search can be stopped below any MIN node having a beta value less than or equal to the alpha value of any of its MAX ancestors. Search can be stopped below any MAX node having an alpha value greater than or equal to the beta value of any of its MIN ancestors. Alpha-beta pruning thus expresses a relation between nodes at level n and level n+2 under which entire subtrees rooted at level n+1 can be eliminated from consideration. February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max min max min February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max min max  = 4 min 4 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max min max  = 4 min 4 5 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max min  = 3 max  = 3 min 4 5 3 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max min  = 3 max  = 3  = 1 min 4 5 3 1 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max  = 3 min  = 3 max  = 3  = 1  = 8 min 4 5 3 1 8 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max  = 3 min  = 3 max  = 3  = 1  = 6 min 4 5 3 1 8 6 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example: max  = 3 min  = 3  = 6 max  = 3  = 1  = 6 min 4 5 3 1 8 6 7 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max  = 3 min  = 3  = 6 max  = 3  = 1  = 6 min 4 5 3 1 8 6 7 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max Propagated from grandparent – no values below 3 can influence MAX’s decision any more.  = 3 min  = 3  = 6  = 3 max  = 3  = 1  = 6  = 2 min 4 5 3 1 8 6 7 2 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max  = 3 min  = 3  = 6  = 3 max  = 3  = 1  = 6  = 2  = 5 min 4 5 3 1 8 6 7 2 5 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max  = 3 min  = 3  = 6  = 3 max  = 3  = 1  = 6  = 2  = 4 min 4 5 3 1 8 6 7 2 5 4 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max  = 3  = 4 min  = 3  = 6  = 4 max  = 3  = 1  = 6  = 2  = 4 min 4 5 3 1 8 6 7 2 5 4 4 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max  = 3  = 4 min  = 3  = 6  = 4 max  = 3  = 1  = 6  = 2  = 4  = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 3 max  = 3  = 4 min  = 3  = 6  = 4 max  = 3  = 1  = 6  = 2  = 4  = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 7 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 4 max  = 3  = 4 min  = 3  = 6  = 4  = 6 max  = 3  = 1  = 6  = 2  = 4  = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 7 7 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I

The Alpha-Beta Procedure Example:  = 4 Done! max  = 3  = 4 min  = 3  = 6  = 4  = 6 max  = 3  = 1  = 6  = 2  = 4  = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 7 7 February 23, 2016 Introduction to Artificial Intelligence Lecture 9: Two-Player Games I