Travelling salesman problem (TSP) using the Ant Colony Optimization (ACO) algorithm.
Note: the starting node/city is always random, but the path, as well as the objective distance value, are always the same.
After you download the project's directory, you may install it running the following command:
python -m pip install -e taco
Or, if you happen to be inside of the project's directory:
python -m pip install -e .
Once the project is installed, you can run it from anywhere with:
python -m taco
This will use the default dataset that exists in the following path: taco/data/tsp_data.csv
Note: you can run the module without installing it, but it is important to make sure that all dependencies are satisfied, such as Numpy. If desired, you can install all required dependencies in the requirements.txt
file with the following command:
python -m pip install -r requirements.txt
Finally, if you would like to use a different example, you can either provide your own .csv
file that contains a distance matrix in the expected format, or select any from the data
directory. If you find one that you like, you can run it as follows:
python -m taco taco/data/google_or_tools.csv
If you have a lot of time and would like to run all of the available examples in the data
directory, you can do so as follows:
python -m unittest -v
You may also run a specific test-case of interest, such as the following:
python -m unittest -v tests.test_data.TestData.test_tsp_data
Resulting objective values from all examples have been verified using the optimal solutions for symmetric TSPs.
All credits go to TSPLIB group and the respective authors for each example that I used to test my software.