Solving the travelling salesman problem with Genetic Algorithm (in scotland)
Steps:
-
Configure IO (Done)
-
Initializing first generation (Done)
-
Creating next generation (Done)
-
Crossover and mutation (Done)
-
Putting everything together! (Done)
How does the program read?
The program reads from a text file, currently known as "format.txt"
The first line represents no. of cities
The second line represents the city to start and end with (creating a circuit)
then from the third line, the program starts reading the distance between x and y cities and store it in a data structure for later use.
How to put the text for distance:
123
34 13
66 23 234
The distance between city 0 and city 1 is 123
The distance between city 0 and city 2 is 34
The distance between city 1 and city 2 is 13
The distance between city 0 and city 3 is 66
The distance between city 1 and city 3 is 23
The distance between city 2 and city 3 is 234
If I were to show it with a bit more description, it would look like this..
(City 0 -> City 1)
(City 0 -> City 2)(City 1 -> City 2)
(City 0 -> City 3)(City 1 -> City 3)(City 2 -> City 3)