A Comparative Analysis of Traveling Salesman Heuristic

A Comparative Analysis of
Traveling Salesman Heuristic
Implementations in GIS
GIS Masters Project - Summer 2006
Gabriela Voicu
Project Outline (I)
1. Introduction


Define Traveling Salesman Problem (TSP)
Introduce Geographic Information Systems (GIS)
as a tool for solving the TSP
2. Research Questions
3. Literature Review








Who came up with the problem
Impact of technological progress
Mathematical Formulation of the TSP
TSP as a Combinatorial Optimization Problem
Various Solution Procedures for the TSP
Generalization of the problem and variations
TSP implementations within GIS
Lack of vendor specifications of methods used
Project Outline (II)
4. Data Sources
Network dataset - street centerlines, City of Mesquite
School bus routing context




School attendance zones - Mesquite Independence School District (MISD)
Students information - that must be transported to the school
5. Methodology


Implement two of the algorithms that have appeared in the literature
review within ArcGIS using Visual Basic 6.0 Programming language
Perform tests across four different software packages: ArcView 3.2
and ArcGIS 9.1with Network Analyst extension, ArcLogistics Route,
GeoMedia with Transportation Manager extension and the two
implemented algorithms
6. Conclusions


All GIS implementations of the TSP studied here often generate suboptimal solutions even for small number of instances (12)
Depending on the scope of the application, the current GIS
implementations may prove not to be the appropriate approach
1. Introduction (I)
What is TSP?

The TSP is a classic tour problem in which a hypothetical salesman
must find the most efficient sequence of destinations in his territory,
stopping only once at each, and ending up at the initial starting location

What is the mathematical structure of TSP?


Graph where the cities are
the nodes (vertices) of the
graph
Find the cycle of minimum
cost that visit each of the
vertices
(S.S. Skiena 1997)
1. Introduction (II)

GIS as a tool for solving the problem


Integration of GIS with mathematical graph theory
Finding the most efficient route in which to visit locations in
a network
3
1
3
1
2
6
6
5
4


2
5
4
Methods used in GIS to solve the TSP are called heuristics
The term heuristic is used for algorithms which find solutions
among all possible tours, but they do not guarantee that the
best will be found
2. Research Questions

What are the heuristics for the TSP that have
appeared in the literature?

What are the characteristics of these heuristics and the
consequences of using them?

Do we know anything about the optimality of the
solutions that they will provide?

Can we determine which (if any) of these heuristics
have been implemented in GIS software?

How do these heuristics perform on a test database?
3. Literature Review
TSP origins

1700s the Knight’s Tour problem

1800s Sir William Rowan Hamilton (graph theory)

1832 first published document that mentioned the TSP, a german manual

1920’s Karl Menger mentioned the TSP in Vienna

1930’s introduced in the United States at Harvard and Princeton
Universities by Whitney Hassler (A. Schrijver 2004)

1940s M Flood popularized the TSP at the RAND Corporation in California

In 1954, the most important progress on the TSP was made by Rand
researchers: Dantzig, Fulkerson and Johnson when they developed a new
method for solving the TSP, the Cutting Plane method, which became a
prototype in linear programming (Hoffman A. J. and Wolfe P. 1985)
Chart showing solutions of increasingly
complex scenarios throughout time
Milestones in the solution of the TSP (Cook 2002), (Hoffman K 1996)
Mathematical Formulation of TSP (S. Vajda 1961)
The objective function is to minimize
the sum of all distances of all of the selected elements of the tour
n
i, j and k
t
Xijt
= the number of cities to be visited
= indices of cities that can take integer values from 1 to n
= the time step in the route between the cities
= 1 if the edge of the network from i to j is used in step t of the
route, and 0 otherwise
d ij
= the distance or cost from city i to city j
The variables are subject to the following constraints:
For all cities, there is just one another city
which is being reached from it, at some time
For all cities, there is only one another city
from which it is being reached, at some time
When a city is reached at time t,
it must be left at time t + 1
For all values of t, exactly one arc
must be traversed
TSP as a Combinatorial
Optimization Problem

If n is the number of cities then (n-1)! is the total number
of possible routes



n=5
n=10
n=20
120 possible routes
3,628,800 possible rotes
2,432,902,008,176,640,000 possible routes

TSP is a NP-Complete combinatorial optimization
problem = non-deterministic polynomial time

Scientific challenge for solving TSP

$1 million prize for solving the TSP as one
representative problem of a larger class of
NP-complete combinatorial optimization
problems has been offered by Clay
Mathematics Institute of Cambridge (CMI)
Various Solution Procedures
for the TSP
Exact Solution Procedures – Integer Programming

Exact approaches require algorithms that generate both a lower
bound and an upper bound on the true minimum value of the
problem instance

The standard technique for obtaining lower bounds on the TSP
problem is to use a relaxation that is easier to solve than the original
problem (Hoffman K. 1996)

Cutting Plane
Procedure used to find integer solutions of a linear program

Branch and Bound
Algorithmic technique to find the optimal solution by keeping the best
solution found so far

Simplex
Method combined with Branch and Bound to solve the problem by
systematically moving from one solution to another until the optimal is
found, unable to solve large instances
Approximate Solution Procedures
Constructive Heuristics
Algorithms that try to build up feasible solutions step by step
and then stop when a solution is found and never try to
improve upon its solution (Hoffman K 1996)





Nearest Neighbor
Greedy heuristic
Minimum Spanning Tree
Insertion heuristics
Improvement Heuristics
Algorithms that start with an initial feasible solution and
successively improve it through a sequence of exchanges

(Evans J. 1992)




2-opt algorithm
3-opt algorithm
Lin-Kernighan algorithm
Iterated Lin-Kernighan
Metaheuristics
Set of concepts that can be used to define heuristic methods
and to guide already existing heuristics to find their way out
of local optima by continuing the search for better areas of
the solution space (Voudouris and Tsang 1999)


Neural Networks, Genetic Algorithms, Simulated Annealing, Ant
Colony, etc
Local Search (Neighborhood Search)



Iterative search procedure that, starting from an initial
feasible solution, progressively improves it by applying a
series of local modifications or moves
At each iteration, the search moves to an improving feasible
solution
The search terminates when it encounters a local optimum
with respect to the transformations that it considers (Gendreau
2003)
Tabu Search

Essential feature (use of memory) = tabu list

To improve the efficiency of the exploration process, Tabu
Search keeps track not only of the best solution visited so far
but also of information related to the itinerary

As soon as non-improving moves are possible, the risk of
cycling appears and the scope of tabu list is to forbid moves
which might lead to recently visited solutions

Best improvement local search is performed only amongst
those not included in the tabu list (Voudouris and Tsang 1999)



tabus may sometimes prohibit attractive moves
add criteria that will allow to cancel tabus = aspiration criteria
aspiration criteria consists in allowing a move, if it results in a
solution with an objective value better than that of the current
best-known solution (Gendreau 2003)
Generalization of TSP –
the multiple TSP
The multiple traveling salesman problem
(mTSP) is a generalization of the TSP, with
more than one salesman



Given a set of cities, with m salesmen located at a single location depot city and intermediate cities as remaining cities that are to be
visited, the mTSP consists of finding tours for all m salesmen, who
all start and end at the depot, such way that each intermediate city
is visited exactly once and the total cost of visiting all cities is
minimized (Bektas 2006)
The problem of scheduling buses is treated as
a variation of the multiple TSP with additional
side constraints (Angel R. D. 1972)
TSP Implementations within GIS
ArcGIS Network Analyst – Tabu Search





Computes an origin-destination cost matrix
Applies an insertion algorithm to construct an initial solution
At each step, the insertion algorithm inserts the least-cost
unvisited stop into the current partial solution
The initial solution is then improved upon by a tabu search
process, where an existing solution is augmented by
performing two-optimal and three-optimal moves (Rice 2006)
ArcLogistics Route – Tabu Search




Constructs an initial route
Assigns stops to each route in the best sequence
Stops from one route are moved to another to try to find a
best assignment of stops to routes
4. Data Sources
5. Methodology
Simplifying Assumptions
U-Turn Allowed




ArcLogistics Route - no option or way of restricting U-Turns
ArcView 3.2 - turn table, via Avenue scripting language, but it does not seem
to work on restricting a turn on the same edge
The Integraph’s GeoMedia Transporter - allowing or restricting U-turns globally
– not consistent
ArcGIS with the Network Analyst 9.1 extension - option of allowing or
restricting U-Turns globally but the algorithm implemented is written in such a
way, that backtrack is allowed and no matter what option the user checks, UTurns are still allowed in the network – solution is CurbApproach
Enumerative Approach Implementation (I)

Construction of all (n-1)! possible solutions for the problem

Create a function that builds an array containing each possible route starting
and ending at the initial location (school)

To construct all possible ordered combinations the method applied is to pass
two arrays to a function that has 2 arguments:



the function calls itself recurrently, trying to increase the entry array size by one
and adding to it a location that is not contained yet, in any particular tour




one array containing the initial location (1)
a second array containing all the stops (1,2,3,4)
at the first step the function will return: (1,2), (1,3), (1,4)
at the next step, the function will return the following: (1,2,3), (1,2,4), (1,3,2),
(1,3,4), (1,4,2), (1,4,3)
at the next step the returned array would contain all six possible combinations:
(1,2,3,4); (1,2,4,3); (1,3,2,4); (1,3,4,2); (1,4,3,2) and (1,4,2,3)
when the total number of locations in each tour equals the number of locations,
the loop ends and the result contains all (n-1)!, possible combinations, each
representing a valid tour
Enumerative Approach Implementation (II)




Iterate through all of the n2 of the distances to find the matching
segment (line: 12, 13, 14, etc) in each of the ordered stops array
When a match is found, the total distance for that particular tour is
increased with the matching segment distance
After traversing the last tour, each of the arrays will contain a number of
segments equal to the number of locations and their corresponding total
distance
Loop through all of the results and choose the shortest tour as the
optimal solution
Nearest Neighbor Algorithm Implementation

Uses the Network Analyst Closest Facility Solver to obtain all
the distances between sets of stops (OD Matrix)

It uses each current location as origin and it finds the closest
neighbor not traversed yet as destination

The location found as a destination not yet traversed becomes
the next origin and it keeps checking all the stops till the last
one, when it returns to the departing location

Any of the two approaches implemented return an array of lines
defining a valid tour and the last step is to iterate through all the
lines returned and draw only the ones existing in the solution
Enumerative
(Brute Force)
Implementation
Nearest Neighbor
Implementation
Comparative Analysis of Results

Optimal solutions were provided using Simplex software (with
Optimization Programming Language) up to 26 stops

All GIS implementations of the problem start giving sub-optimal
solutions when size 12 of the problem is being reached

ArcLogisticsRoute can be considered a special case since it’s
using its own network dataset

Nearest Neighbor algorithm is scaled as the worse approach (18%)

A meaningful comparison can be made between ESRI and
Intergraph when Integraph proves its superiority in the solutions
within 5%
Running Time
As
the number of stops increases, the computational time increases in an
extremely rapid manner (asymptotic increase)
6. Conclusions

This research concludes that GIS implementations of the TSP tested
often generate suboptimal solutions

As soon as the problem reaches size 12, the studied GIS
implementations start giving approximate solutions within 14% above
the optimal solution

Depending on the scope of the application, the current GIS
implementations may prove not to be the appropriate approach,
especially when real world applications involve significant costs

In contrast, optimal solutions can be generated with desktop linear
programming software (up to 26)

This research suggests that advancements in the solution of the TSP
could benefit from the implementation of GIS and optimal solution
software
7. References (I)










Angel R. D., C. W. D., Noonan R. and Whinston A. (1972). "Computer assisted school bus
scheduling." Management Science 18: 279 - 288
Applegate D., B. R., Chvtal V., and Cook W. (1998). "On the Solution of Traveling Salesman
Problems." Documenta Mathematica Extra Volume ICM(III): 645-656
Bektas, T. (2006). "The multiple traveling salesman problem: an overview of formulations and
solution procedures." Omega, Volume 34, Issue 3, June 2006, Pages 209-219 34(3): 209219
Cook, W. J. (2001, apr 2005). "The Traveling Salesman Problem ", from
http://www.tsp.gatech.edu/methods/talks/cook01/slide3.html
Cook, W. J. (2002, jan 2005). "Milestones in the Solution of TSP Instances." from
http://www.tsp.gatech.edu/history/milestone.html
Dantzig G, F. D. R., Johnson S. M. (1954). "Solution of a Large Scale Traveling Salesman
Problem." Journal of the Operations Research Society of America 2: 393 - 410
Danztig G (1949). Application of the simplex method to a transportation problem. Acticity
Analysis of Production and Allocation - Proceedings of a Conference, Chicago, Illinois Wiley
- New York
Evans J., M. E. (1992). Optimization Algorithms for Networks and Graphs. New York, Basel,
Hong Kong, Marcel Dekker, Inc.
Flood, M. M. (1956). "The traveling-salesman problem." Operations Research 4: 61-75
Gendreau, M. (2003). An Introduction to Tabu Search. Handbook of Metaheuristics. G. A. K.
Fred W Glover. Boston, Dordretcht, London, Springer
7. References (II)










Glover, F. (1990). "Tabu Search: A Tutorial." Interfaces 20: 74-94
Hoffman A. J. and Wolfe P. (1985). History. The Traveling Salesman Problem - A Guided Tour
of combinatorial Optimization. Chichester, John Wiley & Sons: 1-17
Hoffman K, P. M. (1996). "Traveling Salesman Problem." Encyclopedia of Operations
Research: 76-83.
J. R. Evans, E. M. (1992). Optimization Algorithms for Networks and Graphs. New York,
Basel, Hong Kong, Marcel Dekker, Inc.
Lawler, E. S. (2000). Combinatorial Optimization - Networks and Matroids, Dover
Publications
Marinakis, Y., A. Migdalas, et al. (2005). "A Hybrid Genetic - GRASP Algorithm Using
Lagrangean Relaxation for the Traveling Salesman Problem." Journal of Combinatorial
Optimization 10(4): 311-326
Schrijver, A. (2004). "On the history of combinatorial optimization." from
http://homepages.cwi.nl/~lex/files/histco.pdf
Skiena, S. S. (1997). "The Algorithm Design Manual." from
http://www2.toki.or.id/book/AlgDesignManual/BOOK/BOOK/BOOK.HTM
Vajda S. (1961). Mathematical Programming Addison - Wesley Company, Inc.
Voudouris, C. and E. Tsang (1999). "Guided Local Search and Its Application to the Traveling
Salesman Problem." European Journal pf Operational Research 113(2): 469-499
Let’s assume that the optimal tour for n=4 is
1=>3=>4=>2=>1
j=1
j=2
j=3
j=4
i=1 d11*0
d12*0
d13*1
d14*0
Sxijt = 1
i=2 d21*1
d22*0
d23*0
d24*0
Sxijt = 1
i=3 d31*0
d32*0
d42*1
d33*0
d43*0
d34*1
d44*0
Sxijt = 1
Sxijt = 1
i=4 d41*0
Sxijt = 1 Sxijt = 1 Sxijt = 1 Sxijt = 1