less than 1 minute read

Simulated annealing is a probabilistic technique used for approximating the global optimum of a given function. Here’s a simple simulated annealing algorithm implemented in C#.

Source repository

The Traveling Salesman Problem (TSP) is a classic optimization problem. In its most basic form, it presents the following question:

“Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the original city?”

Although the problem sounds simple, the TSP can be quite challenging, especially as the number of cities increases. The complexity of finding the optimal route grows factorially with the number of cities, making it infeasible to solve by brute force for even modest numbers of cities.

To address problems like TSP, one can use heuristic methods. One such method is the simulated annealing algorithm, which we’ve adapted into the RouteAnnealer class specifically for solving TSP. The class provides an approximate solution, rather than the absolute optimal solution, but does so in a much shorter amount of time than other exact methods.