This project provides various algorithms and methods to solve the classic Traveling Salesman Problem (TSP). The implementation took place as part of a Project at HSLU (Lucerne School of Information Technology) to function as a visual tool for the Modul of Industrial Optimization.
Many Thanks go to Reinhard Bürgy who came up with the project.
To use the App, you'll need a Free OpenRouteService API Key.
Steps to generate one:
- Visit the OpenRouteService Sign Up page.
- Create an account or sign in if you already have one.
- Once logged in, navigate to the Dashboard --> "Tokens" section.
- Here, you can create a new API token or manage existing ones.
Now you can paste it in the API_KEY.txt file
The project currently incorporates methods such as TwoOpt, Permutation, FlowBased, and ConstraintProgramming.
- Define the New Method:
- Create a new class for your method in
tsp_logic.pyand make sure it inherits from the interface TSPMethod. - Your class needs to have a
solvemethod that accepts a cost matrix as input and returns the solution (tour) for the TSP. Make sure that in the end you return to the original position.
- Create a new class for your method in
- Update the TSPMethodFactory:
- Modify the
TSPMethodFactoryclass to handle the creation of an instance of your new method based on its name.
- Modify the
- GUI Integration:
- To make your method available as an option on the dash website, add its name to the
dcc.Dropdownlist indash.py. Ensure consistency with the name used in the Factory.
- To make your method available as an option on the dash website, add its name to the
To contribute to this project, ensure that any new methods or changes are thoroughly tested and documented. Bugfixes and improvments as well as new Methods are welcome.
After cloning the repository make sure you have added a valid API Key in the API_KEY.txt file, then run the app.py file and go to your local host on any webbrowser (app was tested on Chrome).
If a location name overlaps with another, you can provide additional details to distinguish them. Use the format:
City Name, State Name, Country
This is similar to the format used in Google Maps.


