Docsity

Tavelling salesman problem and solution, Essays (university) of Discrete Structures and Graph Theory

Partial preview of the text

Download Tavelling salesman problem and solution and more Essays (university) Discrete Structures and Graph Theory in PDF only on Docsity!

THE TRAVELING SALESMAN PROBLEM

by

Corinne Brucato

B.A., Sonoma State University, 2010

M.S., University of Pittsburgh, 2013

Submitted to the Graduate Faculty of

the Department of Mathematics in partial fulfillment

of the requirements for the degree of

Master of Sciences

University of Pittsburgh

UNIVERSITY OF PITTSBURGH

MATHEMATICS DEPARTMENT

This thesis was presented by

Corinne Brucato

It was defended on April 16, 2013 and approved by Dr. Jeffrey Paul Wheeler, University of Pittsburgh, Mathematics Dr. Beverly Michael, University of Pittsburgh, Mathematics Dr. Catalin Trenchea, University of Pittsburgh, Mathematics Dr. Anna Vainchtein, University of Pittsburgh, Mathematics

Thesis Advisor: Dr. Jeffrey Paul Wheeler, University of Pittsburgh, Mathematics

ii

THE TRAVELING SALESMAN PROBLEM

Corinne Brucato, M.S. University of Pittsburgh, 2013

Although a global solution for the Traveling Salesman Problem does not yet exist, there are algorithms for an existing local solution. There are also necessary and sufficient conditions to determine if a possible solution does exist when one is not given a complete graph. This paper gives an introduction to the Traveling Salesman Problem that includes current research. Additionally, the algorithms are used to find a route traveling through twenty US colleges. As well, we use the Geometric Algorithm to assign scouts for the Pittsburgh Pirates.

iv

TABLE OF CONTENTS

  • 1.0 THE PROBLEM STATED
  • 2.0 SOME BASIC GRAPH THEORY
    • 2.1 Basic Definitions
    • 2.2 Advanced Definitions
  • 3.0 THE HISTORY
  • 4.0 COMPLEXITY CLASSES
  • 5.0 SOME KNOWN ALGORITHMS
    • 5.1 Nearest-Neighbor Algorithm
    • 5.2 Closest Insertion Algorithm
    • 5.3 Geometric Algorithm
  • 6.0 EXISTENCE OF HAMILTONIAN PATHS AND CYCLES
    • 6.1 Complete Graphs
    • 6.2 Not Complete Graphs
  • 7.0 APPLICATIONS
    • 7.1 Colleges
      • 7.1.1 Nearest Neighbor and Closest Insertion
      • 7.1.2 Geometric Algorithm
    • 7.2 Pittsburgh Pirates
  • 8.0 CONCLUSION
  • BIBLIOGRAPHY
  • INDEX
  • 2.1 Tetrahedral Graph LIST OF FIGURES
  • 2.2 Cubical Graph
  • 2.3 Octahedral Graph
  • 2.4 Dodecahedral Graph
  • 2.5 Icosahedral Graph
  • 2.6 K
  • 2.7 K
  • 2.8 Bridge Graph
  • 2.9 Removed edge gf
  • 2.10 Removed edge gi
  • 2.11 Removed edge hi
  • 2.12 K
  • 2.13 Towns
  • 2.14 Complete Graph
  • 2.15 Highlight outer edges
  • 2.16 Convex Hull of the towns
  • 3.1 Dodecahedron Graph
  • 3.2 Sample Start
  • 4.1 Brute Force
  • 5.1 Start
  • 5.2 Stage
  • 5.3 Stage
  • 5.4 Stage
  • 5.5 Stage
  • 5.6 Stage
  • 5.7 Stage
  • 5.8 Final
  • 5.9 Start
  • 5.10 Stage
  • 5.11 Stage
  • 5.12 Final
  • 5.13 Nearest-Neighbor Pseudocode
  • 5.14 Start
  • 5.15 Stage
  • 5.16 Stage
  • 5.17 Stage
  • 5.18 Stage
  • 5.19 Stage 6a
  • 5.20 Stage 7a
  • 5.21 Stage 8a
  • 5.22 Stage 6b
  • 5.23 Stage 7b
  • 5.24 Stage 8b
  • 5.25 Closest Insertion Algorithm Pseudocode
  • 5.26 Stage
  • 5.27 Stage
  • 5.28 Stage
  • 5.29 Stage
  • 5.30 Stage
  • 5.31 Stage
  • 5.32 Stage
  • 5.33 Stage
  • 5.34 Stage
  • 5.35 Stage
  • 5.36 Stage
  • 5.37 Stage
  • 5.38 Stage
  • 5.39 Geometric Algorithm Pseudocode
  • 6.1 Each Degree is
  • 7.1 US Colleges ( c© 2013 Google, ©c 2013 Tele Atlas)
  • 7.2 Driving Distances Between Each College ( c© 2013 Google, ©c 2013 Tele Atlas)
  • 7.3 Nearest Neighbor and Closest Insertion Algorithms on Colleges
  • 7.4 Hamiltonian Cycle Using the Nearest Neighbor and Closest Insertion Algorithm ( c©
    • Google, ©c 2013 Tele Atlas)
  • 7.5 Stage
  • 7.6 Stage
  • 7.7 Stage
  • 7.8 Stage
  • 7.9 Stage
  • 7.10 Stage
  • 7.11 Stage
  • 7.12 Stage
  • 7.13 Stage
  • 7.14 Stage
  • 7.15 Stage
  • 7.16 Stage
  • 7.17 Final
  • 7.18 Geometric Algorithm on Colleges
  • 7.19 Hamiltonian Cycle Using the Geometric Algorithm ( c© 2013 Google, ©c 2013 Tele Atlas)
  • 7.20 NAME ( c© 2013 Google, ©c 2013 Tele Atlas)
  • 7.21 Group
  • 7.22 Group
  • 7.23 Group
  • 7.24 Group
  • 7.25 Group
  • 7.26 Group
  • 7.27 Group
  • 7.28 Group
  • 7.29 Group
  • 7.30 Group
  • 7.31 Group
  • 7.32 Group
  • 7.33 Stage 1: ( c© 2013 Google, ©c 2013 Tele Atlas)
  • 7.34 Stage
  • 7.35 Stage (n − 1)
  • 7.36 Stage n: ( c© 2013 Google, ©c 2013 Tele Atlas)

1.0 THE PROBLEM STATED

A traveling salesman wishes to go to a certain number of destinations in order to sell objects. He wants to travel to each destination exactly once and return home taking the shortest total route.

Each voyage can be represented as a graph G = (V, E) where each destination, including his home, is a vertex, and if there is a direct route that connects two distinct destinations then there is an edge between those two vertices. The traveling salesman problem is solved if there exists a shortest route that visits each destination once and permits the salesman to return home. (This route is called a Hamiltonian Cycle and will be explained in Chapter 2.) The traveling salesman problem can be divided into two types: the problems where there is a path between every pair of distinct vertices (no road blocks), and the ones where there are not (with road blocks). Both of these types of TSP problems are explained in more detail in Chapter 6.

Though we are not all traveling salesman, this problem interests those who want to optimize their routes, either by considering distance, cost, or time. If one has four people in their car to drop off at their respective homes, then one automatically tries to think about the shortest distance possible. In this case, distance is minimized. If one is traveling to different parts of the city using the public transportation system, then minimizing distance might not be the goal, but rather minimizing cost.

In the first case, each vertex would be a person’s home, and each edge would be the distance between homes. In the second case, each vertex would be a destination of the city and each edge would be the cost to get from one part of the city to the next. Thus, the Traveling Salesman Problem optimizes routes.

2.0 SOME BASIC GRAPH THEORY

Before presenting algorithms and conditions for when a locally optimal solution exists, some basic graph theory definitions are needed. For an extensive overview of Graph Theory, refer to [1] or [5].

2.1 BASIC DEFINITIONS

The platonic solids in figures 2.1 through 2.7 will be used to explain some basics of Graph Theory.

b

a

d^ c

Figure 2.1: Tetrahedral Graph

g

f

e

h

b

a

d

c

Figure 2.2: Cubical Graph

Definition 1. [Simple Graph]

A simple graph, G = (V,E), is a finite nonempty set V of objects called vertices (singular vertex) to- gether with a possibly empty set E of 2-element subsets of V called edges.

All of the figures in Chapter 2 are examples of simple graphs.

Definition 5. [Minimum and Maximum Degree of a Graph]

The maximum degree of a graph, G, is the greatest degree over all of the vertices in G. The minimum degree of a graph is the least degree over all of the vertices in G. The maximum degree is denoted ∆(G), while the minimum degree is denoted δ(G).

For example, let H 1 = Figure 2.5 and H 2 = Figure 2.3. Then, ∆(H 1 ) = 5, and δ(H 1 ) = 4, and ∆(H 2 ) = δ(H 2 ) = 4.

Definition 6. [Order and Size of a Graph]

The number of vertices in a given graph G, denoted |V(G)|, is called the order of G and is denoted Ord(G), or |G|. The number of edges in G, denoted |E(G)|, is called the size of G.

Figures 2.1 through 2.5 have order, 4, 8, 6, 20, and 12, and size 6, 12, 12, 30, and 30, respectively.

b

a c

h

i d

e

f

g l

k

j

Figure 2.5: Icosahedral Graph

Definition 7. [Complete Graph]

A graph in which every pair of distinct vertices is adjacent is called a complete graph. A complete graph of order n is denoted Kn.

4

Up to isomorphism, there is a unique complete graph of order n for each n. Figure 2.6 and Figure 2.7 are the complete graphs of order 2 and 3, respectively. The complete graph of order 4 is represented in Figure 2.1, and the complete graph of order 5 is represented in Figure 2.12.

Definition 8. [Walk]

For two, not necessarily distinct, vertices u and v in a graph G, a {u → v} walk W in G is a sequence of vertices in G, beginning with u and ending at v such that consecutive vertices in W are adjacent in G.

In Figure 2.1 an example of a walk from a to d is {a → b → c → d}, and a walk from d to c could be {d → b → a → b → a → d → a → b → c}. Note that a walk can pass through the same vertex or the same edge more than once.

Definition 9. [Closed Walk]

A walk whose initial and terminal vertices are the same is a closed walk.

For example, Figure 2.2 we have the following closed walks: {a → b → c → d → e → d → a}, {g → h → e → f → g}.

a b

Figure 2.6: K 2

d

c

e

Figure 2.7:^ K 3

Definition 10. [Path]

A walk in a graph G in which no vertex is repeated is called a path.

In Figure 2.3, {a → b → c → f } and {c → f → e → a → b} are paths, but {a → b → e → b → c} is not because vertex b is visited more than once. Note that in paths, since no vertex is repeated, it necessarily follows that no edge is repeated.

Definition 15. [Component]

The maximally connected subgraphs of a graph G are called components of G. i.e. H is a component of G if H is not a proper subgraph of any connected subgraph of G.

Definition 16. [Bridge]

An edge e = uv in a connected graph G whose removal results in a disconnected graph is called a bridge. a b

c e f g j i h

k l

m

n

o p

q

Figure 2.8: Bridge Graph

Figure 2.8 above is a connected graph with three bridges: edges gf , gi, and hi. Figures 2.9 through 2. are the disconnected graphs with edges gf , gi, and gh are removed, respectively. Notice, in each case, that once the edge is removed there are two components. For example, in Figure 2.9 one component contains the vertices {a, b, c, d, e}, and the other contains {f, g, h, i, j, k, l, m, n, o, p, q}.

a b

c e f g j i h

k l

m

n

o p

q

Figure 2.9: Removed edge gf

a b

c e f g j i h

k l

m

n

o p

q

Figure 2.10: Removed edge gi

a b

c e f g j i h

k l

m

n

o p

q

Figure 2.11: Removed edge hi

Definition 17. [Planar]

A graph is called planar, provided that it can be represented by a drawing in the plane in such a way that two edges intersect only at vertices. In other words, none of the edges in a planar graph cross over each other.

Notice that the complete graph of order 5 (Figure 2.12) does not have a planar representation. Figure 2.1 through Figure 2.7 are all planar graphs.

c

b

a

e

d

Figure 2.12: K 5

Definition 18. [Weighted Graph]

If each edge in a given graph G is assigned a real number (called the weight of the edge), then G is a weighted graph.

Definition 19. [The Join of a Graph]

The join G = G 1 ∧ G 2 of G 1 and G 2 has vertex set V (G) = V (G 1 ) ∪ V (G 2 ) and edge set

E(G) = E(G 1 ) ∪ E(G 2 ) ∪ {uv : u ∈ V (G 1 ), v ∈ V (G 2 )}

Definition 20. [Convex Set]

An object is convex if for every pair of points within the object, every point on the line segment that joins them is also within the object.

8

3.0 THE HISTORY

Although the exact origins of the Traveling Salesman Problem are unclear, the first example of such a prob- lem appeared in the German handbook Der Handlungsreisende - Von einem alten Commis - Voyageur for salesman traveling through Germany and Switzerland in 1832 as explained in [3]. This handbook was merely a guide, since it did not contain any mathematical language. People started to realize that the time one could save from creating optimal paths is not to be overlooked, and thus there is an advantage to figuring out how to create such optimal paths.

This idea was turned into a puzzle sometime during the 1800’s by W. R. Hamilton and Thomas Kirkman. Hamilton’s Icosian Game was a recreational puzzle based on finding a Hamiltonian cycle in the Dodecahe- dron graph as seen below.

Figure 3.1: Dodecahedron Graph

Figure 3.2: Sample Start

One person would put the numbered pegs, 1 through 5, in adjacent vertices on the dodecahedron graph. A second person would use the rest of the numbers, 6 through 20, in adjacent vertices after the vertex with the 5 in order to create a Hamiltonian Cycle that would end at the first peg labeled “1”. It is the case that every starting position has a solution. The game was not a big success, for children complained that the

10

game was too easy. For more information about this and other similar grames, refer to [3].

The Traveling Salesman Problem, as we know and love it, was first studied in the 1930’s in Vienna and Harvard as explained in [3]. Richard M. Karp showed in 1972 that the Hamiltonian cycle problem was NP- complete, which implies the NP-hardness of TSP (see the next section regarding complexity). This supplied a mathematical explanation for the apparent computational difficulty of finding optimal tours.

The current record for the largest Traveling Salesman Problem including 85,900 cities, was solved in 2006 as explained in [3]. The computers used versions of the branch-and-bound method as well as the cutting planes method (two seemingly elementary integer linear programming methods). The code used in these solutions is called Concorde and is available to view for free over the internet.

If one considers every single city in the world, and solve for the shortest Hamiltonian Cycle (hopefully using a computer), then one can win fame, fortune, and a cash prize.