Generalization in Deep RL for TSP Problems via Equivariance and Local Search

Wenbin Ouyang, Yisen Wang, Paul Weng, Shaochen Han

TL;DR

This paper tackles the challenge of making Deep Reinforcement Learning (DRL) models for the Traveling Salesman Problem (TSP) generalize to larger problem instances than they were trained on. They achieve this by introducing a novel DRL approach that leverages equivariance to handle symmetries in TSP data and interleaves local search heuristics with RL training to smooth the learning landscape, leading to state-of-the-art generalization performance.

What Problem Does This Paper Address?

The Traveling Salesman Problem (TSP) is a classic NP-hard problem with numerous real-world applications. While Deep Reinforcement Learning (DRL) has shown promise in finding good solutions quickly for small TSP instances, its performance significantly degrades when applied to larger instances. This is a major limitation because training DRL models on large instances is computationally prohibitive. The core challenge is to develop DRL solvers that can be trained on smaller TSP instances but still perform effectively on much larger ones, a problem known as generalization.

Methods

The authors propose a novel DRL approach called eMAGIC (which stands for equivariance, MLP, Attention, Graph neural network, Interleaved local search, and Curriculum learning). The key innovations are:

  • Equivariance: Instead of just aiming for invariance (where the output doesn't change with input transformations), eMAGIC exploits equivariance. This means that if the input (city positions) is transformed (e.g., rotated, translated), the output (the tour) transforms in a corresponding way. This is achieved through:
  • Equivariant Preprocessing: Standardizing input city coordinates using transformations like rotation, scaling, and translation to reduce the input space complexity.
  • Relative Positions: Using relative city positions with respect to the last visited city, rather than absolute coordinates, to inherently handle translation invariance.
  • Smoothed Policy Gradient: Traditional DRL for TSP uses policy gradients based on the tour length. eMAGIC modifies this by using a smoothed policy gradient. This involves improving the tour generated by the RL policy using a combined local search and then using this improved tour to update the policy. This encourages the RL agent to generate tours that are easily improvable by local search, creating a synergistic effect.
  • Combined Local Search: Rather than relying on a single local search heuristic (like 2-opt), eMAGIC employs a combination of several heuristics (insertion, random 2-opt, search 2-opt, search random 3-opt) applied sequentially. This helps to avoid getting stuck in local optima.
  • Stochastic Curriculum Learning (CL): The model is trained on TSP instances with varying sizes, but the difficulty (instance size) is increased stochastically over training epochs, controlled by a probability distribution. This helps the model learn more gradually and prevents overfitting to specific instance sizes.

The model architecture itself uses a Graph Neural Network (GNN) for encoding graph information and a Multi-Layer Perceptron (MLP) for encoding visited city information, combined with an attention mechanism in the decoder.

Datasets

The paper uses two types of datasets for evaluation:

  • Randomly Generated TSP Instances: These are generated uniformly within the unit square [0, 1]². The paper tests on instances of sizes 20, 50, 100, 200, 500, and 1000.
  • Realistic TSP Instances from TSPLIB: This is a standard benchmark library for TSP. The paper evaluates on instances ranging in size from 51 to 1002 cities.

Key Insights and Ideas

  • Equivariance is Key for Generalization: The paper strongly suggests that explicitly modeling symmetries through equivariance (not just invariance) is crucial for DRL models to generalize to unseen, larger TSP instances. By learning to handle transformations, the model can leverage knowledge from smaller instances more effectively.
  • Synergy Between RL and Local Search: Interleaving local search during training (not just at test time) with RL updates is a powerful technique. It guides the RL agent to produce solutions that are "on the right track" for local search improvement, leading to better overall performance.
  • Smoothed Objective Function: The "smoothed policy gradient" effectively smooths the objective function, making it easier for the RL agent to learn and converge to better policies that are amenable to local search.
  • Combined Local Search Outperforms Single Heuristics: Using a suite of local search methods in combination, rather than a single one, provides a more robust way to improve solutions and avoid local optima.

Key Results

  • State-of-the-Art Generalization: eMAGIC achieves state-of-the-art performance on both large random TSP instances and realistic TSPLIB instances, significantly outperforming other learning-based methods, especially when generalizing to sizes much larger than the training set.
  • Performance on Large Instances: For TSP instances up to 1000 cities, eMAGIC's average gap to the optimal solution is competitive and often superior to other methods. For example, on TSP1000, eMAGIC achieves a gap of 7.05%, while some other methods struggle to provide solutions.
  • Realistic Instance Performance: On TSPLIB instances, eMAGIC (specifically eMAGIC(S)) shows a remarkable ability to generalize. For instances larger than 400 cities, its gap to the optimal increases by less than 1% compared to smaller instances, demonstrating strong generalization.
  • Ablation Study Confirms Component Importance: An ablation study shows that each component of eMAGIC (equivariance, stochastic CL, policy rollout baseline, combined local search) contributes significantly to its overall performance. Removing any single component leads to a noticeable drop in performance.

Limitations and Future Work

  • Adaptivity to Instance: The authors acknowledge that their approach, while generalizing well, does not adapt to the specific characteristics of the instance being solved during inference. They suggest that incorporating adaptivity, similar to methods like Fu et al. [2021], could further improve performance.
  • Actor-Critic Extension: They propose extending the approach to an actor-critic scheme and exploring invariances for the critic.
  • Broader Applicability: The authors believe their techniques can be extended to other combinatorial optimization problems and more general RL domains.
  • Training Size: The paper suggests that training on slightly larger instances (e.g., up to 100 cities) might further improve performance, especially for very large problem sizes.

Summary updated

BibTeX
@article{ouyang2024generalization,
  author = {Wenbin Ouyang and Yisen Wang and Paul Weng and Shaochen Han},
  title = {{Generalization in Deep RL for TSP Problems via Equivariance and Local Search}},
  journal = {SN Comput. Sci.},
  year = {2024},
  doi = {10.1007/s42979-024-02689-5},
}
Figure