IDEAS home Printed from https://ideas.repec.org/a/plo/pone00/0319711.html
   My bibliography  Save this article

A transformer-based structure-aware model for tackling the traveling salesman problem

Author

Listed:
  • Chun-Sheng Zhao
  • Li-Pei Wong

Abstract

Leveraging the Transformer architecture to develop end-to-end models for addressing combinatorial optimization problems (COPs) has shown significant potential due to its exceptional performance. Nevertheless, a multitude of COPs, including the Traveling Salesman Problem (TSP), displays typical graph structure characteristics that existing Transformer-based models have not effectively utilized. Hence, this study focuses on TSP and introduces two enhancements, namely closeness centrality encoding and spatial encoding, to strengthen the Transformer encoder’s capacity to capture the structural features of TSP graphs. Furthermore, by integrating a decoding mechanism that not only emphasizes the starting and most recently visited nodes, but also leverages all previously visited nodes to capture the dynamic evolution of tour generation, a Transformer-based structure-aware model is developed for solving TSP. Employing deep reinforcement learning for training, the proposed model achieves deviation rates of 0.03%, 0.16%, and 1.13% for 20-node, 50-node, and 100-node TSPs, respectively, in comparison with the Concorde solver. It consistently surpasses classic heuristics, OR Tools, and various comparative learning-based approaches in multiple scenarios while showcasing a remarkable balance between time efficiency and solution quality. Extensive tests validate the effectiveness of the improvement mechanisms, underscore the significant impact of graph structure information on solving TSP using deep neural networks, and also reveal the scalability and limitations.

Suggested Citation

  • Chun-Sheng Zhao & Li-Pei Wong, 2025. "A transformer-based structure-aware model for tackling the traveling salesman problem," PLOS ONE, Public Library of Science, vol. 20(4), pages 1-24, April.
  • Handle: RePEc:plo:pone00:0319711
    DOI: 10.1371/journal.pone.0319711
    as

    Download full text from publisher

    File URL: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0319711
    Download Restriction: no

    File URL: https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0319711&type=printable
    Download Restriction: no

    File URL: https://libkey.io/10.1371/journal.pone.0319711?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. G. Clarke & J. W. Wright, 1964. "Scheduling of Vehicles from a Central Depot to a Number of Delivery Points," Operations Research, INFORMS, vol. 12(4), pages 568-581, August.
    2. Michael Held & Richard M. Karp, 1970. "The Traveling-Salesman Problem and Minimum Spanning Trees," Operations Research, INFORMS, vol. 18(6), pages 1138-1162, December.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Martinhon, Carlos & Lucena, Abilio & Maculan, Nelson, 2004. "Stronger K-tree relaxations for the vehicle routing problem," European Journal of Operational Research, Elsevier, vol. 158(1), pages 56-71, October.
    2. Yao, Yu & Zhu, Xiaoning & Dong, Hongyu & Wu, Shengnan & Wu, Hailong & Carol Tong, Lu & Zhou, Xuesong, 2019. "ADMM-based problem decomposition scheme for vehicle routing problem with time windows," Transportation Research Part B: Methodological, Elsevier, vol. 129(C), pages 156-174.
    3. Shengbin Wang & Weizhen Rao & Yuan Hong, 2020. "A distance matrix based algorithm for solving the traveling salesman problem," Operational Research, Springer, vol. 20(3), pages 1505-1542, September.
    4. Helsgaun, Keld, 2000. "An effective implementation of the Lin-Kernighan traveling salesman heuristic," European Journal of Operational Research, Elsevier, vol. 126(1), pages 106-130, October.
    5. Yannis Marinakis & Athanasios Migdalas & Panos M. Pardalos, 2005. "A Hybrid Genetic—GRASP Algorithm Using Lagrangean Relaxation for the Traveling Salesman Problem," Journal of Combinatorial Optimization, Springer, vol. 10(4), pages 311-326, December.
    6. Haughton, Michael A., 1998. "The performance of route modification and demand stabilization strategies in stochastic vehicle routing," Transportation Research Part B: Methodological, Elsevier, vol. 32(8), pages 551-566, November.
    7. Gong, Manlin & Hu, Yucong & Chen, Zhiwei & Li, Xiaopeng, 2021. "Transfer-based customized modular bus system design with passenger-route assignment optimization," Transportation Research Part E: Logistics and Transportation Review, Elsevier, vol. 153(C).
    8. Ahmed Kheiri & Alina G. Dragomir & David Mueller & Joaquim Gromicho & Caroline Jagtenberg & Jelke J. Hoorn, 2019. "Tackling a VRP challenge to redistribute scarce equipment within time windows using metaheuristic algorithms," EURO Journal on Transportation and Logistics, Springer;EURO - The Association of European Operational Research Societies, vol. 8(5), pages 561-595, December.
    9. Smith, John Paul, 1974. "A Lockset analysis of farm to plant milk assembly," ISU General Staff Papers 1974010108000018144, Iowa State University, Department of Economics.
    10. Arpan Rijal & Marco Bijvank & Asvin Goel & René de Koster, 2021. "Workforce Scheduling with Order-Picking Assignments in Distribution Facilities," Transportation Science, INFORMS, vol. 55(3), pages 725-746, May.
    11. Jumbo, Olga & Moghaddass, Ramin, 2022. "Resource optimization and image processing for vegetation management programs in power distribution networks," Applied Energy, Elsevier, vol. 319(C).
    12. Gábor Braun & Samuel Fiorini & Sebastian Pokutta & David Steurer, 2015. "Approximation Limits of Linear Programs (Beyond Hierarchies)," Mathematics of Operations Research, INFORMS, vol. 40(3), pages 756-772, March.
    13. Forma, Iris A. & Raviv, Tal & Tzur, Michal, 2015. "A 3-step math heuristic for the static repositioning problem in bike-sharing systems," Transportation Research Part B: Methodological, Elsevier, vol. 71(C), pages 230-247.
    14. Leloup, Emeline & Paquay, Célia & Pironet, Thierry & Oliveira, José Fernando, 2025. "A three-phase algorithm for the three-dimensional loading vehicle routing problem with split pickups and time windows," European Journal of Operational Research, Elsevier, vol. 323(1), pages 45-61.
    15. Yanling Chu & Xiaoju Zhang & Zhongzhen Yang, 2017. "Multiple quay cranes scheduling for double cycling in container terminals," PLOS ONE, Public Library of Science, vol. 12(7), pages 1-19, July.
    16. Ido Orenstein & Tal Raviv & Elad Sadan, 2019. "Flexible parcel delivery to automated parcel lockers: models, solution methods and analysis," EURO Journal on Transportation and Logistics, Springer;EURO - The Association of European Operational Research Societies, vol. 8(5), pages 683-711, December.
    17. Peter Francis & Karen Smilowitz & Michal Tzur, 2006. "The Period Vehicle Routing Problem with Service Choice," Transportation Science, INFORMS, vol. 40(4), pages 439-454, November.
    18. Guerrero, W.J. & Prodhon, C. & Velasco, N. & Amaya, C.A., 2013. "Hybrid heuristic for the inventory location-routing problem with deterministic demand," International Journal of Production Economics, Elsevier, vol. 146(1), pages 359-370.
    19. Martins, Sara & Ostermeier, Manuel & Amorim, Pedro & Hübner, Alexander & Almada-Lobo, Bernardo, 2019. "Product-oriented time window assignment for a multi-compartment vehicle routing problem," European Journal of Operational Research, Elsevier, vol. 276(3), pages 893-909.
    20. Mo, Pengli & Yao, Yu & D’Ariano, Andrea & Liu, Zhiyuan, 2023. "The vehicle routing problem with underground logistics: Formulation and algorithm," Transportation Research Part E: Logistics and Transportation Review, Elsevier, vol. 179(C).

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:plo:pone00:0319711. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: plosone (email available below). General contact details of provider: https://journals.plos.org/plosone/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.