Artificial Intelligence

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Ch 4. Heuristic Search 4.0 Introduction(Heuristic)
1 CS 385 Fall 2006 Chapter 4 Heuristic Search. 2 Heuristics eurisko ("I discover" in Greek) "the study of the methods and rules of discovery and invention."
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.
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Using Heuristics in Games At that time two opposing concepts of the game called forth commentary and discussion. The foremost players distinguished two.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
Game Playing Games require different search procedures. Basically they are based on generate and test philosophy. At one end, generator generates entire.
Branch & Bound Algorithms
Chapter 4 Search Methodologies.
Search in AI.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
HEURISTIC SEARCH ARTIFICIAL INTELLIGENCE 5th edition George F Luger
Mahgul Gulzai Moomal Umer Rabail Hafeez
This time: Outline Game playing The minimax algorithm
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
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.
1 Chapter 4 Search Methodologies. 2 Chapter 4 Contents l Brute force search l Depth-first search l Breadth-first search l Properties of search methods.
Artificial Intelligence
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2005.
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)
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
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.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
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.
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.
Lecture 5: Backtracking Depth-First Search N-Queens Problem Hamiltonian Circuits.
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR.
George F Luger ARTIFICIAL INTELLIGENCE 5th edition Structures and Strategies for Complex Problem Solving HEURISTIC SEARCH Luger: Artificial Intelligence,
George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving HEURISTIC SEARCH Luger: Artificial Intelligence,
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
HEURISTIC SEARCH.
CS 415 – A.I. Slide Set 6. Chapter 4 – Heuristic Search Heuristic – the study of the methods and rules of discovery and invention State Space Heuristics.
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.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Ch4 Heuristic Search Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011.
Knowledge Search CPTR 314.
George F Luger ARTIFICIAL INTELLIGENCE 5th edition Structures and Strategies for Complex Problem Solving HEURISTIC SEARCH Luger: Artificial Intelligence,
HEURISTIC SEARCH 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games 4.4Complexity.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
1 HEURISTIC SEARCH ( INFORMED SEARCH). 2  From Greek heuriskein, “to find”.  Of or relating to a usually speculative formulation serving as a guide.
1 HEURISTIC SEARCH ( INFOREMD SEARCH). 2  From Greek heuriskein, “to find”.  Of or relating to a usually speculative formulation serving as a guide.
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.
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.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
AI Classnotes #5, John Shieh, 2012
Iterative Deepening A*
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
State Space 4 Chapter 4 Adversarial Games.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
NIM - a two person game n objects are in one pile
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
CSE (c) S. Tanimoto, 2001 Search-Introduction
Unit II Game Playing.
Presentation transcript:

Artificial Intelligence Chapter 4 HEURISTIC SEARCH Contents Hill-climbing Dynamic programming Heuristic search algorithm Admissibility, Monotonicity, and Informedness Using Heuristics In Games Complexity Issues CSC411 Artificial Intelligence

Artificial Intelligence Heuristics Rules for choosing paths in a state space that most likely lead to an acceptable problem solution Purpose Reduce the search space Reasons May not have exact solutions, need approximations Computational cost is too high CSC411 Artificial Intelligence

Artificial Intelligence First three levels of the tic-tac-toe state space reduced by symmetry CSC411 Artificial Intelligence

Artificial Intelligence The “most wins” heuristic applied to the first children in tic-tac-toe CSC411 Artificial Intelligence

Artificial Intelligence Heuristically reduced state space for tic-tac-toe CSC411 Artificial Intelligence

Artificial Intelligence Hill-Climbing Analog Go uphill along the steepest possible path until no farther up Principle Expand the current state of the search and evaluate its children Select the best child, ignore its siblings and parent No history for backtracking Problem Local maxima – not the best solution CSC411 Artificial Intelligence

Artificial Intelligence The local maximum problem for hill-climbing with 3-level look ahead Insert fig 4.4 CSC411 Artificial Intelligence

Artificial Intelligence Dynamic Programming Forward-backward searching Divide-and-conquer: Divided problems into multiple interacting and related subproblems Address issues of reusing subproblems solutions An example: Fibonacci series F(0) = 1; F(1)=1; F(n)=F(n-1)+F(n-2) Keep track of the computation F(n-1) and F(n-2), and reuse their results to compute F(n) Compare with recursion, much more efficient Applications: String matching Spell checking Nature language processing and understanding planning CSC411 Artificial Intelligence

Global Alignment of Strings Find an optimal global alignment of two character strings Data structure: (n+1)(m+1) array, each element reflects the global alignment success to that point Three possible costs for the current state If a character is shifted along in the shorter string for better possible alignment, the cost is 1 and recorded in the column score; and If a new character is inserted, cost is 1 and reflected in the row score If the characters to be aligned are different, shift and insert, the cost is 2 If identical, the cost is 0 The initialization stage and first step in completing the array for character alignment using dynamic programming. Insert fig 4.5 WITH BAADDCABDDA BBADC B A CSC411 Artificial Intelligence

Artificial Intelligence The initialization stage and first step in completing the array for character alignment using dynamic programming. Insert fig 4.5 WITH BAADDCABDDA BBADC B A CSC411 Artificial Intelligence

Artificial Intelligence The completed array reflecting the maximum alignment information for the strings. CSC411 Artificial Intelligence

Artificial Intelligence A completed backward component of the dynamic programming example giving one (of several possible) string alignments. CSC411 Artificial Intelligence

Minimum Edit Difference Determine the best approximate words of s misspelling word in spelling checker Specified as the number of character insertion, deletion, and replacements necessary to turn the first string into the second Cost: 1 for insertion and deletion, and 2 for replacement Determine the minimum cost difference Data structure: array CSC411 Artificial Intelligence

Artificial Intelligence Initialization of minimum edit difference matrix between intention and execution Insert fig 4.8 CSC411 Artificial Intelligence

Artificial Intelligence Array elements are the costs of the minimum editing to that point plus the minimum cost of either an insertion, deletion or replacement Cost(x, y) = min{ Cost(x-1, y) + 1 (insertion cost), Cost(x-1, y-1) + 2 (replacement cost), Cost(x, y-1) + 1 (deletion cost) } CSC411 Artificial Intelligence

Artificial Intelligence Complete array of minimum edit difference between intention and execution (of several possible) string alignments. Intention ntention delete I, cost 1 etention replace n with e, cost 2 exention replace t with x, cost 2 exenution insert u, cost 1 execution replace n with c, cost 2 CSC411 Artificial Intelligence

Artificial Intelligence The Best-First Search Also heuristic search – use heuristic (evaluation) function to select the best state to explore Can be implemented with a priority queue Breadth-first implemented with a queue Depth-first implemented with a stack CSC411 Artificial Intelligence

Artificial Intelligence The best-first search algorithm CSC411 Artificial Intelligence

Artificial Intelligence Heuristic search of a hypothetical state space CSC411 Artificial Intelligence 13

Artificial Intelligence A trace of the execution of best-first-search CSC411 Artificial Intelligence

Artificial Intelligence Heuristic search of a hypothetical state space with open and closed states highlighted CSC411 Artificial Intelligence

Implement Heuristic Evaluation Function Heuristics can be evaluated in different ways 8-puzzle problem Heuristic 1: count the tiles out of places compared with the goal state Heuristic 2: sum all the distances by which the tiles are out of pace, one for each square a tile must be moved to reach its position in the goal state Heuristic 3: multiply a small number (say, 2) times each direct tile reversal (where two adjacent tiles must be exchanged to be in the order of the goal) CSC411 Artificial Intelligence

Artificial Intelligence The start state, first moves, and goal state for an example-8 puzzle Insert fig 4.12 CSC411 Artificial Intelligence

Artificial Intelligence Three heuristics applied to states in the 8-puzzle CSC411 Artificial Intelligence

Artificial Intelligence Heuristic Design Use the limited information available in a single state to make intelligent choices Empirical, judgment, and intuition Must be its actual performance on problem instances The solution path consists of two parts: from the starting state to the current state, and from the current state to the goal state The first part can be evaluated using the known information The second part must be estimated using unknown information The total evaluation can be f(n) = g(n) + h(n) g(n) – from the starting state to the current state n h(n) – from the current state n to the goal state CSC411 Artificial Intelligence

Artificial Intelligence The heuristic f applied to states in the 8-puzzle Insert fig 4.15 CSC411 Artificial Intelligence

Artificial Intelligence State space generated in heuristic search of the 8-puzzle graph Insert fig 4.16 CSC411 Artificial Intelligence

Artificial Intelligence The successive stages of open and closed that generate the graph are: CSC411 Artificial Intelligence

Artificial Intelligence Open and closed as they appear after the 3rd iteration of heuristic search CSC411 Artificial Intelligence

Heuristic Design Summary f(n) is computed as the sum of g(n) and h(n) g(n) is the depth of n in the search space and has the search more of a breadth-first flavor. h(n) is the heuristic estimate of the distance from n to a goal The h value guides search toward heuristically promising states The g value grows to determine h and force search back to a shorter path, and thus prevents search from persisting indefinitely on a fruitless path CSC411 Artificial Intelligence

Admissibility, Monotonicity, and Informedness A best-first search algorithm guarantee to find a best path, if exists, if the algorithm is admissible A best-first search algorithm is admissible if its heuristic function h is monotone CSC411 Artificial Intelligence

Admissibility and Algorithm A* Insert def box page 146 CSC411 Artificial Intelligence

Monotonicity and Informedness Insert def box, pg 147 CSC411 Artificial Intelligence

Artificial Intelligence Comparison of state space searched using heuristic search with space searched by breadth-first search. The proportion of the graph searched heuristically is shaded. The optimal search selection is in bold. Heuristic used is f(n) = g(n) + h(n) where h(n) is tiles out of place. CSC411 Artificial Intelligence

Artificial Intelligence Minimax Procedure Games Two players attempting to win Two opponents are referred to as MAX and MIN A variant of game nim A number of tokens on a table between the 2 opponents Each player divides a pile of tokens into two nonempty piles of different sizes The player who cannot make division losses CSC411 Artificial Intelligence

Artificial Intelligence Exhaustive Search State space for a variant of nim. Each state partitions the seven matches into one or more piles CSC411 Artificial Intelligence

Artificial Intelligence Maxmin Search Principles MAX tries to win by maximizing her score, moves to a state that is best for MAX MIN, the opponent, tries to minimize the MAX’s score, moves to a state that is worst for MAX Both share the same information MIN moves first The terminating state that MAX wins is scored 1, otherwise 0 Other states are valued by propagating the value of terminating states Value propagating rules If the parent state is a MAX node, it is given the maximum value among its children If the parent state is a MIN state, it is given the minimum value of its children CSC411 Artificial Intelligence

Artificial Intelligence Exhaustive minimax for the game of nim. Bold lines indicate forced win for MAX. Each node is marked with its derived value (0 or 1) under minimax. Insert fig 4.20 CSC411 Artificial Intelligence

Minmaxing to Fixed Ply Depth If cannot expand the state space to terminating (leaf) nodes (explosive), can use the fixed ply depth Search to a predefined number, n, of levels from the starting state, n-ply look-ahead The problem is how to value the nodes at the predefined level – heuristics Propagating values is similar Maximum children for MAX nodes Minimum children for MIN nodes CSC411 Artificial Intelligence

Artificial Intelligence Minimax to a hypothetical state space. Leaf states show heuristic values; internal states show backed-up values. Insert fig 4.21 CSC411 Artificial Intelligence

Artificial Intelligence Heuristic measuring conflict applied to states of tic-tac-toe CSC411 Artificial Intelligence

Artificial Intelligence Two-ply minimax applied to the opening move of tic-tac-toe CSC411 Artificial Intelligence

Artificial Intelligence Two ply minimax, and one of two possible MAX second moves CSC411 Artificial Intelligence

Artificial Intelligence Two-ply minimax applied to X’s move near the end of the game CSC411 Artificial Intelligence

Artificial Intelligence Alpha-Beta Procedure Alpha-beta pruning to improve search efficiency Proceeds in a depth-first fashion and creates two values alpha and beta during the search Alpha associated with MAX nodes, and never decreases Beta associated with MIN nodes, never increases To begin, descend to full ply depth in a depth-first search, and apply heuristic evaluation to a state and all its siblings. The value propagation is the same as minimax procedure Next, descend to other grandchildren and terminate exploration if any of their values is >= this beta value Terminating criteria Below any MIN node having beta <= alpha of any of its MAX ancestors Below any MAX node having alpha >= beta of any of its MIN ancestors CSC411 Artificial Intelligence

Artificial Intelligence Alpha-beta pruning applied. States without numbers are not evaluated. CSC411 Artificial Intelligence