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.

  1. First, generate a random solution
  2. Calculate its cost using some cost function you've defined
  3. Generate a random neighboring solution
  4. Calculate the new solution's cost Compare them:
  5. If cnew < cold: move to the new solution
  6. If cnew > cold: maybe move to the new solution
  7. Repeat steps 3-5 above until an acceptable solution is found or you reach some maximum number of iterations.