Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

CMSC 471 Fall 2002 Class #5-6 – Monday, September 16 / Wednesday, September 18.
Heuristic Searches. Feedback: Tutorial 1 Describing a state. Entire state space vs. incremental development. Elimination of children. Closed and the solution.
Heuristic Search techniques
CMSC 671 Fall 2005 Class #5 – Thursday, September 15.
Informed search algorithms
Ch 4. Heuristic Search 4.0 Introduction(Heuristic)
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
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.
Heuristic Search Chapter 3.
October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
Artificial Intelligence
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
Branch & Bound Algorithms
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
Chapter 4 Search Methodologies.
Search in AI.
Best-First Search: Agendas
Mahgul Gulzai Moomal Umer Rabail Hafeez
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2005.
Intelligent Agents What is the basic framework we use to construct intelligent programs?
Informed Search CSE 473 University of Washington.
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
State-Space Searches.
Brute Force Search Depth-first or Breadth-first search
Informed Search Methods
Informed Search Idea: be smart about what paths to try.
Informed Search Strategies
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Informed search algorithms
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
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.
Search exploring the consequences of possible actions.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
For Wednesday Read chapter 6, sections 1-3 Homework: –Chapter 4, exercise 1.
For Wednesday Read chapter 5, sections 1-4 Homework: –Chapter 3, exercise 23. Then do the exercise again, but use greedy heuristic search instead of A*
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Informed Search Reading: Chapter 4.5 HW #1 out today, due Sept 26th.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Knowledge Search CPTR 314.
Searching for Solutions
CSCI 4310 Lecture 4: Search 2 – Including A*. Book Winston Chapters 4,5,6.
For Monday Read chapter 4 exercise 1 No homework.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
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.
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
Heuristic search INT 404.
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
More on Search: A* and Optimization
Lecture 9 Administration Heuristic search, continued
Informed Search Idea: be smart about what paths to try.
State-Space Searches.
State-Space Searches.
State-Space Searches.
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function - function applied to a state in a search space to indicate a likelihood of success if that state is selected heuristic search methods are known as “weak methods” because of their generality and because they do not apply a great deal of knowledge the methods themselves are not domain or problem specific, only the heuristic function is problem specific Heuristic Search – given a search space, a current state and a goal state generate all successor states and evaluate each with our heuristic function select the move that yields the best heuristic value Here and in the accompanying notes, we examine various heuristic search algorithms heuristic functions can be generated for a number of problems like games, but what about a planning or diagnostic situation?

Example Heuristic Function Simple heuristic for 8-puzzle: add 1 point for each tile in the right location subtract 1 point for each tile in the wrong location Better heuristic for 8-puzzle subtract 1 point for each move to get a tile to the right location The first heuristic only takes into account the local tile position it doesn’t consider such factors as groups of tiles in proper position we might differentiate between the two types of heuristics as local vs global Goal: Current: Moves: 7 down (simple: -5, better: -8) 6 right (simple: -5, better: -8) 8 left (simple: -3, better: -7) 2 3 5 6 7 8 4 2 3 5 7 1 6 8

Example Heuristics: 8 Puzzle From the start state, which operator do we select (which state do we move into)? The first two heuristics would recommend the middle choice (in this case, we want the lowest heuristic value) while the third heuristic tells us nothing useful (at this point because too much of the puzzle is not yet solved)

Hill Climbing Visualize the search space as a 3-dimensional space a state is located at position <x, y> where these values represent the state’s variables, and its z value (height) is its heuristic worth this creates a topology where you want to reach the highest point in actuality, most problems have states that have more than just <x, y> values so in fact, hill climbing takes place in some n+1 dimensions where n is the number of variables that define the state and the last value is the heuristic value, again, indicated as height to solve a problem, pick a next state that moves you “uphill” Given an initial state perform the following until you reach a goal state or a deadend generate all successor states evaluate each state with the heuristic function move to the state that is highest This algorithm only tries to improve during each selection, but not find the best solution

Variations of Hill Climbing In simple hill climbing, generate and evaluate states until you find one with a higher value, then immediately move on to it In steepest ascent hill climbing, generate all successor states, evaluate them, and then move to the highest value available (as long as it is greater than the current value) in both of these, you can get stuck in a local maxima but not reach a global maxima Another idea is simulated annealing the idea is that early in the search, we haven’t invested much yet, so we can make some downhill moves in the 8 puzzle, we have to be willing to “mess up” part of the solution to move other tiles into better positions the heuristic worth of each state is multiplied by a probability and the probability becomes more stable as time goes on simulated annealing is actually applied to neural networks Note: we are skipping dynamic programming, a topic more appropriate for 464/564

Best-first search Below, after exploring A’s children, we select D. But E and F are not better than B, so next we select B, followed by G. One problem with hill climbing is that you are throwing out old states when you move uphill and yet some of those old states may wind up being better than a few uphill moves the best-first search algorithm uses two sets open nodes (those generated but not yet selected) closed nodes (already selected) start with Open containing the initial state while current <> goal and there are nodes left in Open do set current = best node* in Open and move current to Closed generate current’s successors add successors to Open if they are not already in Open or Closed Closed A (5) B (4) C (3) D (6) G (6) H (4) E (2) F (3) I (3) J (8) Open - this requires searching through the list of Open nodes, or using a priority queue Now, our possible choices are I, J, H, E and F

Best-First Search Algorithm

Best-first Search Example

Heuristic Search and Cost Consider in any search problem there are several different considerations regarding how good a solution is does it solve the problem adequately? how much time does it take to find the solution (computational cost)? how much effort does the solution take? (practical cost) notice that the second and third considerations may be the same, but not always It will often be the case that we want to factor in the length of the path of our search as part of our selection strategy we enhance our selection mechanism from finding the highest heuristic value to finding the best value f(n) = g(n) + h(n) f(n) – cost of selecting state n g(n) – cost of reaching state n from the start state h(n) – heuristic value for state n if we use this revised selection mechanism in our best-first search algorithm, it is called the the A Algorithm Since we want to minimize f(n), we will change our heuristic functions to give smaller values for better states some of our previous functions gave higher scores for better states

Example: 8 Puzzle Redux

Other Factors in Heuristic Search Admissibility if the search algorithm is guaranteed to find a minimal path solution (if one exists) – that is, minimize practical cost, not search cost a breadth-first search will find one if our A Algorithm guarantees admissibility, it is known as an A* Algorithm with the selection formula f*(n) = g*(n) + h*(n) where g*(n) is the shortest path to reach n and h*(n) is the cost of finding a solution from n h(n) is an estimated cost derived by a heuristic function, h*(n) may not be possible, it requires an oracle Informedness a way to compare two or more heuristics – if one heuristic always gives you a more accurate prediction in the A* algorithm, then that heuristic is more informed Monotonicity – we will skip this there are other search strategies covered in the notes accompanying this chapter

Constraint Satisfaction Many branches of a search space can be ruled out by applying constraints Constraint satisfaction is a form of best-first search where constraints are applied to eliminate branches consider the Cryptorithmetic problem, we can rule out several possibilities for some of the letters After making a decision, propagate any new constraints that come into existence constraint Satisfaction can also be applied to planning where a certain partial plan may exceed specified constraints and so can be eliminated SEND + MORE MONEY M = 1  S = 8 or 9  O = 0 or 1  O = 0 … N = E + 1 (since N != E) Now we might try an exhaustive search from here