Skip to content

Latest commit

 

History

History

gap-fill-code

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Genetic TSP Python

Gap-fill version of the code available on Emma Neiss' Github repository used in INSAlgo's 2021 Week 19 training.

If you are stuck on this exercise or want to compare your solution with the suggested one, check it out on the original repository !

How to run the code

Make sure you have a Python 3.6+ interpreter as well as the matplotlib module installed, then simply run main.py !

Understanding the code

The could should be self-explanatory with all the comments I wrote in the different files, however if you still don't get how it works, go check the external resources I linked below 😉

Your job for today's training: try to fill in the gaps I left in the following methods:

  • mutate (in individual.py)
  • crossover (in functions.py)
  • elitistSelection (in functions.py)
  • selectMatingPool (in functions.py)

Good luck!

Improving the code

This code is far from perfect, so don't hesitate to tweak it to your liking, be it to optimize things, or to try new methods! For example, you might want to change the value of parameters in parameters.py, or to re-write the body of the methods used in the algorithm to test alternatives to the one I propose here (like changing the breeding, mutating or selection methods).

Any feedback, so long as it is constructive, would be greatly appreciated 😊

External resources about this implementation