Informed Search Strategies
Informed Search Strategies
Informed Search Strategies
Module 3
Informed (Heuristic) Search
Idea: be smart
about what paths
to try.
2
Blind Search vs. Informed Search
Heuristic search
• Explore the node which is more likely to lead to the goal state
3
Heuristics
• Heuristic technique is a criterion for determining which among
several alternatives will be the most effective to achieve some
goal
5
Best-First Search
Combines the advantages of both DFS and BFS into a
single method.
DFS is good because it allows a solution to be found
without all competing branches having to be expanded.
BFS is good because it does not get branches on dead end
paths.
One way of combining the two is to follow a single path
at a time, but switch paths whenever some competing
path looks more promising than the current one does.
6
Best-First Search
At each step of the BFS search process, we select the
most promising of the nodes we have generated so far.
This is done by applying an appropriate heuristic
function to each of them.
7
Best-First Search
• Use an evaluation function f(n) for node n.
• Always choose the node from fringe that has
the lowest f value.
3 5 1
4 6
8
Best-first search
• A search strategy is defined by picking the order of node
expansion
• Idea: use an evaluation function f(n) for each node
– estimate of "desirability“
• Implementation:
Order the nodes in fringe in decreasing order of desirability
• Special cases:
– greedy best-first search
– A* search
Greedy best-first search
• Evaluation function f(n) = h(n) (heuristic)
= estimate of cost from n to goal
• hSLD is correlated with actual road distances and is, therefore, a useful
heuristic
Greedy best-first search- Route finding
problem in Romania
Greedy best-first search- Route finding
problem in Romania
Greedy Best-First Search - Backtrack
A A A
B C D B C D
3 5 1 3 5
E F
4 6
A A
B C D B C D
5 5
G H E F G H E F
6 5 4 6 6 5 6
I J
2 1
15
Properties of greedy best-first search
• Complete?
• No – can get stuck in loops, e.g., Iasi → Neamt → Iasi →
Neamt →
• Time?
• O(bm), but a good heuristic can give dramatic
improvement
• Space?
• O(bm) -- keeps all nodes in memory
• Optimal?
• No
A* search
• Evaluation function f(n) = g(n) + h(n)
h(n)
20
g(n) 15 n
10 5
15
20 18
25
33
A* for Romanian Shortest Path
19
A* for Romanian Shortest Path
20
A* for Romanian Shortest Path
21
A* for Romanian Shortest Path
22
A* for Romanian Shortest Path
23
A* for Romanian Shortest Path
24
Admissible heuristics
• A heuristic h(n) is admissible if for every node n,
h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from
n.
• Optimal?
Yes (depending upon search algo and heuristic property)
http://www.youtube.com/watch?v=huJEgJ82360
Heuristics Functions
• h1(S) = ? 8
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18
Dominance
To test the heuristic functions h1 and h2, 1200 random problems were generated with
solution lengths from 2 to 24 (100 for each even number) and solved them with iterative
deepening search and with A∗ tree search using both h1 and h2.
Performance of heuristics function
• One way to characterize the quality of a heuristic is the
effective branching factor b∗
• d=12
A*(h1) = 227 nodes
A*(h2) = 73 nodes
• d=24
A*(h1) = 39,135 nodes
A*(h2) = 1,641 nodes
Relaxed problems
• A problem with fewer restrictions on the actions is called a
relaxed problem
• 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 adjacent
square, then h2(n) gives the shortest solution
• The choice of 1-2-3-4 is fairly arbitrary; we could also construct databases for 5-
6-7-8, for 2-4-6-8, and so on. Each database yields an admissible heuristic, and
these heuristics can be combined
• The idea behind pattern databases is to store these exact solution costs for every
possible subproblem instance—in our example, every possible configuration of
the four tiles and the blank.