Heuristic Search Russell and Norvig: Chapter 4 Slides adapted from:

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Chapter 4: Informed Heuristic Search
Heuristic Search The search techniques we have seen so far...
Informed Search CS 171/271 (Chapter 4)
Heuristic Functions By Peter Lane
Informed search algorithms
CS B551: E LEMENT SOF A RTIFICIAL I NTELLIGENCE Instructor: Kris Hauser 1.
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.
Lecture 4: Informed/Heuristic Search
Informed search strategies
Informed Search Problems
Informed search algorithms
An Introduction to Artificial Intelligence
The A* Algorithm Héctor Muñoz-Avila. The Search Problem Starting from a node n find the shortest path to a goal node g ?
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.
Heuristic Search Jim Little UBC CS 322 – Search 4 September 17, 2014 Textbook §
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.
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*
Blind Search by Prof. Jean-Claude Latombe
Review: Search problem formulation
CSC344: AI for Games Lecture 4: Informed search
Heuristic (Informed) Search (Where we try to be smarter in how we choose among alternatives) R&N III: Chapter 3.5 R&N II: Chap. 4, Sect. 4.1–3.
Russell and Norvig: Chapter 4 CSMSC 421 – Fall 2005
Informed Search Idea: be smart about what paths to try.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
1 Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap. 4, Sect. 4.1–3.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
State space representations and search strategies - 2 Spring 2007, Juris Vīksna.
Heuristic Search Foundations of Artificial Intelligence.
Heuristic Functions. A Heuristic is a function that, when applied to a state, returns a number that is an estimate of the merit of the state, with respect.
Blind Search Russell and Norvig: Chapter 3, Sections 3.4 – 3.6 CS121 – Winter 2003.
For Monday Read chapter 4 exercise 1 No homework.
Romania. Romania Problem Initial state: Arad Goal state: Bucharest Operators: From any node, you can visit any connected node. Operator cost, the.
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.
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Heuristic Functions.
Department of Computer Science
Informed Search and Exploration
Artificial Intelligence Problem solving by searching CSC 361
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
The A* Algorithm Héctor Muñoz-Avila.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
Artificial Intelligence Informed Search Algorithms
EA C461 – Artificial Intelligence
Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
Informed Search.
Presentation transcript:

Heuristic Search Russell and Norvig: Chapter 4 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm

Heuristic Search Blind search totally ignores where the goals are. A heuristic function that gives us an estimate of how far we are from a goal. Example: How do we use heuristics?

Heuristic Function Function h(N) that estimate the cost of the cheapest path from node N to goal node. Example: 8-puzzle 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 h(N) = number of misplaced tiles = 6 goal N

Heuristic Function Function h(N) that estimate the cost of the cheapest path from node N to goal node. Example: 8-puzzle 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 h(N) = sum of the distances of every tile to its goal position = 2 + 3 + 0 + 1 + 3 + 0 + 3 + 1 = 13 goal N

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 the fringe in increasing values of h(N)

Robot Navigation

Robot Navigation f(N) = h(N), with h(N) = Manhattan distance to the goal 2 1 5 8 7 3 4 6

Robot Navigation f(N) = h(N), with h(N) = Manhattan distance to the goal 8 7 6 5 4 3 2 3 4 5 6 7 5 4 3 5 6 3 2 1 1 2 4 7 7 6 5 8 7 6 5 4 3 2 3 4 5 6

Properties of the Greedy Best-First Search If the state space is finite and we avoid repeated states, the best-first search is complete, but in general is not optimal If the state space is finite and we do not avoid repeated states, the search is in general not complete If the state space is infinite, the search is in general not complete

Admissible heuristic Let h*(N) be the cost of the optimal path from N to a goal node Heuristic h(N) is admissible if: 0  h(N)  h*(N) An admissible heuristic is always optimistic

8-Puzzle 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 N goal h1(N) = number of misplaced tiles = 6 is admissible h2(N) = sum of distances of each tile to goal = 13 is admissible h3(N) = (sum of distances of each tile to goal) + 3 x (sum of score functions for each tile) = 49 is not admissible

A* Search A* search combines Uniform-cost and Greedy Best-first Search Evaluation function: f(N) = g(N) + h(N) where: g(N) is the cost of the best path found so far to N h(N) is an admissible heuristic f(N) is the estimated cost of cheapest solution THROUGH N 0 <   c(N,N’) (no negative cost steps). Order the nodes in the fringe in increasing values of f(N)

Completeness & Optimality of A* Claim 1: If there is a path from the initial to a goal node, A* (with no removal of repeated states) terminates by finding the best path, hence is: complete optimal

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles goal 3+3 3+4 1+5 1+3 2+3 2+4 5+2 5+0 0+4 3+4 3+2 4+1 goal

Robot Navigation f(N) = g(N)+h(N), with h(N) = Manhattan distance to goal 7+2 8+3 2 1 5 8 7 3 4 6 8+3 7+4 7+4 6+5 5+6 6+3 4+7 5+6 3+8 4+7 3+8 2+9 2+9 3+10 7+2 6+1 2+9 3+8 6+1 8+1 7+0 2+9 1+10 1+10 0+11 7+0 7+2 6+1 8+1 7+2 6+3 6+3 5+4 5+4 4+5 4+5 3+6 3+6 2+7 2+7 3+8

Robot navigation f(N) = g(N) + h(N), with h(N) = straight-line distance from N to goal Cost of one horizontal/vertical step = 1 Cost of one diagonal step = 2

Consistent Heuristic The admissible heuristic h is consistent (or satisfies the monotone restriction) if for every node N and every successor N’ of N: h(N)  c(N,N’) + h(N’) (triangular inequality) N N’ h(N) h(N’) c(N,N’)

8-Puzzle 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 N goal h1(N) = number of misplaced tiles h2(N) = sum of distances of each tile to goal are both consistent

Claims If h is consistent, then the function f along any path is non-decreasing: f(N) = g(N) + h(N) f(N’) = g(N) +c(N,N’) + h(N’) h(N)  c(N,N’) + h(N’) f(N)  f(N’) If h is consistent, then whenever A* expands a node it has already found an optimal path to the state associated with this node N N’ h(N) h(N’) c(N,N’)

Avoiding Repeated States in A* If the heuristic h is consistent, then: Let CLOSED be the list of states associated with expanded nodes When a new node N is generated: If its state is in CLOSED, then discard N If it has the same state as another node in the fringe, then discard the node with the largest f

Complexity of Consistent A* Let s be the size of the state space Let r be the maximal number of states that can be attained in one step from any state Assume that the time needed to test if a state is in CLOSED is O(1) The time complexity of A* is O(s r log s)

Heuristic Accuracy h(N) = 0 for all nodes is admissible and consistent. Hence, breadth-first and uniform-cost are particular A* !!! Let h1 and h2 be two admissible and consistent heuristics such that for all nodes N: h1(N)  h2(N). Then, every node expanded by A* using h2 is also expanded by A* using h1. h2 is more informed than h1 h2 dominates h1 Which heuristic for 8-puzzle is better?

Iterative Deepening A* (IDA*) Use f(N) = g(N) + h(N) with admissible and consistent h Each iteration is depth-first with cutoff on the value of f of expanded nodes

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 Cutoff=4

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 4 6 Cutoff=4

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 4 5 6 Cutoff=4

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 5 4 6 4 5 6 Cutoff=4

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 6 5 4 6 4 5 6 Cutoff=4

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 Cutoff=5

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 4 6 Cutoff=5

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 4 5 6 Cutoff=5

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 6 4 5 6 Cutoff=5 7

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 5 4 6 5 6 7 Cutoff=5

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 5 5 6 4 5 6 7 Cutoff=5

8-Puzzle f(N) = g(N) + h(N) with h(N) = number of misplaced tiles 4 5 5 6 4 5 6 7 Cutoff=5

About Heuristics Heuristics are intended to orient the search along promising paths The time spent computing heuristics must be recovered by a better search After all, a heuristic function could consist of solving the problem; then it would perfectly guide the search Deciding which node to expand is sometimes called meta-reasoning Heuristics may not always look like numbers and may involve large amount of knowledge

When to Use Search Techniques? The search space is small, and There is no other available techniques, or It is not worth the effort to develop a more efficient technique The search space is large, and There is no other available techniques, and There exist “good” heuristics

Summary Heuristic function Greedy Best-first search Admissible heuristic and A* A* is complete and optimal Consistent heuristic and repeated states Heuristic accuracy IDA*