AI and AT
Module II
Lecture 2
Heuristic Search Techniques
Agenda
Hill Climbing
◦ Simple Hill Climbing
◦ Steepest-Ascent Hill Climbing
◦ Simulated Annealing
Best-First Search
◦ The A* Algorithm
◦ Agenda-Driven Search
Simulated Annealing
Variation of Hill Climbing
To address issues of local maximum, a
plateau, or a ridge
Motivated by the physical process of
annealing
Material is heated and slowly cooled into
a uniform structure
Simulated annealing mimics this process
Key Idea
Escape local maxima by allowing some
"bad" moves but gradually decrease their
frequency
Take some uphill steps to escape the local
minimum
Insteadof picking the best move, it picks
a random move
Term “objective function” is used in place
of the term “heuristic function”
We attempt to minimize the value of
objective function
Valley descending instead of hill climbing
The goal of this process is to produce a
minimal-energy final state
Physical substances usually move from
higher energy configurations to lower ones,
so the valley descending occurs naturally
Probability that a transition to a higher energy
state will occur: p = e-∆E/kT where ∆E is the
positive change in the energy level, T is the
temperature and k is Boltzman’s constant
In a physical valley descending that occurs
during annealing, the probability of a large
uphill move is lower than the probability of a
small one
The probability that an uphill move will be
made decreases as the temperature decreases
Thus such moves are more likely during the
beginning of the process when the temperature
is high, and they become less likely at the end
as the temperature becomes lower
The rate at which the system is cooled is
called the annealing schedule
If cooling is rapid –> local minimum is
reached
If cooling is slow –> global minimum is
reached
If cooling is too slow –> time is wasted
Optimal annealing schedule needs to be
discovered empirically
In simulated annealing:
∆E is generalized so that it represents the
change in the value of objective function
K is incorporated into T
Revised probability formula:
P’ = e-∆E/T
Algorithm: Simulated Annealing
1. Evaluate the initial state. If it is also a
goal state, then return it and quit.
Otherwise, continue with the initial state
as the current state
2. Initialize BEST_SO_FAR to the current
state
3. Initialize T according to the annealing
schedule
4. Loop until a solution is found or until
there are no new operators left to be
applied in the current state.
(a) Select an operator that has not yet
been applied to the current state and
apply it to produce a new state
(b) Evaluate the new state. Compute
∆E = value of current – value of new state
If the new state is a goal state, then return
it and quit
If it is not a goal state but is better than the
current state, then make it the current state.
Also set BEST_SO_FAR to this new state
If it is not better than the current state, then
make it the current state with probability p’
(c)Revise T as necessary according to the
annealing schedule
5. Return BEST_SO_FAR, as the answer
Selection of Annealing Schedule
3 components:
1. Initial value to be used for temperature
2. Criteria that will be used to decide when
temperature of the system should be
reduced
3. Amount by which the temperature will
be reduced each time it is changed
4. (When to quit)