Simulated Annealing - SelinGungor/pairwise-testing GitHub Wiki
The Simulated Annealing Algorithm
Simulated annealing is a method for finding a good (not necessarily perfect) solution to an optimization problem. If you're in a situation where you want to maximize or minimize something, your problem can likely be tackled with simulated annealing.
The traveling salesman problem is a good example: the salesman is looking to visit a set of cities in the order that minimizes the total number of miles he travels. As the number of cities gets large, it becomes too computationally intensive to check every possible itinerary. At that point, you need an algorithm
The basic algorithm Here's a really high-level overview. It skips some very important details, which we'll get to in a moment.
- First, generate a random solution
- Calculate its cost using some cost function you've defined
- Generate a random neighboring solution
- Calculate the new solution's cost Compare them:
- If cnew < cold: move to the new solution
- If cnew > cold: maybe move to the new solution
- Repeat steps 3-5 above until an acceptable solution is found or you reach some maximum number of iterations.