This simple project will solve the Salesman problem using genetic algorithm and generate the GIF automatically.
The algorithm is pretty simple:
- Generate a population of random routes
- Repeat N times (with N the number of generations you want to simulate):
- sort individuals by fitness (total distance of the route)
- save the best 33% and kill the others
- mutate the best 33% and keep the mutants
- merge the best 33% two by two (reproduction) and keep the children
- the new population is the combination of the previous 3 groups
#without parameters
sbt run
#with parameters: number_of_cities max_coordinates number_of_generations
sbt "run 5 100 1"