8/3/2019 L4 Problem Solving n Search p3
1/40
241-320 Design Architecture and Engineeringfor Intelligent System
Suntorn Witosurapot
Contact Address:Phone: 074 287369 or
Email: [email protected]
November 2009
8/3/2019 L4 Problem Solving n Search p3
2/40
Lecture 4:
Problem Solving and Search part 3
Informed Search
8/3/2019 L4 Problem Solving n Search p3
3/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 3
Informed (Heuristic) Search
We have seen that uninformed (trial-and-error)methodsof search are capable of systematically exploring thestate-space in finding a goal state
However, uninformed search methods are veryinefficient in most cases
In the worst case, most searches take exponential time
With the aid of problem-specific knowledge, informedmethods of search are more efficient
8/3/2019 L4 Problem Solving n Search p3
4/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 4
Overview
Heuristics Informed Search Methods
Greedy Best-First Search
A Search
Iterative Deepening A Search
Conclusion
8/3/2019 L4 Problem Solving n Search p3
5/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 5
Heuristics
Heuristics: ()A rule of thumb, simplication, or educated guess
that reduces or limits the search for solutions
in domains that are difficult and poorly understood.
Depending on what heuristic you use, you won'tnecessarily find an optimal solution, or even asolution at all.
8/3/2019 L4 Problem Solving n Search p3
6/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 6
Heuristics - The 8-Puzzle Example
Using the number of tiles out of placein each statewhen it is compared with the goal
Therefore, h(n) = 5 ( 5)
8/3/2019 L4 Problem Solving n Search p3
7/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 7
Heuristics - The 8-Puzzle Example
UsingManhattan distance(Sum of distances that tiles are out of place)
Therefore, h(n) = 1 + 2 + 0 + 1 + 1 + 0 + 1 + 0 =6
1 2 0
1 1 0
1 0
8/3/2019 L4 Problem Solving n Search p3
8/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 8
Heuristics Example
Another common heuristic is the straight-line distance
(as the crow flies) from node to goal
Therefore, h(n) = distance from n to g
8/3/2019 L4 Problem Solving n Search p3
9/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 9
Heuristics - Deployment
Normally, the Heuristic will be used as a function (ie.h(n) in previous examples)for supporting the decision
how the algorithm should proceed
Heuristic h(n) (Resource) n () (Goal Node)
Q: Whatre the resources that we used in theprevious slides?
8/3/2019 L4 Problem Solving n Search p3
10/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 10
How the Heuristic function will be used?
The heuristic function, h(n), will be used in a part ofevaluation function,f(n), of an search algorithm toestimate how good each search node is Traditionally, f(N) is an estimated cost; so, the smaller f(N), the more
promising N
Typically, f(n) can be estimated from:
either the cost of a solution path through N
Then f(N) = g(N) + h(N), where
g(N) is the cost of the path from the initial node to N
h(N) is an estimate of the cost of a path from N to a goal node
or the cost of a path from N to a goal node
Then f(N) = h(N) => Greedy best-search
8/3/2019 L4 Problem Solving n Search p3
11/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 11
How the Heuristic function will be used?
The heuristic function, h(n), will be used in a part ofevaluation function,f(n), of an search algorithm toestimate how good each search node is Traditionally, f(N) is an estimated cost; so, the smaller f(N), the more
promising N Typically, f(n) can be estimated from:
either the cost of a solution path through N
Then f(N) = g(N) + h(N), where
g(N) is the cost of the path from the initial node to N
h(N) is an estimate of the cost of a path from N to a goal node
or the cost of a path from N to a goal node
Then f(N) = h(N) Heuristic function
8/3/2019 L4 Problem Solving n Search p3
12/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 12
So, in our previous examples
h1(N) = number of misplaced numbered tiles = 5
h2(N) = sum of the (Manhattan) distance of
every numbered tile to its goal position= 1 + 2 + 0 + 1 + 1 + 0 + 1 + 0 = 6
1 4
7
2
5
6
38
STATE(N)
6
4
7
1
5
2
8
3
Goal state
8/3/2019 L4 Problem Solving n Search p3
13/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 13
8-Puzzle
4
5
5
3
3
4
3 4
4
2 1
2
0
3
4
3
f(N) = h(N) = number of misplaced numbered tiles
The white tile is the empty tile
8/3/2019 L4 Problem Solving n Search p3
14/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 14
0+4
1+5
1+5
1+3
3+3
3+4
3+4
3+2 4+1
5+2
5+0
2+3
2+4
2+3
8-Puzzle
f(N) = g(N) + h(N)with h(N) = number of misplaced numbered tiles
8/3/2019 L4 Problem Solving n Search p3
15/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 15
Overview
Heuristics
Informed Search Methods
Greedy Best-First Search A Search
Iterative Deepening A Search
Conclusion
8/3/2019 L4 Problem Solving n Search p3
16/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 16
Greedy Best-First Search
Idea:expand node with the smallest estimated costto reach the goal
Evaluation function f(n) = h(n)
() ()
8/3/2019 L4 Problem Solving n Search p3
17/40
241-320 Design Architecture &Engineering for Intelligent System
Problem Solving and Search part 3 17
Ex: Greedy Search
of the 8-Puzzle
8/3/2019 L4 Problem Solving n Search p3
18/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 18
Overview
Heuristics
Informed Search Methods
Greedy Best-First Search
A Search Iterative Deepening A Search
Conclusion
8/3/2019 L4 Problem Solving n Search p3
19/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 19
A Search(most popular algorithm in AI)
Idea:avoid expanding paths that are already expensive Evaluation function f(n) = g(n) + h(n)
g(n) = cost so far to reach n
h(n) = estimated cost to goal from n
f(n) estimated total cost of path through n to goal
Expand node from frontier with smallest f-value
Essentially combines uniform-cost search and greedy search
8/3/2019 L4 Problem Solving n Search p3
20/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 20
Ex: A Search of
the 8-Puzzle
8/3/2019 L4 Problem Solving n Search p3
21/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 21
Robot Navigation
8/3/2019 L4 Problem Solving n Search p3
22/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 22
Robot Navigation
0 211
58 7
7
3
4
7
6
7
6 3 2
8
6
45
23 3
36 5 24 43 5
54 6
5
6
4
5
f(N) = h(N), with h(N) = Manhattan distance to the goal(not A*)
8/3/2019 L4 Problem Solving n Search p3
23/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 23
Robot Navigation
0 211
58 7
7
3
4
7
6
7
6 3 2
8
6
45
23 3
36 5 24 43 5
54 6
5
6
4
5
f(N) = h(N), with h(N) = Manhattan distance to the goal(not A*)
7
0
8/3/2019 L4 Problem Solving n Search p3
24/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 24
Robot Navigation
f(N) = g(N)+h(N), with h(N) = Manhattan distance to goal(A*)
0 211
58 7
7
3
4
7
6
7
6 3 2
8
6
45
23 3
36 5 24 43 5
54 6
5
6
4
57+0
6+1
6+1
8+1
7+0
7+2
6+1
7+2
6+1
8+1
7+2
8+3
7+2 6+36+3 5+45+4 4+54+5 3+63+6 2+7
8+3 7+47+4 6+5
5+6
6+3 5+6
2+7 3+8
4+7
5+6 4+7
3+8
4+7 3+83+8 2+92+9 3+10
2+9
3+8
2+9 1+101+10 0+110+11
8/3/2019 L4 Problem Solving n Search p3
25/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 25
Overview
Heuristics
Informed Search Methods
Greedy Best-First Search
A Search
Iterative Deepening A Search Conclusion
8/3/2019 L4 Problem Solving n Search p3
26/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 26
Iterative Deepening A* (IDA*)
Idea: Reduce memory requirement of A* by applyingcutoff on values of f
Consistent heuristic function h
Algorithm IDA*:
1. Initialize cutofftof(initial-node)
2. Repeat:
a. Perform depth-first search by expanding all nodesN
such thatf(N)cutoff
b. Reset cutoff to smallest valuefof non-expanded(leaf) nodes
8/3/2019 L4 Problem Solving n Search p3
27/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 27
8-Puzzle
4
6
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Cutoff=4
8/3/2019 L4 Problem Solving n Search p3
28/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 28
8-Puzzle
4
4
6
Cutoff=4
6
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
29/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 29
8-Puzzle
4
4
6
Cutoff=4
6
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
30/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 30
8-Puzzle
4
4
6
Cutoff=4
6
5
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
31/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 31
4
8-Puzzle
4
6
Cutoff=4
6
5
56
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
32/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 32
8-Puzzle
4
6
Cutoff=5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
33/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 33
8-Puzzle
4
4
6
Cutoff=5
6
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
34/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 34
8-Puzzle
4
4
6
Cutoff=5
6
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
35/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 35
8-Puzzle
4
4
6
Cutoff=5
6
5
7
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
36/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 36
8-Puzzle
4
4
6
Cutoff=5
6
5
7
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
37/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 37
8-Puzzle
4
4
6
Cutoff=5
6
5
7
5 5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
8/3/2019 L4 Problem Solving n Search p3
38/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 38
8-Puzzle
4
4
6
Cutoff=5
6
5
7
5 5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
5
8/3/2019 L4 Problem Solving n Search p3
39/40
241-320 Design Architecture &Engineering for Intelligent System Problem Solving and Search part 3 39
Advantages/Drawbacks of IDA*
Advantages:
Still complete and optimal
Requires less memory than A*
Avoid the overhead to sort the fringe
Drawbacks:
Cant avoid revisiting states not on the current path
Available memory is poorly used
8/3/2019 L4 Problem Solving n Search p3
40/40
241 320 D i A hit t & P bl S l i d S h t 3 40
Conclusion
Informed search makes use of problem-specificknowledge to guide progress of search
This can lead to a significant improvement in theperformance of search
If our problem can be derived as a graph or tree,heuristic search (e.g. Greedy best-first and A* (andvariants of A*)) can be applied
Note: the other technique (known as Local search) is availablefor some problems where the path is irrelevant (e.g., 8-queen
puzzle) & hence the evaluation function is only performed onthecurrent state.
Top Related