An Algorithm for Solving the Traveling Salesman Problem

Similar documents
Two new variants of Christofides heuristic for the Static TSP and a computational study of a nearest neighbor approach for the Dynamic TSP

Solution of P versus NP problem

The Heuristic Strategy Implementation to the Hopfield -Tank TSP Neural Algorithm

Lower Bounds for Insertion Methods for TSP. Yossi Azar. Abstract. optimal tour. The lower bound holds even in the Euclidean Plane.

State Space Reduction for the Symmetric Traveling Salesman Problem through Halves Tour Complement

All 0-1 Polytopes are. Abstract. We study the facial structure of two important permutation polytopes

The Complexity of the Network Design Problem

1 The Traveling Salesman Problem

SOLVING TRAVELING SALESMAN PROBLEMS USING HEURISTIC LEARNING APPROACH

LEAST COST ROUTING ALGORITHM WITH THE STATE SPACE RELAXATION IN A CENTRALIZED NETWORK

Partha Sarathi Mandal

Algorithms and Experimental Study for the Traveling Salesman Problem of Second Order. Gerold Jäger

1 The Traveling Salesman Problem

Preemptive Scheduling of Equal-Length Jobs in Polynomial Time

ALGORITHM SYSTEMS FOR COMBINATORIAL OPTIMIZATION: HIERARCHICAL MULTISTAGE FRAMEWORK

Improvement heuristics for the Sparse Travelling Salesman Problem

A NEW HEURISTIC ALGORITHM FOR MULTIPLE TRAVELING SALESMAN PROBLEM

HEURISTIC ALGORITHMS FOR THE GENERALIZED MINIMUM SPANNING TREE PROBLEM

(Refer Slide Time: 01:00)

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Heuristic Approaches to Solve Traveling Salesman Problem

Graph Theory. Probabilistic Graphical Models. L. Enrique Sucar, INAOE. Definitions. Types of Graphs. Trajectories and Circuits.

Ruled Based Approach for Scheduling Flow-shop and Job-shop Problems

A Two-Dimensional Mapping for the Traveling Salesman Problem

OPTIMIZATION OF DELIVERIES FROM DISTRIBUTION POINTS

Design and Analysis of Algorithms

Polynomial time approximation algorithms

MANUFACTURING CELL FORMATION USING SIMILARITY COEFFICIENTS AND A PARALLEL GENETIC TSP ALGORITHM: FORMULATION AND COMPARISON

HEURISTIC ALGORITHMS FOR THE SINGLE VEHICLE DIAL-A-RIDE PROBLEM

Complete Local Search with Memory

A Linear Time Algorithm for the Minimum Spanning Tree Problem. on a Planar Graph. Tomomi MATSUI. (January 1994 )

Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm

Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij

Traveling Salesperson Problem (TSP)

Improving the Held and Karp Approach with Constraint Programming

State Space Reduction for the SYMMETRIC Traveling Salesman Problem through Halves Tours Complement

Job Grouping with Minimum Setup in PCB assembly

2 Approximation Algorithms for Metric TSP

BI-OBJECTIVE EVOLUTIONARY ALGORITHM FOR FLEXIBLE JOB-SHOP SCHEDULING PROBLEM. Minimizing Make Span and the Total Workload of Machines

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas

Javier Cordova. Abstract. In this paper the following problem is considered: given a root node R in a

Chapter 9 Graph Algorithms

L3 Network Algorithms

Lecture 3. Brute Force

Chapter 9 Graph Algorithms

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

A combination of clustering algorithms with Ant Colony Optimization for large clustered Euclidean Travelling Salesman Problem

Traveling Salesman Problem. Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

Attractor of Local Search Space in the Traveling Salesman Problem

ACO and other (meta)heuristics for CO

Improving Combinatorial Auctions for Multi-Robot Exploration

Report on article The Travelling Salesman Problem: A Linear Programming Formulation

Assignment 3b: The traveling salesman problem

A simple exact separation algorithm for 2-matching inequalities

Research Notes for Chapter 2 *

Using Python to Solve Computationally Hard Problems

Optimal tour along pubs in the UK

JOURNAL OF OBJECT TECHNOLOGY

to the Traveling Salesman Problem 1 Susanne Timsj Applied Optimization and Modeling Group (TOM) Department of Mathematics and Physics

Effective Tour Searching for Large TSP Instances. Gerold Jäger

Combining Two Local Searches with Crossover: An Efficient Hybrid Algorithm for the Traveling Salesman Problem

A Polynomial-Time Deterministic Approach to the Traveling Salesperson Problem

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

Effective Tour Searching for Large TSP Instances. Gerold Jäger

Evolutionary Computational Approaches to Solving the Multiple Traveling Salesman Problem Using a Neighborhood Attractor Schema

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

arxiv: v2 [cs.cc] 29 Mar 2010

Course Introduction. Scheduling: Terminology and Classification

Assignment No 2 (Group B)

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

The NP-Completeness of Some Edge-Partition Problems

- ;; NS ; EbEI If P R~tE Ro

Job Shop Scheduling Problem (JSSP) Genetic Algorithms Critical Block and DG distance Neighbourhood Search

Recent PTAS Algorithms on the Euclidean TSP

and 6.855J Lagrangian Relaxation I never missed the opportunity to remove obstacles in the way of unity. Mohandas Gandhi

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

A Memetic Algorithm for the Generalized Traveling Salesman Problem

Introduction to Approximation Algorithms

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions

Lecture 1. 2 Motivation: Fast. Reliable. Cheap. Choose two.

Travelling salesman problem using reduced algorithmic Branch and bound approach P. Ranjana Hindustan Institute of Technology and Science

Adaptive Tabu Search for Traveling Salesman Problems

Incremental Assignment Problem

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

A COMPARATIVE STUDY OF FIVE PARALLEL GENETIC ALGORITHMS USING THE TRAVELING SALESMAN PROBLEM

6 ROUTING PROBLEMS VEHICLE ROUTING PROBLEMS. Vehicle Routing Problem, VRP:

Rearrangement of DNA fragments: a branch-and-cut algorithm Abstract. In this paper we consider a problem that arises in the process of reconstruction

Theorem 2.9: nearest addition algorithm

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

Traveling in Networks with Blinking Nodes

PBW 654 Applied Statistics - I Urban Operations Research. Unit 3. Network Modelling

1 The Traveling Salesperson Problem (TSP)

A Theoretical Framework to Solve the TSPs as Classification Problems and Shortest Hamiltonian Path Problems

CS 440 Theory of Algorithms /

Depth-First Branch-and-Bound versus Local Search: A Case Study

OPERATIONS RESEARCH. Transportation and Assignment Problems

Constraint Satisfaction Problems

Design and Analysis of Algorithms CS404/504. Razvan Bunescu School of EECS.

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

Transcription:

JKAU: Eng. Sci.. vol. 4, pp. 117 122 (1412 A.H.l1992 A.D.) An Algorithm for Solving the Traveling Salesman Problem M. HAMED College ofarts and Science, Bahrain University, [sa Town, Bahrain ABSTRACT. The main objective of the paper is to present an algorithm for finding a solution to the traveling salesman problem. The solution found by the algorithm being an optimal one or not, depends on the values ofthe elements of the cost matrix. The algorithm is described and its time complexity is calculated and compared to other algorithms in the literature. It is shown that the proposed algorithm is efficient as it finds the solution in shoner time if compared to other algorithms. I. Introductioo The ordinary traveling salesman problem (TSP) is formulated in the literature[j1 as: "Finding the tour with minimum cost for passing through each of n cities exactly once, starting from and ending at an arbitrary city". This problem is classified as being NP-complete[2l. Actually, there are several variations of the TSP, e.g., timedependent TSPfJAJ, and stochastic TSPI5J. Each variation lead to a rather different problem. Our main concern here is the ordinary TSP. Exhausti\'t: search for an optimal solution by trying all possible permutations is a method which is not referred to any specific author. The time of such an approach is o (n!) since we must consider (n - I)! different permutations, and each permutation takes 0 (n) time to evaluate. Another algorithm due to Held and Karpl6! gives the optimal solution in time O(n 2 2 n ). This algorithm uses dynamic programming techniques. Other algorithms in the literature do not give an optimal solution, but rather they give a "good" solution based on heuristics. Examples of such heuristics are found in KruskalPI and Lin & Kernighanl8J. When comparing different al- 117

118 M. Hamed gorithms of solving the problem, it is necessarry to consider onlythose ones that yield an optimal solution. The time complexity of the proposed algorithm istlo [2 n / 2 + m log2 _m ]. The idea of the algorithm depends on isolating the needed elements of the cost matrix, sorting them in ascending order, then synthesizing the tour in such a way to include minimum values and exclude maximum values of the cost matrix. It should be noted that the solution found by the algorithm mayor may not be an optimal one. This is dependent upon the values of the cost matrix. The algorithm checks whether the given solution is seen to be an optimal one or there might be a pos.sibility to be a near-optimal solution. This is realized through the satisfaction of some relationship between some elements of the cost matrix. In section 2 of the paper, the proposed algorithm is described..also the time complexity of the algorithm is calculated and compared to other algorithms in the literature. 2.1. General Principles 2. The Proposed Algorithm The principles according to which the algorithm is designed are: 1 - As the cost matrix is symmetric, then only the elements of the upper triangle are needed. 2 - -The minimum cost tour is synthesized basically from the first n/2 low-value cost elements which incorporate k nodes, plus some additional elements that incorporate r remaining nodes. Permutations are tried for different possible positions of the basic and remaining nodes. 3 - As the choice of the start city of the tour is immaterial, then the number of permutations can be reduced as s.everal tours may have the same cost elements but differ only in the start point. 4 - The solution is exactly an optimal one if Sl < S2. 2.2 Description ofthe Algorithm The input to the algo~ithmis an n x n cost matrix C. As the cost matrix is symmetric (c ij = c j ) and diagonal el~ments (c i ) are zeros, then the number of unrepeated non-zero elements (upper ttiangle) is m = [n x (n - 1)/2]; call them effective elements. It should be noted'that each element of the matrix C is an arc whose head.and tail nodes are cities (row and column). The first step of the algorithm is to sort the effective elements in ascending order and put them in vector A. The correspondinghead and tail nodes are put in vectors S and E respectively. Then, a check is made to see whether the solution is an optimal one. The next step is to synthesize the tour with minimum cost by including the first [n/2] elements of vector A and excluding the last [n/2] elements. The maximum number of tours to be synthesized is NMAX = 2/ n / 2 J.

An Algorithm for Solving... 119 The algorithm works as follows: 1 - Build vector A from the upper triangle elements of the cost matrix C (without diagonal elements). While building vector A, the other two vectors Sand E are filled with start and end cities of the corresp...onding cost elements respectively. Thus element Si represents the start city of the cost element Ai' while element E i represents the end city of A~.. 2 - Sort the elements of vector A in ascending order. This can be done using Quicksort[9). Note that vectors Sand E have to suffer from corresponding rearrangements. 3 - Check whether the given solution is seen to be an optimal one or there is a possibility to be a near-optimal solution. 4 - Use the first nl2 elements of Sand E to build the first part of the tour with minimum cost. The main idea here is to group the cities' numbers of Sand E into clusters. A cluster is a set of city numbers that can be considered as a part of the tour. The arcs resulting from considering each two adjacent cities in the cluster are important in finding the tour with minimum cost. A cluster is built according to the following procedure : a - Put the first element of both Sand E into the first two elements of R. b - Use i to point to the next element of Sand E. Assume that k is the number of elements in R. Search for either E i or Si to be equal to R j U== 1, 2,..., k) if yes, then the element of Si (or E) would be added to R in the proper position (of an existing cluster); otherwise add both elements Si and E i at the rear end of R (incrementing k) to make a new cluster. Note that if element j of R was used before in one of the clusters as indicated by the corresponding element j of vector U, then it cannot be used again in a new cluster. 5 - Synthesize the tour. The tour is synthesized by grouping different clusters, together with remaining nodes. As there are at most [n/2 J + 1 alternative (clusters + remaining nodes), and each alternative has at most two different permutations, then the maximum number of permutations is 21 n / 2 J + 1 Because of the fact that the tour may arbitrarily start at any city, we will find that the maximum number of permutations can be reduced to 2I n / 2 } + J /2 (i. e., 2[n/2]) only (half of the permutations are repeated with different start city). 2.3 The Optimal Solution The condition for an optimal solution is that 51 < S2. Proof - From the definition of the tnatrix C and vector A, the label of each node is mentioned in the set NS U NE an equal number of times equal to n x (n - 1) x 2 -;- n == (n - 1) times. 2

M. Hamed - The maximum number of times a node is mentioned in the excluded part of A (R4) is nl2 (number of elements in R4). - As (n - 1) is > n12, then a tour can be synthesized without using the excluded part of A (R4). - As the set Rl contains minimum values, then the worst case for a tour including elements of Rl and does not include elements of R4 is that one consisting of elements in Rl U R3, giving a tour of cqst Sl. - On the other hand, the best case for a tour that does not include elements of R1 is that tour consisting of elements in R2, giving a tour of cost S2. - Thus if 51 < 52 then the worst case of a tour including elements in Rl is better than the best case of a tour where elements of R1 are excluded. This proves that the optimal solution is obtained when 51 < 52. 2.4 Time Complexity 5 I If n is odd, then: minimum value of k =: n - 1- (n - 1) 12-1 & maximum value of k =: n - 1 If n is even l then: minimum value of k =: n - (ni2)-1 & maximum value of k == 11 remaining nodes == {r} == {n} - {k} number of slots =: t =: number of clusters =: k Time Complexity of the proposed algorithm 2l n / 2 ] + m log2 m Time Complexity of Exhaustive Search Algorithm == O(n!) Time Complexity of Dynamic Programming Algorithm =: 0(n 2 2 11 ) In order to illustrate the difference in time between the different algorithms, consider the case where n == 20 : The time of Exhaustive Search Algorithm is == 2.432902 * 10lH The time of Dynamic Programming Algorithm is == 41,943,040 The time of the proposed algorithm is == 4800 Symbols A vector of needed eleinents (dimension m). m number of needed elements [ == n( n - 1) / 2]. 5 vector of heads of arcs. E vector of tails of arcs. R a temporary vector for building the tour. U usage indicator vector. t number of clusters. k number of nodes corresponding to the first (n - 1) /2 low-value elements ofa. r remaining nodes ( == n - k). Rl the set ofthe first n/2 elements ofvector A. R2 the set ofn elements following Rl.

An Algorithm for Solving... 121 R3 the set ofn/2 elements just preceding R4. R4 the set ofthe last n/2 elements ofa. Sl sum ofelements ofrl and R3. S2 sum ofelements of R2. NS set of nodes mentioned in vector S. NE set of nodes mentioned in vector E. References [11 Aho, A.A., Hopcroft, J.E. and Ullman, J.D., Data Structures and Algorithms, Addison-Wesely, Reading, Mass., pp. 323-335 (1983). [2] Garey, M.R. and Johnson, D.S., Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman, pp. 206-218 (1979). [3] Hadley, G., Nonlinear and Dynanlic Programming, Addison-Wesely, Reading MA (1964). [4] Picard, J.e. and Queyranne, M., The time-dependent traveling salesman problem and its application to the tardiness problem in one-machine scheduling, Oper. Res., 26: 86-110 (1978). rs] Lawler, E.L., Lenstra, J.K., Rinnooy Kan, A.H.G. and Shmoys, D.B. (eds.), The Traveling Salesman Problem: A Guided Tour ofcombinatorial Optimization, John Wiley, pp. 31-36 (1985). l6] Held, M. and Karp, R.M., A dynamic programming approach to sequencing problems, SIAM J. Appl. Math. 10: 196-210 (1962). r7] Kruskal, J.B. Jr., On the shortest spanning subtree of a graph and the traveling salesman problem. Proc. AMS 7 (1): 48-50 (1956). (8] Lin, S. and Kernighan, B.W., A heuristic algorithm for the traveling salesman problem, Oper. Res. 21: 498-516 (1973). (91 Knuth, D.E., The Art ofcomputer Prografnming, vol. 3. Addison-Wesely, Reading MA, pp. 73-180 (1973).

122 M. Hamed ~l>~~ ~~, - ~~J..o - ~~,w~ ~ ~j).,>- J>- ~~ J ~\ Ih ~ ~)\ ~~\ ~. ~\ \~l ~\j\ j.j-\ ~ \j)~\ Q,.4~ ~wu\ j.j-\ ~~ 0i ;lj:-1 ~J. J~I ~yl ~I Ih '-?Y..J. 0..u1 ~.;-J\ ~LS:; J:' ~\ ~\ ~ bj?\ ~ ~)1; ~\ ~J ;";J~J. ~ \j)\j\ ~}\ ~ ~L:>-J \j)~ ~l5 ~J ~ J jj--\ Jl ~ ij).fl\ Ih 0i ~ ~~ ~ ~\ oh j.j- 4jJ~\ ~~j)~\ ~. G\~~~i~j