| CS 540 | Lecture Notes | Fall 1996 |
h=3
/\
/ \
h=2 h=4
| |
| |
h=1 h=1
| |
| |
h=1 goal
|
|
h=1
|
|
goal
Assuming all arc costs are 1, then Greedy search will find the
left goal, which has a solution cost of 5, while the optimal solution
is the path to the right goal, which has a cost of 3.
S ... Initial State S 8
/|\ /|\
1/ 5 \8 / | \
/ | \ / | \
A B C 8 A B 4 C 3
/|\ | / /|\ | /
3/ 7 9 4 /5 / | \ | /
/ | \|/ / | \|/
D E G .... Goal State D E G
* * 0
Edge Costs Heuristic = Estimated Costs = h(n)
Summary of g(n), h(n),
f(n) = g(n) + h(n), as well as
h*(n), the hypothetical perfect heuristic:
n g(n) h(n) f(n) h*(n)
S 0 8 8 9
A 1 8 9 9
B 5 4 9 4
C 8 3 11 5
D 4 inf inf inf
E 8 inf inf inf
G 10/9/13 0 10/9/13 0
Notice that since h(n) <= h*(n) for all n, h is admissible
Optimal path = S B G
Cost of the optimal path = 9
Similarly, if we assume that tiles in the 8-puzzle are restricted to moving one square horizontally or vertically at a time, but we relax the assumption that only one tile can occur at a board position at a time, then each tile can be moved independently to its goal position, taking a number of steps equal to the Manhattan distance from its start position to its goal position. This leads to a heuristic which is the sum of the distances of the misplaced tiles to their goal positions. This heuristic is admissible.
^
|
| y
|
h | /
| /
| /
| /
|/
+----------------> x
Consider the state space to be the set of points in the x,y plane,
and for each such point the height h is the value of the heuristic
function for that state. This height function, h = h(x,y),
defines a surface.
The initial state corresponds to a point on this surface and the
goal is to find a state where the height is 0 (or is a global minimum).Hill-climbing (should be called Valley-Finding in this context where we are minimizing instead of maximizing a value) moves in the direction of steepest descent since it moves to the successor (i.e., adjacent) node that decreases h the most.
Notice that by considering the state space as a continuous space of points in the x,y plane, if the height surface is continuous (i.e., smooth so that derivatives are well-defined everywhere), then the direction of steepest descent corresponds to the gradient direction = [dh(x,y)/dx, dh(x,y)/dy], and the search is called gradient descent.
current = Initial-State(problem) for t = 1 to infinity do T = Schedule(t) ; T is the current temperature, which ; is monotonically decreasing with t if T=0 then return current ; halt when temperature = 0 next = Select-Random-Successor-State(current) deltaE = f(next) - f(current) ; If positive, next is ; better than current. ; Otherwise, next is ; worse than current. if deltaE > 0 then current = next ; always move to ; a better state else current = next with probability p = e^(deltaE / T) ; as T -> 0, p -> 0 ; as deltaE -> -infinity, p -> 0 end
Last modified October 3, 1996
Copyright © 1996 by Charles R. Dyer. All rights reserved.