Introduction to Artificial Intelligence
By:
Dr. Mohammad Shoab
Week 4
Informed search
Introduction to Artificial Intelligence
Department of Computer Science
Heuristic function
Start state
Goal state
Introduction to Artificial Intelligence
Department of Computer Science
Heuristic for the Romania problem
Introduction to Artificial Intelligence
Department of Computer Science
Greedy best-first search
Introduction to Artificial Intelligence
Department of Computer Science
Greedy best-first search example
Introduction to Artificial Intelligence
Department of Computer Science
Greedy best-first search example
Introduction to Artificial Intelligence
Department of Computer Science
Greedy best-first search example
Introduction to Artificial Intelligence
Department of Computer Science
Greedy best-first search example
Introduction to Artificial Intelligence
Department of Computer Science
Properties of greedy best-first search
No – can get stuck in loops
start
goal
Introduction to Artificial Intelligence
Department of Computer Science
Properties of greedy best-first search
No – can get stuck in loops
No
Introduction to Artificial Intelligence
Department of Computer Science
Properties of greedy best-first search
No – can get stuck in loops
No
Worst case: O(bm)
Best case: O(bd) – If h(n) is 100% accurate
Worst case: O(bm)
Introduction to Artificial Intelligence
Department of Computer Science
A* search
f(n) = g(n) + h(n)�
g(n): cost so far to reach n (path cost)
h(n): estimated cost from n to goal (heuristic)
Introduction to Artificial Intelligence
Department of Computer Science
A* search example
Introduction to Artificial Intelligence
Department of Computer Science
A* search example
Introduction to Artificial Intelligence
Department of Computer Science
A* search example
Introduction to Artificial Intelligence
Department of Computer Science
A* search example
Introduction to Artificial Intelligence
Department of Computer Science
A* search example
Introduction to Artificial Intelligence
Department of Computer Science
A* search example
Introduction to Artificial Intelligence
Department of Computer Science
Another example
Introduction to Artificial Intelligence
Department of Computer Science
Admissible heuristics
Introduction to Artificial Intelligence
Department of Computer Science
Optimality of A*
n
n*
f(n*) = C*
f(n) > C*
n'
g(n') ≥ f(n) > C*
Introduction to Artificial Intelligence
Department of Computer Science
Optimality of A*
Introduction to Artificial Intelligence
Department of Computer Science
Properties of A*
Yes – unless there are infinitely many nodes with f(n) ≤ C*
Yes
Number of nodes for which f(n) ≤ C* (exponential)
Exponential
Introduction to Artificial Intelligence
Department of Computer Science
Designing heuristic functions
h1(n) = number of misplaced tiles
h2(n) = total Manhattan distance (number of squares from desired location of each tile)�
�
h1(start) = 8
h2(start) = 3+1+2+2+2+3+3+2 = 18
Introduction to Artificial Intelligence
Department of Computer Science
Heuristics from relaxed problems
Introduction to Artificial Intelligence
Department of Computer Science
Heuristics from subproblems
Introduction to Artificial Intelligence
Department of Computer Science
Dominance
Introduction to Artificial Intelligence
Department of Computer Science
Dominance
Introduction to Artificial Intelligence
Department of Computer Science
Combining heuristics
h(n) = max{h1(n), h2(n), …, hm(n)}
Introduction to Artificial Intelligence
Department of Computer Science
Weighted A* search
Introduction to Artificial Intelligence
Department of Computer Science
Example of weighted A* search
Heuristic: 5 * Euclidean distance from goal
Introduction to Artificial Intelligence
Department of Computer Science
Example of weighted A* search
Heuristic: 5 * Euclidean distance �from goal
Compare: Exact A*
Introduction to Artificial Intelligence
Department of Computer Science
Memory-bounded search
Introduction to Artificial Intelligence
Department of Computer Science
The End
35
Introduction to Artificial Intelligence
Department of Computer Science
Exercise
Q1. What is informed search?
Q2. What is heuristic function?
Q3. Explain properties of greedy best first search.
Q4. Explain A* search.
Q5. What are admissible heuristics?
Q6. Explain memory bound search.
36
Introduction to Artificial Intelligence
Department of Computer Science
Q7. Which search use an evaluation function to rank nodes and select the most promising one for expansion?
Q8. Which search algorithm expand the node that has the lowest value of the heuristic function h(n)?
37
Introduction to Artificial Intelligence
Department of Computer Science
Q9. Which search algorithm avoid expanding paths that are already expensive?
Q10. Which search algorithm speed up search at the expense of optimality?
38
Introduction to Artificial Intelligence
Department of Computer Science