Travelling salesman variation in python

Nick Craig-Wood ncw at axis.demon.co.uk
Fri Apr 2 05:30:05 EST 2004


Erlend Andreas Garberg <erlendga at tva.ifi.uio.no> wrote:
>  My problem is that when the number of nodes is higher than 8, the 
>  algorithm slows to a crawl (because of O(n!) complexity). I wonder if 
>  there is some way I can optimize my algorithm to make it run faster? 
>  Currently it takes 20 seconds to compute the best combination with 9 
>  nodes on my hardware.

I had to solve exactly this problem when I was at University (many
moons ago now ;-)

I used Simulated Annealing - have a search for the term and you'll see
plenty of references.  Its good at finding a (local) minimum.

Just be glad you don't have to write it in Fortran like I did!

-- 
Nick Craig-Wood
ncw at axis.demon.co.uk



More information about the Python-list mailing list