Difference between revisions of "Obtaining a TSP solver"

From Evil Mad Scientist Wiki
Jump to: navigation, search
Line 1: Line 1:
 
[[TSP art|<<< Introduction]] || Obtaining a TSP solver (TSP Art) || [[Producing a stippled image with Gimp|Producing a stippled image with GImp >>>]]
 
[[TSP art|<<< Introduction]] || Obtaining a TSP solver (TSP Art) || [[Producing a stippled image with Gimp|Producing a stippled image with GImp >>>]]
 +
----
 
== Introduction ==
 
== Introduction ==
  
Line 55: Line 56:
  
 
Not much to worry about here.  Just obtain the binaries from as per the Introduction above.  If you wish to build the binaries yourself, you OS X shell script cited in the section above should be a good starting point.  You'll want to omit the <tt>-m32</tt> compiler switch and consider specifying a recognized value for the <tt>--host</tt> switch.
 
Not much to worry about here.  Just obtain the binaries from as per the Introduction above.  If you wish to build the binaries yourself, you OS X shell script cited in the section above should be a good starting point.  You'll want to omit the <tt>-m32</tt> compiler switch and consider specifying a recognized value for the <tt>--host</tt> switch.
 +
----
 +
[[TSP art|<<< Introduction]] || Obtaining a TSP solver (TSP Art) || [[Producing a stippled image with Gimp|Producing a stippled image with GImp >>>]]

Revision as of 17:07, 28 September 2010

<<< Introduction || Obtaining a TSP solver (TSP Art) || Producing a stippled image with GImp >>>


Introduction

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

Concorde TSP on Windows

For Windows, Concorde TSP requires a minimal Cygwin install. Cygwin is a collection of packages for Windows which provide elements of Unix. In this case, Concorde TSP needs some (dynamic) libraries in order to run correctly on Windows. To acquire a minimal Cygwin install, go to the Cygwin home page,

Cygwin home page

and download the latest Cygwin setup.exe. Launch setup.exe and do not select or de-select any additional packages: the minimal set is selected upon startup of setup.exe. Allow the program to run which will download, install, and configure the Cygwin environment.

After the Cygwin install has completed, you should be able to open up a command window (DOS window) and manually run the linkern.exe executable you downloaded from the Concorde TSP downloads site mentioned in the Introduction above. To open a command window on Windows XP, select the "Run..." item from the "Start" menu,

run01.png

In the pop-up window, type "cmd.exe" and then click the "OK" button,

run02.png

You should then see a command window appear. In that window, enter the full directory path to the linkern executable and press return. The executable should run and display its command line options. In the following figure, it is assumed that the executable is in the top-level directory of the C: drive,

run03.png

Concorde TSP on Macs

Concorde TSP is not available pre-built for Macs. However, if you are familiar with obtaining and building sources on your Mac, then building a copy of Concorde TSP is relatively straightforward. You will need a C compiler and other build tools. Apple's Xcode Developer Toolkit for OS X provides everything you will need. That toolkit is available for download from Apple (registration required). It is often also included with your OS X distribution DVD as an extra package which you can manually install.

To build Concorde TSP, first obtain the sources from the Concorde TSP downloads page cited in the Introduction above. You will also want the QSopt Linear Programming (LP) solver library and header file (qsopt.a and qsopt.h) from

QSopt LP downloads

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 TSP for building, use the following 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 is available at the Eggbot code site,

build-concorde-osx-0_2.sh

As the script builds in the /usr/local/ directory tree, it needs to be run with root privileges. To build and install Concorde TSP elsewhere, edit the script changing the SRCDIR and BINDIR variables.

Concorde TSP on Linux

Not much to worry about here. Just obtain the binaries from as per the Introduction above. If you wish to build the binaries yourself, you OS X shell script cited in the section above should be a good starting point. You'll want to omit the -m32 compiler switch and consider specifying a recognized value for the --host switch.


<<< Introduction || Obtaining a TSP solver (TSP Art) || Producing a stippled image with GImp >>>