Académique Documents
Professionnel Documents
Culture Documents
Chapter 4
Outline
Best-first search
Greedy best-first search
A* search
Heuristics
Hill-climbing search
Simulated annealing search
Genetic algorithms
Best-first search
Idea of which node to expand next is determined by evaluation
function f(n), which returns a numbers supporting the desirability of
expanding nodes.
o
Implementation:
When we order the nodes in fringe in decreasing order of desirability, the
resulting strategy is called Best First Search.
In case of minimization problem, the order is ascending
otherwise descending.
Special cases:
o
o
BFS (Cont..)
Solve 8 puzzle problem using BFS.
A* search
Drawback of Best first search is that if 2 states with
same heuristic value appears at different levels in
different branches are not comparable.
To avoid such situations, consider the distance from root
till node along with heuristic.
A* search example
A* search example
A* search example
A* search example
A* search example
A* search example
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.
An admissible heuristic never overestimates the cost to
reach the goal, i.e., it is optimistic
Example: hSLD(n) (never overestimates the actual road
distance)
A* exhibits a monotonous behaviour.
Path Max equation, in case of non monotonous
behaviour
f(n)= max( f(n) , g(n)+ h(n)) where n is parent of n.
Optimality of A*
A* expands nodes in order of increasing f value
Gradually adds "f-contours" of nodes
Contour i has all nodes with f=fi, where fi < fi+1
Properties of A*
Complete? Yes
Time? Exponential
Space? Keeps all nodes in memory
Optimal? Yes
Admissible heuristics
E.g., for the 8-puzzle:
h1(n) = number of misplaced tiles
h2(n) = total Manhattan distance
(i.e., no. of squares from desired location of each tile)
h1(S) = ?
h2(S) = ?
Admissible heuristics
E.g., for the 8-puzzle:
h1(n) = number of misplaced tiles
h2(n) =number of properly placed tiles.
h1(S) = ? 8
h2(S) = ? 0
Hill-climbing search
"Like climbing Everest in thick fog with
amnesia"
Hill-climbing search
Problem: depending on initial state, can
get stuck in local maxima
h = number of pairs of queens that are attacking each other, either directly
or indirectly
h = 17 for the above state
Properties of simulated
annealing search
One can prove: If T decreases slowly enough,
then simulated annealing search will find a global
optimum with probability approaching 1
Widely used in VLSI layout, airline scheduling,
etc
Genetic algorithms
A successor state is generated by combining two parent
states
Start with k randomly generated states (population)
A state is represented as a string over a finite alphabet
(often a string of 0s and 1s)
Evaluation function (fitness function). Higher values for
better states.
Produce the next generation of states by selection,
crossover, and mutation
Genetic algorithms
Genetic algorithms