Just an implementation (which can be easily subclassed) for the Simulated Annealing algorithm. More info: https://en.wikipedia.org/wiki/Simulated_annealing
I decided to implement the travelling salesman problem to test the implementation.
To pick a random neighbour, I decided to just swap two cities on the salesman path.
I've tested with swapping two successive cities on the path instead but the results were way worse (and taking way longer).
I just needed a simple function where:
Simple pick:
Just the total distance walked for a given itinerary.
I just kept it simple. There's a history and a slider to allow for replaying.
- Tweeking the numbers and formulas, obviously
- Generating a new set of random cities from the GUI, not by restarting the program.
- Maybe a random seed input field, for replayability (good to test and improve some bottlenecks)
- Better file and classes organization