Chapter 4
Chapter 4
ARTIFICIAL
INTELLIGENCE
◤
CHAPTER 4
INFORMED
SEARCH
2
◤
OUTLINE
✔ Introduction
✔ Heuristic Search
✔ Greedy Search
✔ A* Search
✔ Memory Bounded Heuristic
Search
▪ Recursive Best First Search
▪ Simple Memory Bounded A*
✔ Dominance
✔ Relaxed Problems
3
◤
INTRODUCTION
Travel Salesperson Problem
Given a list of cities and their pair wise distances, the task is to find
a shortest possible tour that visits each city exactly once.
▪ Do you think this idea is useful: (At each stage visit the unvisited city
nearest to the current city)?
4
◤
HEURISTIC SEARCH ALGORITHM
5
◤
BEST-FIRST SEARCH
Idea: Use an evaluation function f(n) for each node
▪ family of search methods with various evaluation functions (estimate of "desirability“)
▪ A heuristic function ranks alternatives at each branching step based on the available
information (heuristically) in order to make a decision about which branch to follow during a
search.
Implementation:
▪ Order the nodes in fringe in decreasing order of desirability.
Special cases:
▪ A* search
6
◤
BEST-FIRST SEARCH ALGORITHM
1. Initialize: Set OPEN= {Si}, CLOSED = { }, g(s) = 0, f(s) = h(s)
6. Loop: Go to Step 2
7
◤
ROMANIA WITH STEP COSTS IN KM
◤
GREEDY BEST-FIRST SEARCH
◤
GREEDY BEST-FIRST SEARCH EXAMPLE
11
◤
GREEDY BEST-FIRST SEARCH EXAMPLE
12
◤
GREEDY BEST-FIRST SEARCH EXAMPLE
13
◤
GREEDY BEST-FIRST SEARCH EXAMPLE
14
◤
15
◤
GREEDY BEST-FIRST SEARCH
PROPERTIES
▪ Optimal: No
b: branching factor
m: maximum depth of the search tree
16
◤
DISCUSSION
A*search
17
A* SEARCH
◤
18
◤
A* SEARCH
Idea: avoid expanding paths that are already expensive.
◤
A* SEARCH EXAMPLE
20
◤
A* SEARCH EXAMPLE
21
◤
A* SEARCH EXAMPLE
22
◤
A* SEARCH EXAMPLE
23
◤
A* SEARCH EXAMPLE
24
◤
A* SEARCH EXAMPLE
25
◤
A* SEARCH ALGORITHM
1. Initialize: Set OPEN= {Si}, CLOSED = { }, g(s) = 0, f(s) = h(s)
◤
A* SEARCH EXERCISE
NODE SL DISTANCE
A 8.0
B 7.3
C 7.6
D 6
E 5.4
F 4.1
G 4.1
H 2.8
I 2.0
J 2.2
27
◤
A* SEARCH EXERCISE
28
◤
GREEDY BEST-FIRST SEARCH
EXERCISE
NODE SL DISTANCE
A 8.0
B 7.3
C 7.6
D 6
E 5.4
F 4.1
G 4.1
H 2.8
I 2.0
J 2.2
29
◤
GREEDY BEST-FIRST SEARCH
EXERCISE
30
◤
EXERCISE
NOD SL DISTANCE
E
A 8.0
B 6.3
C 6.3
D 5.0
E 4.0
F 5.1
G 5.0
H 4.5
I 2.8
J 2.2
K 3.6
31
◤
ADMISSIBLE HEURISTICS
◤
PROOF OF A* OPTIMALITY
▪ Recall that f(n) = g(n) + h(n)
▪ We want to prove:
◤
PROOF OF A* OPTIMALITY (CONT’D)
In other words:
◤
CONSISTENT HEURISTICS
A heuristic is consistent if for every node n, every successor n’ of
n
generated by any action:
h(n) ≤ c(n,n') + h(n’)
If h is consistent, we have:
▪ f(n') = g(n') + h(n’)
◤
OPTIMALITY OF A*
◤
COMPLEXITY OF A*
◤
PROPERTIES OF A*
▪ Complete? Yes (unless there are infinitely many nodes with f ≤ f(G) )
▪ Time? Exponential
▪ Because all nodes such that f(n) <= C* are expanded!
◤
MEMORY BOUNDED HEURISTIC
SEARCH
▪ Idea: Try something like iterative deeping search, but the cutoff
is f-cost (g+h) at each iteration, rather than depth first.
▪ Recursive BFS
▪ SMA*
39
◤
RECURSIVE BEST FIRST SEARCH (RBFS)
best alternative over
fringe nodes,
which are not children:
do I want to back up?
◤
PROPERTIES OF RECURSIVE BEST
FIRST SEARCH
▪ Space? b*d
◤
SIMPLE MEMORY BOUNDED A* (SMA*)
◤
SIMPLE MEMORY BOUNDED A* (SMA*)
▪ How it works:
▪ Drops the worst leaf node-the one with the highest f-value.
▪ Like RBFS, SMA* then backs up the value of the forgotten node to
its parent.
43
◤
SIMPLE MEMORY-BOUNDED A* (SMA*)
Example with 3-node memory
44
◤
SMA* ALGORITHM
45
◤
PROPERTIES OF SMA*
▪ It works with a heuristic, just as A*
▪ Enlarging the memory bound of the algorithm will only speed up the
calculation
▪ When enough memory is available to contain the entire search tree, then
calculation has an optimal speed
46
◤
ADMISSIBLE HEURISTICS
▪ Ex., for the 8-puzzle:
▪ h1(S) = 8
▪ h2(S) = 3+1+2+2+2+3+3+2 = 18
47
◤
DOMINANCE
◤
RELAXED PROBLEMS
▪ If the rules of the 8-puzzle are relaxed so that a tile can move
anywhere, then h1(n) gives the shortest solution
▪ If the rules are relaxed so that a tile can move to any near
square, then h2(n) gives the shortest solution