Main program tries to solve the problem and show statistics and graphical representation shown on a plot. Why try? Traveling salesman problem is hard to solve without using brute force method. Here we use a faster solution. Algorithm is placed here.
PMX chooses two segments and replaces them. Then, it fixes all elements which must be unique and check width of this road. The more times this algorithm is repeated, the greater the chance of getting closer to the optimal solution is. Here is a mutation which has a 7% chance to appear.
Here is an implemented graph for found solution.
There are 3 types of mutations:
- Swap 2 numbers in input list
- Swap fragment of list
- Get random list started with 0