Skip to content

Using a genetic algorithm to find (non-optimal) solutions to the travelling salesman problem

Notifications You must be signed in to change notification settings

raykeating/TSP_GA

Repository files navigation

Using a Genetic Algorithm to find Solutions to the Travelling Salesman Problem

A python implementation of a simple Genetic Algorithm that attempts to find solutions to the travelling salesman problem.

Read the Full Paper - in Results/writeup.pdf

Execution Instructions

To run:

  1. Navigate to the "Code" directory in the assignment folder

  2. Type the command "python3 main.py"


(OPTIONAL) Display Best Path on Screen

NOTE:

I left in a simple tool I made to display a path. The function is called show_path()

Screenshots of the output of this tool are at the bottom of my paper.

I commented it out because it caused some issues when running from the command line.

If you're interested in getting the GUI thing to run on your machine, feel free to try. It should be pretty simple.

  1. move graphics.py (in the "ignore" folder) into the code folder

  2. uncomment the show_path() function, the graphics import, and the function call in the main method (all in main.py)

  3. If you are on linux instead of running "python3 main.py" to execute the program, try running "/bin/python3 main.py" (this worked for me)

On Windows, i think the normal command, "python3 main.py" should work.

Alternatively, try opening the Code folder in VScode and running in the integrated terminal.


About

Using a genetic algorithm to find (non-optimal) solutions to the travelling salesman problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages