Skip to main content
Log in

A distance matrix based algorithm for solving the traveling salesman problem

  • Original Paper
  • Published:
Operational Research Aims and scope Submit manuscript


This paper presents a new algorithm for solving the well-known traveling salesman problem (TSP). This algorithm applies the Distance Matrix Method to the Greedy heuristic that is widely used in the TSP literature. In particular, it is shown that there exists a significant negative correlation between the variance of distance matrix and the performance of the Greedy heuristic, that is, the less the variance of distance matrix among the customer nodes is, the better solution the Greedy heuristic can provide. Thus the Distance Matrix Method can be used to improve the Greedy heuristic’s performance. Based on this observation, a method called Minimizing the Variance of Distance Matrix (MVODM) is proposed. This method can effectively improve the Greedy heuristic when applied. In order to further improve the efficiency, a heuristic that can quickly provide approximate solutions of the MVODM is developed. Finally, an algorithm combining this approximate MVODM method and Greedy heuristic is developed. Extensive computational experiments on a well-established test suite consisting of 82 benchmark instances with city numbers ranging from 1000 to 10,000,000 demonstrate that this algorithm not only improves the average tour quality by 40.1%, but also reduces the running time by 21.7%, comparing with the Greedy algorithm. More importantly, the performance of the proposed approach can beat the Savings heuristic, the best known construction heuristic in the TSP literature.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10

Similar content being viewed by others


  • Albareda-Sambola M, Fernández E, Laporte G (2014) The dynamic multiperiod vehicle routing problem with probabilistic information. Comput Oper Res 48:31–32

    Article  Google Scholar 

  • Applegate D, Bixby R, Chvatal V (1999) Finding tours in the TSP, vol 12. Technical report TR99-05, Department of Computational and Applied Mathematics, Rice University, pp 369–433

  • Applegate D, Bixby R, Chvatal V (2006) The traveling salesman problem: a computational study. Princeton University Press, Princeton

    Google Scholar 

  • Arthur JL, Frendeway JO (1985) A computational study of tour construction procedures for the traveling salesman problem, vol 12. Research report, Oregon State University, Corvallis, pp 568–581

  • Beardwood J, Hammersley JM (1959) The shortest path through many points. Cambridge Philosophical Society, Cambridge

    Book  Google Scholar 

  • Bentley JL (1990) K-d trees for semidynamic point sets. In: Proceedings of 6th annual ACM symposium on computational geometry, vol 126, pp 187–197

  • Bentley JL (1992) Fast algorithm for geometric traveling salesman problem. Oper Res Soc Am 4:387–412

    Google Scholar 

  • Bentley JL, Saxe JB (1980) An analysis of two heuristic for the Euclidean traveling salesman problem. In: 18th annual Allerton conference on communication, vol 12, pp 369–433

  • Bertsimas D, Grigni M (1989) Worst-case examples for the space-filling curve heuristic for the Euclidean traveling salesman problem. Oper Res Lett 8:241–244

    Article  Google Scholar 

  • Bland RG, Shallcross DF (1989) Large traveling salesman problems arising from experiments in X-ray crystallography: a preliminary report on computation. Oper Res 8:125–128

    Google Scholar 

  • Chiang H, Chou Y, Chiu C, Kuo S, Huang Y (2014) A quantum-inspired tabu search algorithm for solving combinatorial optimization problems. Soft Comput 18:1771–1781

    Article  Google Scholar 

  • Christofides N (1976) Worst-case analysis of a new heuristic for the traveling salesman problem, vol 4. Technical report 388, GSIA, CarnegieMellon University, pp 387–412

  • Clarke G, Wright JW (1964) Scheduling of vehicles from a central depot to a number of delivery points. Oper Res 12:568–581

    Article  Google Scholar 

  • Cordeau JF, Desaulniers G, Desrosiers J, Solomon MM (2002) The VRP with time windows. Society for Industrial and Applied Mathematics, Philadelphia

    Book  Google Scholar 

  • Dantzig GB, Ramzer KB (1959) The truck dispatch problem. Oper Res 12:80–91

    Google Scholar 

  • Deng W, Chen R, He B, Liu Y, Yin L, Guo J (2012) A novel two-stage hybrid swarm intelligence optimization algorithm and application. Soft Comput 16:1707–1722

    Article  Google Scholar 

  • Gamboa D, Rego C, Glover F (2006) Implementation analysis of efficient heuristic algorithms for the traveling salesman problem. Comput Oper Res 33:1154–1172

    Article  Google Scholar 

  • Held M, Karp RM (1970) The traveling salesman problem and minimum spanning trees. Oper Res 18:1138–1162

    Article  Google Scholar 

  • Helsgaun K (2000) An effective implementation of the Lin–Kernighan traveling salesman heuristic. Eur J Oper Res 126:106–130

    Article  Google Scholar 

  • Jager G, Dong C, Goldengorin B, Molitor P, Richter D (2014) A backbone based TSP heuristic for large instances. J Heuristics 20:107–124

    Article  Google Scholar 

  • Johnson DS, McGeoch LA (1997) The traveling salesman problem: a case study in local optimization. Wiley, New York

    Google Scholar 

  • Johnson DS, McGeoch LA (2002) Experimental analysis of heuristics for the STSP. Kluwer Academic Publishers, Dordrecht

    Google Scholar 

  • Junger M, Reinelt G (1995) Handbooks in OR and MS: the traveling salesman problem, chapter 4. Elsevier, Amsterdam

    Google Scholar 

  • Karp RM (1972) Reducibility among combinatorial problems. In: Miller RE, Thatcher JW (eds) Complexity of computer computations. Plenum Press, New York

    Google Scholar 

  • Korte B (1988) Applications of combinatorial optimization. In: The 13th international mathematical programming symposium, vol 50, pp 862–877

  • Laporte G (1992) The vehicle routing problem: an overview of exact and approximate algorithms. Eur J Oper Res 59:345–358

    Article  Google Scholar 

  • Laporte G (2009) Fifty years of vehicle routing. Transp Sci 43:408–416

    Article  Google Scholar 

  • Larusic J, Punnen A, Aubanel E (2012) Experimental analysis of heuristics for the bottleneck traveling salesman problem. J Heuristics 18:473–503

    Article  Google Scholar 

  • Li C, Hu G (2014) Global migration strategy with moving colony for hierarchical distributed evolutionary algorithms. Soft Comput 18:2161–2176

    Article  Google Scholar 

  • Mavrovouniotis M, Yang S (2011) A memetic ant colony optimization algorithm for the dynamic travelling salesman problem. Soft Comput 15:1405–1425

    Article  Google Scholar 

  • Onwubolu GC, Clerc M (2004) Optimal path for automated drilling operations by a new heuristic approach using particle swarm optimization. Int J Prod Res 42:473–491

    Article  Google Scholar 

  • Pillac V, Gendreau M, Guéret C (2013) A review of dynamic vehicle routing problems. Eur J Oper Res 225:1–11

    Article  Google Scholar 

  • Platzman LK, Bartholdi JJ (1989) Spacefilling curves and the planar traveling salesman problem. J ACM 36:719–737

    Article  Google Scholar 

  • Rego C, Gamboa D, Glover F, Osterman C (2011) Traveling salesman problem heuristics: leading methods, implementations and latest advances. Eur J Oper Res 211:427–441

    Article  Google Scholar 

  • Rodriguez-Martin I, Salazar-Gonzalez J Jose (2012) A hybrid heuristic approach for the multi-commodity one-to-one pickup-and-delivery traveling salesman problem. J Heuristics 18:849–867

    Article  Google Scholar 

  • Steiglitz K, Weiner P (1997) Some improved algorithms for computer solution of the traveling salesman problem. In: 6th annual Allerton conference on circuit and systems theory, vol 126, pp 814–821

  • Walshaw C (2002) A multilevel approach to the traveling salesman problem. Oper Res 50:862–877

    Article  Google Scholar 

Download references


The authors are deeply grateful to the organizers of the 8th DIMACS TSP Challenge, David S. Johnson and Lyle McGeoch, for making their Greedy heuristic codes available, hence saving us a lot of work preparing for this paper. The authors also would like to thank Gerd Reinelt for providing the test cases. The authors thank David S. Johnson for his constructive suggestions on this paper. The work was also partly supported by the National Social Science Foundation of China (16CGL016), Humanities and Social Science Foundation of Ministry of Education of China (15YJC630103), and China Postdoctoral Science Foundation (2017M611575).

Author information

Authors and Affiliations


Corresponding author

Correspondence to Weizhen Rao.


Appendix 1: Performance of AppMVODM in Fig. 4

This appendix presents the computational results of distance matrix variance of 62 instances with cities ranging from 1000 to 10,000 in detail. In Table 8, columns 1–2 contain instance names and the minimal variances of distance matrix transformed by \(\pi ^\star\) or calculated by MVODM. The last 16 columns show the deviation of AppMVODM. The deviation can be computed by formula \(100 \times \sigma (\alpha )/\sigma _{min}-100\), where \(\sigma (\alpha )\) and \(\sigma _{min}\) represent the variances of \(D'\) that are transformed by AppMVODM with parameter α and by MVODM, while σ(0) equals variance of D, i.e., σ.

Appendix 2: Relationship between Greedy-AppMVODM and α in Fig. 10

See Table 9.

Table 9 Average solution quality of Greedy-AppMVODM with different α Values

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wang, S., Rao, W. & Hong, Y. A distance matrix based algorithm for solving the traveling salesman problem. Oper Res Int J 20, 1505–1542 (2020).

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: