Travelling salesman variation in python

Josiah Carlson jcarlson at uci.edu
Thu Apr 1 19:00:46 EST 2004


> An approximate solution would be good enough, do you have any 
> suggestions about how do do that?

One approximate solution to the TSP is the bitonic TSP.  That is, start 
at the leftmost point, find a path to the rightmost point, then find a 
return path to the leftmost point.

Search for 'optimal bitonic tsp' in google, the second entry will have 
pseudocode for the algorithm.  I've personally converted it to Python 
for other uses, but I'll leave it as an exercise for you.

You can convert it into your 'maximum' by changing the line:
if q < b[j - 1, j] then
to:
if q > b[j - 1, j] then


  - Josiah



More information about the Python-list mailing list