tsp-route
tsp-route copied to clipboard
Solving the Traveling Salesman Problem with google OR-Tools.
tsp-route
Spend less time to visit more places of interest.
Open in google colab [Click here]
Feature
-
Spend less time to visit more places of interest.
-
Four modes to choose including walking, driving, bicycling and transit.
-
Good visualization powered by gmaps, provide two different kinds of maps.
Introduction of Travelling salesman problem
"The travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city and returns to the origin city?" It is an NP-hardproblem in combinatorial optimization." (more details on Wikipedia)
Usage
-
Make sure you have already installed these packages: googleplaces, googlemaps, gmaps, ortools.
-
Get Google API key from here: https://developers.google.com/maps/documentation/distance-matrix/start#get-a-key.
-
Change the variables 'places' and 'location' then run all the cells.
-
PS: If the fig is not showed after running all cells, try to restart the Jupyter notebook.
Requirement
python-google-places 1.4.1
pip install python-google-places==1.4.1
googlemaps 3.0.2
pip install googlemaps==3.0.2
gmaps 0.8.4
pip install gmaps==0.8.4
OR-Tools v7.0 (2019-03)
python -m pip install --upgrade --user ortools
Chinese info
License
MIT License