What is the traveling salesman problem?
What makes it a difficult problem to compute?
We've set up a traveling salesman problem with a few points outside. Your challenge is to come up with a good guess at the shortest route which visits each point once then returns to the starting point. You'll split up into teams of 2-3 people, then we'll head outside!
This is a map of the points we will be using!
Before you can use the program you'll need to make several changes to the code.
drawTSPPoints(points)
to give the plot a title:drawTSPPoints(points, title="YOURTITLEHERE")
Go ahead and run the program from IPython! You should see the points displayed, along with your path. The program will also calculate and tell you the total distance for the route.
The rest of the code in the program calculates the shortest route. Go ahead and take a look at this code if you'd like! Does anything in this code look familiar to you? (Hint: Recall the 2D distances lesson.)
Uncomment the last line of the program to display the shortest route by erasing the hash symbol. Save your program then run it again. You should see your route as well as the calculated shortest path.
Be sure to save the plot to add to your website and answer these questions on your webpage! Also include the answer to this question: How close was your guess to the calculated solution?