Graph Neural Network Guided Local Search for the Traveling Salesperson Problem

Solutions to the Traveling Salesperson Problem ( TSP ) have practical applications to processes in transportation , logistics , and automation , yet must be computed with minimal delay to satisfy the real-time nature of the underlying tasks . However , solving large TSP instances quickly without sacrificing solution quality remains challenging for current approximate algorithms . To close this gap , we present a hybrid data-driven approach for solving the TSP based on Graph Neural Networks ( GNNs ) and Guided Local Search ( GLS ) . Our model predicts the regret of including each edge of the problem graph in the solution ; GLS uses these predictions in conjunction with the original problem graph to find solutions . Our experiments demonstrate that this approach converges to optimal solutions at a faster rate than three recent learning based approaches for the TSP . Notably , we reduce the mean optimality gap on the 100-node problem set from 1.534 % to 0.705 % , a 2× improvement . When generalizing from 20-node instances to the 100-node problem set , we reduce the optimality gap from 18.845 % to 2.622 % , a 7× improvement . 1 INTRODUCTION . Sixty years ago , the route of a delivery truck would have been fixed well before the truck departed the warehouse . Today , thanks to the availability of real-time traffic information , and the option to transmit instructions to the driver to add or remove delivery locations on-the-fly , the route is no longer fixed . Nevertheless , minimizing the length or duration of the route remains an important problem . This is an instance of the Traveling Salesperson Problem ( TSP ) , and one of a growing number of practical applications which require solving combinatorial optimization problems in real time . In these problems , there is often a cost attributed to waiting for an optimal solution or hard deadlines at which decisions must be taken . For example , the driver can not wait for a new solution to be computed – they may miss their deliveries , or the traffic conditions may change again . There is a need for general , anytime combinatorial optimization algorithms that produce high-quality solutions under restricted computation time . This remains challenging for current approaches , as they are specialized for a specific problem ( with specific assumptions and constraints ) , or fail to produce good solutions quickly . Contributions We present a hybrid data-driven approach for approximately solving the Euclidean TSP based on Graph Neural Networks ( GNNs ) and Guided Local Search ( GLS ) , which we demonstrate converges to optimal solutions more quickly than three recent learning based approaches . We provide the following contributions : • Our GLS algorithm is guided by the global regret of each edge in the problem graph . This allows the algorithm to differentiate edges that are very costly to include in the solution from ones that are not so costly , whether or not they are part of the optimal solution . Thus , using regret allows us to find high-quality , rather than optimal , solutions very quickly . We are the first to use a measure of global regret , which we define as the cost of enforcing a decision relative to the cost of an optimal solution . • We make this computationally tractable by approximating regret with a learned representation . Our GNN-based model operates on the line graph of the problem graph , which allows us to build a network without node features , focusing only on edge weight . • We present experimental results for our approach and several learning based approaches that are aligned with recent guidelines for computational testing of learning based approaches for the TSP . Our experiments emphasize the trade-off between solution quality and time . • We reduce the mean optimality gap on the 50-node problem set from 0.268 % to 0.009 % , a 30× times improvement , and on the 100-node problem set from 1.534 % to 0.705 % , a 2× improvement . When generalizing from 20-node instances to the 100-node problem set , we reduce the mean optimality gap from 18.845 % to 2.622 % , a 7× improvement . 2 RELATED WORK . The Operations Research ( OR ) community is responsible for the majority of research in algorithms for solving combinatorial optimization problems . Concorde ( Applegate et al. , 2006 ) is widely regarded as the best exact TSP solver . As an exact solver , it can guarantee the level of optimality of the solutions it finds . It uses cutting plane algorithms ( Dantzig et al. , 1954 ; Padberg & Rinaldi , 1990 ; Applegate et al. , 2003 ) and branch-and-cut methods to iteratively prune away parts of search space that will not contain an optimal solution . LKH-3 ( Helsgaun , 2017 ) , and its predecessor , LKH2 ( Helsgaun , 2009 ) , are approximate TSP and Capacitated Vehicle Routing Problem ( CVRP ) solvers based on the κ-opt heuristic ( Lin & Kernighan , 1973 ) . While these solvers do not provide any guarantees , experimentation has demonstrated that they are extremely effective . Concorde , LKH-2 and LKH-3 are highly specialized and efficient solvers which can solve challenging TSPs in seconds . However , practical real-time routing problems often impose constraints on top of the basic TSP or CVRP problem definitions . Highly-specialized solvers are difficult to adapt to these new constraints . Thus , there is a need for general algorithmic frameworks that can produce high-quality solutions with minimal computation time . To address this , Arnold & Sörensen ( 2019a ) introduce KGLS , a GLS algorithm for the CVRP that is guided by three engineered features . They demonstrate that their algorithm can find solutions almost as good as those found by state-of-the-art metaheuristics in a fraction of the time . Our work also aims to address this gap . Machine learning offers a way to construct flexible , yet effective combinatorial optimization algorithms . This area of research has existed for more than three decades ( Smith , 1999 ) , yet new neural architectures , especially GNNs , have driven a surge of activity in this area . As noted by Bengio et al . ( 2021 ) ; Cappart et al . ( 2021 ) , classical combinatorial optimization approaches solve each problem instance in isolation , overlooking the fact that in practice , problems and their solutions stem from related data distributions . Machine learning offers a way to exploit this observation . We classify learning based approaches for solving the TSP into the three categories identified by Bengio et al . ( 2021 ) ; our approach belongs to the second category , described below . ML alone provides a solution . These approaches use a machine learning model to output solutions directly from the problem definition . Vinyals et al . ( 2015 ) propose PtrNet , a sequence-to-sequence model based on LSTMs , which iteratively constructs a solution by outputting the permutation of the input nodes . They train their model using expert solutions from Concorde . They use beam search ( Reddy , 1977 ) to produce better solutions than those sampled from their model directly . Bello et al . ( 2016 ) present a method of training PtrNet without supervision using policy gradients . Their “ active search ” method resembles early neural network-based approaches to combinatorial optimization , in which a model was trained online to solve a particular problem instance ( Smith , 1999 ) . This method effectively solves each problem in isolation , thus it does not leverage expertise extracted from distribution of training problem instances . Kool et al . ( 2018 ) take a similar approach to Bello et al . ( 2016 ) but use a Transformer architecture ( Vaswani et al. , 2017 ) rather than an LSTM . Their model can also be seen as a Graph Attention Network ( GAT ) ( Veličković et al. , 2017 ) applied to a complete graph . Kwon et al . ( 2021 ) also take a similar approach but leverage the symmetry of many combinatorial optimization problems to improve performance . Joshi et al . ( 2019 ) train a model to produce a heatmap of which edges in the TSP graph are likely to be part of the optimal solution , and reconstruct valid tours using beam search . Similar to Vinyals et al . ( 2015 ) , they train their model using expert solutions from Concorde . Kool et al . ( 2021 ) extend the work of Joshi et al . ( 2019 ) to VRPs , and use a dynamic programming method to construct tours . Also in this category , Fu et al . ( 2021 ) train a model to output a heatmap for small TSP instances to and sample small sub-graphs from large instances to construct heatmaps for large instances . They train their approach using reinforcement learning , and use Monte Carlo tree search ( MCTS ) to construct valid tours . ML provides information to an OR algorithm . Machine learning may not be suitable to solve a combinatorial optimization problem alone . Instead , it can provide information to augment a combinatorial optimization algorithm . Deudon et al . ( 2018 ) use a model based on the Transformer architecture to construct solutions iteratively and train it using policy gradients ( they take a similar approach to Kool et al. , 2018 ) . They apply a 2-opt local search heuristic to solutions sampled from their model . In contrast to prior work , we are the first to use a machine learning model to approximate regret . Furthermore , many previous works that produce predictions on edges ( Joshi et al. , 2019 ; Kool et al. , 2021 ; Fu et al. , 2021 ) construct tours using heuristics , whereas to our knowledge , we are the first to use predictions to inform a metaheuristic ( GLS ) . ML makes decisions within an OR algorithm . Finally , a machine learning model can be embedded inside a combinatorial optimisation algorithm . In this paradigm , a master algorithm controls the high-level procedure while repeatedly calling a machine learning model to make lower level decisions . Dai et al . ( 2017 ) present a model that uses a GNN to learn an embedding of the current partial solution and a DQN ( Mnih et al. , 2015 ) to iteratively select nodes to insert using a cheapest insertion heuristic . They also use an “ active search ” method when solving the TSP . Wu et al . ( 2020 ) and da Costa et al . ( 2020 ) present policy gradient algorithms to learn policies to apply 2-opt operations to existing feasible solutions . Wu et al . ( 2020 ) use a Transformer architecture . da Costa et al . ( 2020 ) use a combination of GCN and RNN modules , and acheive better results . These approaches can either be seen as end-to-end learning approaches belonging to the first category , or as local search procedures where an ML model decides where to apply an operator . 3 PRELIMINARIES . Traveling Salesperson Problem We focus on the Euclidean TSP , although our approach can be applied to other routing problems , such as the CVRP . A problem with n cities , typically denoted TSPn , is represented as a complete , undirected , weighted graph G = ( V , E ) with n nodes . The edges E represent connections between cities and are weighted by the Euclidean distance between the adjacent nodes . A solution , or tour , is a Hamiltonian cycle : a closed path through the graph that visits every node exactly once . An optimal solution is a cycle of minimum weight . Regret Regret measures the future cost of an action that also yields an immediate reward , and is typically used to make greedy combinatorial optimization algorithms less myopic . Generally , regret is computed over a fixed horizon . For example , Potvin & Rousseau ( 1993 ) evaluate the cost of inserting a node in the best versus second-best position when constructing a CVRP solution . Hassin & Keinan ( 2008 ) solve the TSP using regret , allowing a greedy construction heuristic to remove the most recently inserted node . It is not computationally feasible to calculate regret over a global horizon , for example , for all possible insertion sequences . However , if it were possible , a greedy algorithm could compute an optimal solution by selecting the lowest regret decision at each step . Local Search Local Search ( LS ) is a general improvement heuristic . Starting from an initial solution , local search iteratively moves to neighboring solutions that are lower cost than the current solution according to the objective function g ( s ) . Neighboring solutions are solutions that are reachable from a given solution by applying a certain function , or operator . The set of all solutions reachable from another solution by applying an operator define the neighborhood of that operator . The algorithm terminates when all neighboring solutions are inferior to the current solution , meaning the search has reached a local optimum . Guided Local Search Guided Local Search ( GLS ) is a metaheuristic that sits on top of LS and allows it to escape local optima ( Voudouris & Tsang , 1996 ) . To apply GLS , the designer must define some aspects of a solution . When trapped in a local optimum , the algorithm penalizes certain aspects of the current solution which are considered to be unfavorable . The underlying LS procedure searches using an objective function that is augmented by these penalties , thus it is incentivized to remove heavily penalized aspects from the solution . The augmented objective function h ( s ) is h ( s ) = g ( s ) + λ M∑ i=0 piIi ( s ) , ( 1 ) where s is a solution , g ( s ) is the objective function , λ is a scaling parameter , i indexes the aspects , M is the number of aspects , pi is the current number of penalties assigned to aspect i , and Ii is an indication of whether s exhibits aspect i , i.e . Ii ( s ) = { 1 if s exhibits aspect i , 0 otherwise . ( 2 ) For the TSP , aspects of the solution are often defined as the edges in the problem graph . Therefore , Ii ( s ) indicates if an edge is in the solution s. Upon reaching a local optimum , which aspects are penalized is determined by a utility function . The utility of penalising aspect i , utili , is defined as utili ( s∗ ) = Ii ( s∗ ) ci 1 + pi , ( 3 ) where s∗ is the solution at a local optimum , Ii ( s∗ ) indicates if the solution exhibits aspect i , and ci is the cost of the aspect i . The cost of an aspect measures how unfavorable it is . The higher the cost , the greater the utility of penalizing that aspect . In the context of the TSP , the cost can be the weight of the edge ( Voudouris & Tsang , 1999 ) , or a combination of various features ( Arnold & Sörensen , 2019a ) . Conversely , the more penalties assigned to that aspect , the lower the utility of penalising it again . The aspects with the maximum utility are always penalized , which means increasing pi by one . This penalization mechanism distributes the search effort in the search space , favoring areas where a promise is shown ( Voudouris & Tsang , 1996 ) . We use a variation of the classical GLS algorithm ( see Voudouris & Tsang , 1999 ) that applies alternating optimisation and perturbation phases ( see Arnold & Sörensen , 2019a ) . During an optimization phase , the local search procedure is guided by the original objective function g. During a perturbation phase , it is guided by the augmented objection function h. After an edge is penalized , the local search is applied only on the penalized edge . That is , only operations that would remove the penalized edge are considered . This differs from the local search during the optimization phase , which considers all solutions in the neighborhood of the given operator . The perturbation phase continues until K operations ( operations that improve the solution according to the augmented objective function h ) have been applied to the current solution . These operations perturb the solution enough for the local search to escape a local minimum . The alternating phases continue until the stopping condition is met .

Summary: The paper presents a hybrid data-driven approach for solving the TSP based on Graph Neural Networks and Guided Local Search. The model predicts the regret of including each edge of the problem graph in the solution; GLS uses these predictions in conjunction with the original problem graph to find solutions. The experiments demonstrate that this approach converges to optimal solutions at a faster rate than state-of-the-art learning-based approaches and non-learning GLS algorithms for the TSP, finding optimal solutions to 96% of the 50-node problem set, 7% more than the next best benchmark, and to 20% of the 100-node problem set, 4.5× more than the next best benchmark. When generalizing from 20-node problems to the 100-node problem set, this approach finds solutions with an average optimality gap of 2.5%, a 10× improvement over the next best learning-based benchmark.