0% found this document useful (0 votes)
32 views2 pages

8-Puzzle Problem: Simulated Annealing Approach

Uploaded by

mofata7995
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

8-Puzzle Problem: Simulated Annealing Approach

Uploaded by

mofata7995
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Experiment no 5

Title :-Solve 8-puzzle problem using best first search.


Aim:- To gradually explore solution to 8 Puzzle problem using simulated Annealing Approach
Theory :-
Simulated annealing is a method for solving complex problems in artificial intelligence. It is a guided search
procedure that allows the computer to gradually explore different solutions to a problem until it finds one
that works best.

Simulated annealing is an algorithm based on the physical annealing process used in metallurgy. During
physical annealing, the metal is heated up until it reaches its annealing temperature and then is gradually
cooled down to change it into the desired shape. It is based on the principle that the molecular structure of
the metal is weak when it is hot and can be changed easily. Where as when it cools down, it becomes hard
and thus changing the shape of the metal becomes difficult.

Simulated annealing has a probabilistic way of moving around in a search space and is used for optimizing
model parameters. It mimics physical annealing as a temperature parameter is used here too.

If the temperature is higher, the more likely the algorithm will accept a worse solution. This expands the
search space unlike gradient descent and allows it to travel down a trivial path. This promotes exploration.

The main difference between a greedy search and simulated annealing is that the greedy search always go
for the best option where as in simulated annealing, it has a probability (using Boltzmann distribution) to
accept a worse solution.

Algorithm
For a function h(•) we are trying to maximize, the steps for simulated annealing algorithm is as
follows:

1. Start by generating an initial solution x.

2. Set the initial temperature t=t0 where t0 > 0.

3. For the n number of iterations i=1,2,...,n , loop through the following steps until the termination
condition is reached:
• Sample out θ ~ g(θ) where g is a symmetric distribution.
• The new candidate solution becomes x'=x ± θ.
• We find the difference in cost between our old and new solution (Δh=h(x')-h(x)) and calculate the
probability p using the difference and the current temperature(ti). This is the probability that we
should accept/ reject the candidate solution.

p= exp(Δh/ti)

• If Δh is greater than zero, it means that our new solution is better and we accept it. If it is less than
zero, then we generate a random number u ~ U(0,1). We accept the new solution x' if u ≤ p.
• We then reduce the temperature t using a temperature reduction function α. Temperature reduction
functions like t = t - α or t = t * α may be used here.
The termination conditions here may be achieving a particular temperature or a performance
threshold.

• Note please write down below problem and solution

You might also like