AI Lab 6 Manual
AI Lab 6 Manual
BS (CS) _SP_2025
Lab_06 Manual
Learning Objectives:
1. Simulated Annealing
2. Local Beam Search
1. Simulated Annealing:
Simulated annealing is a stochastic optimization algorithm that is often used to find the global
minimum (or maximum) of a non-convex function. The algorithm is inspired by the process of
annealing in metallurgy, where a metal is heated and then slowly cooled to reduce its defects and
improve its properties.
Simulated Annealing explores the solution space by allowing occasional uphill moves (worse
solutions) to escape local optima. This is controlled by a temperature parameter that decreases
over time, reducing the likelihood of accepting worse solutions as the search progresses.
Step-by-Step Working:
1. Initialize: Start with an initial solution and a high temperature.
2. Evaluate: Compute the cost of current solution.
3. Generate neighbor: Select a neighboring solution randomly.
4. Compute cost difference: measure the difference between new solution and current
solution.
5. Acceptance Criteria:
• if new solution is better, accept it.
• if new solution is worse, accept it with a probability dependent on
temperature.
6. Cool Down: reduce the temperature gradually.
7. Repeat: continue until the system is sufficiently cooled down or a stopping
condition is met.
Step-by-Step Working: