Ch4 Heuristic Search Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Heuristic Search techniques
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.
State Space 3 Chapter 4 Heuristic Search. Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state.
Using Heuristics in Games At that time two opposing concepts of the game called forth commentary and discussion. The foremost players distinguished two.
Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Part2 AI as Representation and Search
Artificial Intelligence
Chapter 4 Search Methodologies.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Heuristic search, page 1 CSI 4106, Winter 2005 Heuristic search Points Definitions Best-first search Hill climbing Problems with hill climbing An example:
Best-First Search: Agendas
Mahgul Gulzai Moomal Umer Rabail Hafeez
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
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)
Find a Path s A D B E C F G Heuristically Informed Methods  Which node do I expand next?  What information can I use to guide this.
Problem Solving and Search in AI Heuristic Search
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.
CISC 235: Topic 6 Game Trees.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
KU NLP Heuristic Search Heuristic Search and Expert Systems (1) q An interesting approach to implementing heuristics is the use of confidence.
Game Playing.
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.
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
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.
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.
Outline Intro to Representation and Heuristic Search Machine Learning (Clustering) and My Research.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Knowledge Search CPTR 314.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Game tree search Chapter 6 (6.1 to 6.3 and 6.6) cover games. 6.6 covers state of the art game players in particular. 6.5 covers games that involve uncertainty.
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.
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)
February 18, 2016Introduction to Artificial Intelligence Lecture 8: Search in State Spaces III 1 A General Backtracking Algorithm Sanity check function.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
PART-2 CSC 450-AI by Asma Tabuk 1 CSC AI Informed Search Algorithms College of Computer and Information Technology Department of Computer.
Search CSC 358/ Outline Homework #6 Game search States and operators Issues Search techniques DFS, BFS Beam search A* search Alpha-beta.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Dept. Computer Science, Korea Univ. Intelligent Information System Lab A I (Artificial Intelligence) Professor I. J. Chung.
Last time: search strategies
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.
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
A General Backtracking Algorithm
Unit II Game Playing.
Presentation transcript:

Ch4 Heuristic Search Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011

Introduction George Polya defines heuristic as: “the study of the methods and rules of discovery and invention” This meaning can be traced to the term’s Greek root, the verb eurisco, which means “I discover” When Archimedes emerged from his famous bath clutching the golden crown, he shouted “Eureka!!”, meaning I have found it IN AI, heuristics are formalized as Rules for choosing those branches in a state space that are most likely to lead to an acceptable problem solution

Introduction AI problem solvers employ heuristics in two basic situations: A problem may not have an exact solution because of inherent ambiguities in the problem statement or available data A problem may have an exact solution, but the computational cost of finding it may be prohibitive For example…

Introduction A problem may not have an exact solution because of inherent ambiguities in the problem statement or available data Medical diagnosis. Doctors use heuristic to choose the most likely diagnosis based on patient’s symptoms and description Vision. Vision systems often use heuristics to select the most likely of several possible interpretations of a scene

Introduction A problem may have an exact solution, but the computational cost of finding it may be prohibitive When brute force search techniques (BFS, DFS) may fail to find a solution within a reasonable amount of time

Introduction Unfortunately, like all rules of discovery and invention, heuristic are fallible A heuristic is only an informed guess of the next step to take A heuristic can lead a search to a suboptimal solution or fail to find any solution at all, because heuristic use limited information of the present situation

Introduction Consider heuristic in the game of tic-tac-toe A simple analysis put the total number of states for 9! Symmetry reduction decrease the search space Thus, there are not 9 but 3 initial moves: to a corner to the center of a side to the center of the grid

Introduction

Use of symmetry on the second level further reduces the number of path to 3* 12 * 7! A simple heuristic, can almost eliminate search entirely: we may move to the state in which X has the most winning opportunity In this case, X takes the center of the grid as the first step

Introduction

The following topics in Heuristic includes: Hill-Climbing and Dynamic Programming Best-first-search Using heuristic in Games

Hill-Climbing Te simplest way to implement heuristic search is through a procedure called hill- climbing It expend the current state of the search and evaluate its children The Best child is selected for further expansion Neither it sibling nor its parent are retained Tic-Tac-Toe we just saw is an example

Hill-Climbing Because it keeps no history, the algorithm cannot recover from failures of its strategy A major problem of hill-climbing is their tendency to become stuck at local maxima

Hill-Climbing Hill Climbing is named for the strategy that might be used by an eager, but blind mountain climber: Go uphill along the closest-to-the-top path until you can go no further up

Hill-Climbing

An example of local maximum in games occurs in the 8-puzzle. Often, in order to move a particular tile to its destination, other tiles already in their position need to move out This is a necessary step but temporarily worsens the board state Thus, hill climbing is not useful to the 8- puzzle game

Dynamic Programming (DP) DP keeps track of and reuses of multiple interacting and interrelated subproblems An example might be reuse the subseries solutions within the solution of the Fibonacci series The technique of subproblem caching for reuse is sometimes called memorizing partial subgoal solutions

Dynamic Programming (DP) One of the most famous current application in DP is “sequence alignment” Suppose we want to find the best possible alignment for the characters in the strings BAADDCABDDA BBADCBA

Dynamic Programming (DP) One optimal alignment, among several possible, would be: BAADDCABDDA BBA_DC_B_ _A

Dynamic Programming (DP) DP requires a data structure to keep track of the subproblem related to the state currently being processed BAADDCABDDA BBADCBA

Dynamic Programming (DP) The array reflects the global alignment success to that point in the matching process There are 3 possible costs for creating the current state: Cost is 0 when characters are identical Cost is 1 when a character is shifted or inserted Cost is 2 when a character is shifted and inserted

Dynamic Programming (DP) Start with a simple example BCA BA We know the answer is BCA B_A

Dynamic Programming (DP) The function is try to find the minimum of (x-1,y),(x,y-1),(x-1,y-1) for (x,y) If there’s a match for (x,y), add 0 to (x-1,y-1) If there’s no match for (x,y), add 1 to (x- 1,y),(x,y-1), as well as add 2 to (x-1,y-1)

Dynamic Programming (DP) _BCA _0123 B1 012 A2 121

Once the array is filled, we begin the backward stage of the algorithm that produces particular solutions We select where the match came from

Dynamic Programming (DP) _BCA _ B A _ B C A _ B _ A

Dynamic Programming (DP) _BAADDCABDDA _ B B A D C B A

Dynamic Programming (DP) BAADDCABDDA BBA_DC_B_ _A

Dynamic Programming (DP) _ GAATTCAGTTA _ G G A T C G A

Dynamic Programming (DP) G A A T T C A G T T A G G A _ T C _ G _ _ A

Introduction The following topics in Heuristic includes: Hill-climbing and dynamic programming Best-first-search Using heuristic in Games

Best First Search For the 8-puzzle game, we may add 3 different types of information into the code: The simplest heuristic counts the tiles out of space in each state A “better” heuristic would sum all the distances by which the tiles are out of space

Best First Search Both of these heuristics can be criticized for failing to acknowledge the difficulty of tile reversals That is, if two tiles are next to each other and the goal requires their being in opposite locations, it takes several moves to put them back

Best First Search

In previous figure, the sum of distance heuristics does provide a much accurate estimate of the work This example illustrates the difficulty of devising good heuristics The design of good heuristic is an empirical problem; judgment and intuition help, but the final measure of a heuristic must be its actual performance

Best First Search If two states have the same or nearly the same heuristic evaluation, it is generally preferable to examine the state that is nearest to the root So that we may obtain the shortest path to the goal

Best First Search For 8-puzzle problem, let’s make our evaluation function f to be : f(n) = g(n) + h(n) g(n) means the actual length of path from n to the root h(n) is a heuristic estimate (sum of distance out of space) of the distance from state n to a goal

Best First Search

In step 3, both e and f have a heuristic of 5 State e is examined first, producing h and i Compare with all children, select the best move

Best First Search Compare with BFS & DFS:

Introduction The following topics in Heuristic includes: Hill-climbing and dynamic programming Best-first-search Using heuristic in Games

Minimax Procedure on Exhaustively Search Graphs Games have always been an important application area for heuristic algorithm Two person games are more complicated than simple puzzle because of the existence of a “hotile” and unpredictable opponent

Minimax Procedure on Exhaustively Search Graphs Let’s consider a variant of the game nim To play this game, a number of tokens are placed on a table between the two players At each move, the player must divide a pile of tokens into two nonempty piles of different sizes Thus, 6 tokens my be divided into piles of 5&1 or 4&2 but not 3&3 The first player who can no longer make a move loses the game

Minimax Procedure on Exhaustively Search Graphs Let’s have fun ^^ Now we play a game with 7 cards

Minimax Procedure on Exhaustively Search Graphs State space for a variant of nim. Each state partitions the seven matches into one or more piles.

Minimax Procedure on Exhaustively Search Graphs In playing games whose state space may be exhaustively delineated, the primary difficulty is in accounting for the actions of the opponent A simple way to handle this assumes that your opponent uses the same knowledge Minimax searches the games space under this assumption

Minimax Procedure on Exhaustively Search Graphs The opponents in a game are referred to as MIN and MAX MAX represents the player trying to win MIN is the opponent who attempts to minimize MAX’s score

Minimax Procedure on Exhaustively Search Graphs We label each level in the search space according to whose move it is at the point in the game Each leaf node is given a value of 1 or 0, depending on whether a win for MAX (1) or for MIN (0)

Minimax Procedure on Exhaustively Search Graphs

Minimax propagates these values up the graph through successive parent nodes according to the rule: If the parent is a MAX node, give it the maximum value among its children If the parent is a MIN node, give it the minimum value among its children

Minimax Procedure on Exhaustively Search Graphs

Because all of MIN’s possible first moves lead to nodes with a derived values of 1, the second player always can force the game to a win, regardless of MIN’s first move

Minimax to Fixed Ply Depth In applying minimax to more complicated games, it is seldom possible to expand the state space search graph out to the leaf node Instead, the state space is searched to a predefined number of levels This is called an n-ply look ahead

Minimax to Fixed Ply Depth As the leaves of this subgraph is not complete, it is not possible to give them win or loss Instead, each node is given a value according to some heuristic evaluation In chess, you may consider the number of pieces belonging to MAX and MIN A more sophisticated strategy might assign different values to each piece

Minimax to Fixed Ply Depth Minimax propagates these values up the graph through successive parent nodes according to the rule: If the parent is a MAX node, give it the maximum value among its children If the parent is a MIN node, give it the minimum value among its children

Minimax to Fixed Ply Depth