Obtaining a TSP solver

From Evil Mad Scientist Wiki
Revision as of 17:08, 26 September 2010 by Dnewman (talk | contribs)
Jump to: navigation, search

To generate TSP art, a TSP solver is needed. However, generating TSP solutions with a TSP solver takes a lot of computer time. An image stippled to a thousand points may take several hours to solve the Travelling Salesman Problem for. Consequently, it is preferred to use a fast, approximate TSP solver instead. The Concorde TSP solver package includes both a TSP solver as well as some fast, approximate solvers. Of chief interest is the "linkern" approximate solver which can produce satisfactory solutions in under a minute.

Binaries for linkern for Red Hat Linux 8.0, Solaris SPARC, and Windows (with Cygwin installed) are available at

Concorde TSP downloads


Building on Macs

For Macs with OS X, obtain the sources from the Concorde TSP downloads page cited above. You will also want the QSopt Linear Programming (LP) solver library and header file (qsopt.a and qsopt.h) from

QSopt LP downloads

You will need a C compiler and assorted build tools as well. (E.g., Apple's Xcode developer tool kit.) When obtaining the QSopt libraries, use the library files labelled as "OS X 10.5" for 32bit builds; the OS X 10.6 files are 64bit libraries. To configure concorde for building, use the commands (assuming the Bash shell)

% cd <directory with concorde sources>
% export QSOPTDIR=<full, absolute directory path to the directory with qsopt.a and qsopt.h>
% CFLAGS="-g -O3 -m32" ./configure --with-qsopt=$QSOPTDIR --host=darwin

You must specify a complete, absolute directory path for the QSopt files. Failure to do so will result in a build failure. Also, ignore the "checking host system warning" generated by the configuration script. You have to specify the --host switch, but there's no acceptable value on a Mac for the script. Once the script finishes running, build the package with the make command. There is no install target for the makefile. The Concorde TSP solver will be the file ./TSP/concorde. The linkern executable, ./LINKERN/linkern.

A shell script for obtaining, building, and installing the sources will be available in the near future.