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.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Informed search algorithms
Heuristic Search Russell and Norvig: Chapter 4 Slides adapted from:
Chapter 4: Informed Heuristic Search
Heuristic Search The search techniques we have seen so far...
Informed search algorithms
Review: Search problem formulation
Heuristic Search. Best First Search A* Heuristic Search Heuristic search exploits additional knowledge about the problem that helps direct search to.
Informed Search Algorithms
Notes Dijstra’s Algorithm Corrected syllabus.
Informed search strategies
Informed search algorithms
An Introduction to Artificial Intelligence
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2004.
Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in “as the crow.
Solving Problem by Searching
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Informed Search Idea: be smart about what paths to try.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
1 Shanghai Jiao Tong University Informed Search and Exploration.
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 strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
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.
Lecture 3: Uninformed Search
CSC3203: AI for Games Informed search (1) Patrick Olivier
Informed Search Reading: Chapter 4.5 HW #1 out today, due Sept 26th.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
G5AIAI Introduction to AI Graham Kendall Heuristic Searches.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
For Monday Read chapter 4 exercise 1 No homework.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Review: Tree search Initialize the frontier using the starting state
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Last time: Problem-Solving
Heuristic Search Introduction to Artificial Intelligence
Artificial Intelligence Problem solving by searching CSC 361
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
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.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
EA C461 – Artificial Intelligence
Informed search algorithms
HW 1: Warmup Missionaries and Cannibals
More advanced aspects of search
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Informed Search Idea: be smart about what paths to try.
Informed Search.
Presentation transcript:

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 solution

Greedy Best-First Search Path search(start, operators, is_goal) { fringe = makeList(start); while (state=fringe.popFirst()) { if (is_goal(state)) return pathTo(state); S = successors(state, operators); fringe = insert (S, fringe); } return NULL; } Order the nodes in increasing values of h(N)

Procedure Best-First Search begin open  [Start] closed  [ ] while open  [ ] do begin remove leftmost state from open and call it X if X is a goal then return the path from Start to X else begin generate children of X for each child of X do begin switch case the child is not on open or closed  assign the child a heuristic value and add the child to open case the child is already on open  if the child was reached by a shorter path then give the state on open the shorter path case the child is already on closed  if the child was reached by a shorter path then remove the state from closed and add the child to open put X on closed re-order states on open by heuristic merit (best leftmost) end return failure end

Example A-5 B-4 C-4 D-6 E-5 F-5 G-4 H-3 1.Open = [A5];closed = [] 2.Evl A5; open=[B4,C4,D6];closed=[A5] 3.Eval B4;open=[C4,E5,F5,D6]; closed=[B4,A5] 4.Eval C4; open = [H3,G4,E5,F5,D6] ; closed=[C4,B4,A5]

A search algorithm is admissible if it is guaranteed to find a minimal path to a solution whenever such a path exist. f*(n) = g*(n) + h*(n)  g*(n) is the cost of the shortest path from the start node to n.  h*(n) is the actual cost of the shortest path n to the goal.  Then f*(n) is the actual cost of the optimal path from a start node to a goal node that passes through node n.

f* does not exist. Algorithm A –Use f(n) = g(n) + h(n) and best-first-search algorithm Algorithm A* –If h(n)  h*(n) in the algorithm A then it is called Algorithm A* Theorem: All A* algorithms are admissible

Implementing Heuristic Evaluations For 8-puzzle, two heuristics are … –Counts the tiles out of place in each state when it is compared with the goal. –Sum all the distances by which the tiles are out of place, one for each square a tile must be moved to reach its position in the goal state left

Example h 1(S)=7 h 2(S)= =14

Comparison of Heuristics applied to states in the 8-puzzle Tile out of place Sum of distances out of place h1 h2

Admissible Heuristic

A* Search Greedy best-first search is too greedy –It does not take into account the cost of the path so far! Define –f(n)=g(n)+h(n) –g(n) is the cost of the path to node n –h(n) is the heuristic estimate of the cost of reaching the goal from node n A* search –Expand node in fringe (queue) with lowest f value

left

A* Another Example

A*

A* Search Complete : Yes Time Complexity: Exponential - Depends on h(n) Space Complexity: Exponential - Keeps all nodes in memory Optimal: Yes. If h(n) is an admissible heuristic Optimally efficient

How fast is A*? A* is the fastest search algorithm. That is, for any given heuristic, no algorithm can expand fewer nodes than A*. How fast is it? Depends of the quality of the heuristic. [(relative error in h) x (length of solution)] Exponential time complexity in worst case. A good heuristic will help a lot here O(bm) if the heuristic is perfect If the heuristic is useless (ie h(n) is hardcoded to equal 0 ), the algorithm degenerates to uniform cost. If the heuristic is perfect, there is no real search, we just march down the tree to the goal. Generally we are somewhere in between the two situations above. The time taken depends on the quality of the heuristic.

Dominance Given two admissible heuristics h1(n) and h2(n), which is better? If h2(n)  h1(n) for all n, then –h2 is said to dominate h1 –h2 is better for search For our 8-puzzle heuristic, does h2 dominate h1?

A*’s space complexity Main problem: space complexity A* has worst case O(b d ) space complexity, but an iterative deepening version is possible ( IDA* )