NeuroLKH: Combining Deep Learning Model with Lin-Kernighan-Helsgaun Heuristic for Solving the Traveling Salesman Problem

1 Introduction . Traveling Salesman Problem ( TSP ) is an important NP-hard Combinatorial Optimization Problem with extensive industrial applications in various domains . Exact methods have the exponential worstcase computational complexity , which renders them impractical for solving large-scale problems in reality , even for highly optimized solvers such as Concorde . In contrast , although lacking optimality guarantees and non-trivial theoretical analysis , heuristic solvers search for near-optimal solutions with much lower complexity . They are usually desirable for real-life applications where statistically better performance is the goal . Traditional heuristic methods are manually designed based on expert knowledge which is usually human-interpretable . However , supported by the recent development of deep learning technology , modern methods train powerful deep neural networks to learn the complex patterns from the TSP instances generated from some specific distributions [ 32 , 1 , 6 , 21 , 18 , 34 , 33 , 35 ] . The performances of deep learning models for solving TSP are constantly improved by these works , which unfortunately are still far worse than the strong traditional heuristic solver and generally limited to relatively small problem sizes . ∗Zhiguang Cao is the corresponding author . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . We believe that learning-based methods should be combined with strong traditional heuristic algorithms , which is also suggested by [ 2 ] . In such a way , while learning the complex patterns from data samples , the efficient heuristics highly optimized by researchers for decades can be effectively utilized , especially for problems such as TSP which are well-studied due to their importance . The Lin-Kernighan-Helsgaun ( LKH ) algorithm [ 12 , 13 ] is generally considered as a very strong heuristic for solving TSP , which is developed based on the Lin-Kernighan ( LK ) heuristic [ 25 ] . LKH iteratively searches for λ-opt moves to improve the existing solution where λ edges of the tour are exchanged for another λ edges to form a shorter tour . To save the searching time , the edges to add are limited to a small edge candidate set , which is created before search . One of the most significant contributions of LKH is to generate the edge candidate set based on Minimum Spanning Tree , rather than using the nearest neighbor method in the LK heuristic . Furthermore , LKH applies penalty values to the nodes which are iteratively optimized using subgradient optimization ( will be detailed in Section 3 ) . The optimized node penalties are used by LKH to transform the edge distances for the λ-opt searching process and improve the quality of edge candidate sets , both of which help find better solutions . However , the edge candidate set generation in LKH is still guided by hand-crafted rules , which could limit the quality of edge candidates and hence the search performance . Moreover , the iterative optimization of node penalties is time-consuming , especially for large-scale problems . To address these limitations , we propose NeuroLKH , a novel learning-based method featuring a Sparse Graph Network ( SGN ) combined with the highly efficient λ-opt local search of LKH . SGN outputs the edge scores and node penalties simultaneously , which are trained by supervised learning and unsupervised learning , respectively . NeuroLKH transforms the edge distances based on the node penalties learned inductively from training instances , instead of performing iterative optimization for each instance , therefore saving a significant amount of time . More importantly , at the same time the edge scores are used to create the edge candidate set , leading to substantially better sets than those created by LKH . NeuroLKH trains one single network on TSP instances across a wide range of sizes and generalizes well to substantially larger problems with minutes of unsupervised offline fine-tuning to adjust the node penalty scales for different sizes . Same as existing works on deep learning models for solving TSP , NeuroLKH aims to learn complex patterns from data samples to find better solutions for instances following specific distributions . Following the evaluation process in these works , we perform extensive experiments . Results show that NeuroLKH improves the baseline algorithms by large margins , not only across the wide range of training problem sizes , but also on much larger problem sizes not used in training . Furthermore , NeuroLKH trained with instances of relatively simple distributions generalizes well to traditional benchmark with various node distributions such as the TSPLIB [ 27 ] . Also , we show that NeuroLKH can be applied to guide the extension of LKH [ 14 ] for more complicated routing problems such as the Capacitated Vehicle Routing Problem ( CVRP ) , Pickup and Delivery Problem ( PDP ) and CVRP with Time Windows ( CVRPTW ) , using generated test datasets and traditional benchmarks [ 28 , 30 ] . 2 Related works . Till now , for routing problems such as TSP , most works focus on learning construction heuristics , where deep neural networks are trained to sequentially select the nodes to visit with supervised learning [ 32 , 15 ] or reinforcement learning [ 1 , 6 , 26 , 21 , 22 ] . Similarly , networks are trained to pick edges in [ 18 , 20 ] . In another line of works [ 4 , 33 , 16 , 9 , 5 ] , researchers employ deep learning models to learn the actions for improving existing solutions , such as picking regions and rules or selecting nodes for the 2-opt heuristic . However , the performance of these works is still quite far from the strong non-learning heuristics such as LKH . In addition , they focus only on relatively small-sized problems ( up to hundreds of nodes ) . A recent work [ 8 ] generalizes a network pre-trained on fixed-size small graphs to solve larger size problems by sampling small sub-graphs to infer and merging the results . This interesting idea can be applied to very large graphs , however , the performance is still inferior to LKH and deteriorates rapidly with the increase of problem size . In a concurrent work [ 36 ] , a VSR-LKH method is proposed which also applies a learning method in combination with LKH . However , very different from our method , VSR-LKH applies traditional reinforcement learning during the searching process for each instance , instead of learning patterns for a class of instances . Moreover , VSR-LKH aims to guide the decision on edge selections within the edge candidate set , which is generated using the original procedure of LKH . NeuroLKH significantly outperforms VSR-LKH by large margins in all the settings of our experiments on testing instances following the training distributions , especially when the time limits are short . Even more impressively , NeuroLKH achieves performance similar to VSR-LKH on traditional benchmark TSPLIB [ 27 ] with various node distributions , which are very different from the training distributions for NeuroLKH . 3 Preliminaries : LKH algorithm . The Lin-Kernighan-Helsgaun ( LKH ) algorithm [ 12 , 13 ] is a local optimization algorithm developed based on the λ-opt move [ 24 ] , where λ edges in the current tour are exchanged by another set of λ edges to achieve a shorter tour . While solving one instance , the LKH algorithm can conduct multiple trials to find better solutions . In each trial , starting from a randomly initialized tour , it iteratively searches for λ-opt exchanges that improve the tour , until no such exchanges can be found . In each iteration , the λ-opt exchanges are searched in the ascending order of variable λ and the tour will be replaced once an exchange is found to reduce the tour distance . One central rule is that the λ-opt searching process is restricted and directed by an edge candidate set , which is created before search based on the α-measure using sensitivity analysis of the Minimum Spanning Tree . Here we briefly introduce the related concepts . A TSP graph can be viewed as an undirected graph G = ( V , E ) with V as the set of |V | nodes and E as the set of edges weighted by distances . A spanning tree of G is a connected graph with |V | − 1 edges from G and no cycles where any pair of nodes is connected by a path . A 1-tree of G is a spanning tree for the graph of node set V \ { 1 } combined with two edges in E connected to node 1 , an arbitrary special node in V . A minimum 1-tree is the 1-tree with minimum length . The α-measure of an edge ( i , j ) ∈ E for graph G is defined as α ( i , j ) = L ( T+ ( i , j ) ) − L ( T ) , where L ( T ) is the length of Minimum 1-Tree T and L ( T+ ( i , j ) ) is the length of Minimum 1-Tree T+ ( i , j ) required to include the edge ( i , j ) . The α-measure of an edge can be viewed as the extra length of the Minimum 1-Tree to include this edge . The edge candidate set consists of the k edges with the smallest α-measures connected to each node ( k = 5 as default ) . During the λ-opt searching process , the edges to be included into the new tour are limited to the edges in this candidate set , and edges with smaller α-measures will have higher priorities to be searched over . Therefore this candidate set not only restricts but also directs the search . Moreover , the quality of α-measures can be improved significantly by a subgradient optimization method . If we add a penalty πi to each node i and transform the original distance si , j of the edge ( i , j ) to a new distance ci , j as ci , j = si , j + πi + πj , the optimal tour for the TSP will stay the same but the Minimum 1-Tree usually will change . Because by definition , a Minimum 1-Tree with node degrees all equal to 2 is an optimal solution for the corresponding TSP instance . With the length of Minimum 1-Tree resulting from the penalty π = ( π1 , ... , π|V | ) as L ( Tπ ) , w ( π ) = L ( Tπ ) − 2Σiπi is a lower bound of the optimal tour distance for the original TSP instance . LKH applies subgradient optimization [ 11 ] to iteratively maximize this lower bound for multiple steps until convergence by applying πτ+1 = πτ + tτ ( dτ − 2 ) at step τ , where tτ is the scalar step size , dτ is the vector of node degrees in the Minimum 1-Tree with penalty πτ . Therefore , the node degrees are pushed towards 2 . The α-measures after this optimization will substantially improve the quality of edge candidate set . Furthermore , the transformed edge distance ci , j after this optimization helps find better solutions when used during the searching process for λ-opt exchanges . 4 The proposed NeuroLKH algorithm . The subgradient optimization in LKH can substantially improve the quality of edge candidate sets based on the α-measures , and transform the edge distances effectively to achieve reasonably good performance . However , it still has major limitations as the optimization process is over one instance iteratively until convergence , which costs a large amount of time , especially for large-scale problems . Moreover , even after subgradient optimization , some critical patterns could be missed by the relatively straightforward sensitivity analysis of spanning tree . Therefore , the quality of edge candidate set could be further improved by large margins , which will in turn improve the overall performance . We propose the NeuroLKH algorithm , which employs a Sparse Graph Network to learn the complex patterns associated with the TSP instances generated from a distribution . Concretely , the network will learn the edge scores and node penalties simultaneously with a multi-task training process . The edge scores are trained with supervised learning for creating the edge candidate set , while the node penalties are trained with unsupervised learning for transforming the edge distances . The architecture of NeuroLKH is presented in Figure 1 , along with the original LKH algorithm . We will detail the Sparse Graph Network , the training process and the proposed NeuroLKH algorithm in the following .

Summary: This paper proposes a neural version of the classic LKH algorithm, where the subgradient optimization of LKH is replaced by a sparse GNN that predicts edge candidates and node penalties that can directly be used by the LKH search algorithm. The edge candidate predictions are learned supervised from optimal solutions whereas the penalties are learned 'unsupervised' to push the node degrees of the 1-tree induced by the penalties towards 2 (I consider this is more like RL where the deviation from node degree 2 determines the reward). After training, the NeuroLKH algorithm gives better results than the standard LKH algorithm given equal time, for the travelling salesman problem (TSP) and different vehicle routing problems (VRPs).  As the node penalties are only used for TSP, the major contribution seems to show the empirical benefit of the edge candidate predictions. While this is not a new idea in itself, the combination with LKH is and as the empirical results are very promising, I think this paper makes valuable progress and therefore should be accepted.