Abstract
Routing problems like the Traveling Salesman Problem (TSP) are NP-hard and traditionally solved using construction or improvement heuristics. While recent Deep Reinforcement Learning (DRL) research has focused on construction, these models often require extensive search to achieve high performance. This paper proposes a DRL framework that learns to improve existing solutions by intelligently selecting 2-opt moves. Using a dual-encoder architecture that combines Graph Convolutional Networks (GCNs) and Recurrent Neural Networks (RNNs), the model acts as a smart local search agent. Our approach achieves near-optimal results on TSP with high sample efficiency and generalizes effectively to the Vehicle Routing Problem (VRP).
Introduction
The Traveling Salesman Problem (TSP) is a fundamental challenge in combinatorial optimization. Finding the shortest path through a set of nodes becomes exponentially difficult as the number of locations increases. Traditional solvers generally fall into two categories: construction heuristics, which build a tour from scratch, and improvement heuristics, which refine an existing tour through local modifications.
A classic improvement heuristic is the 2-opt algorithm, which iteratively swaps two edges to reduce the total tour length. However, manual heuristics often get stuck in local optima. This paper introduces a DRL-based agent that learns to select the most promising 2-opt moves, prioritizing long-term gains over immediate greedy improvements.
Methods
The authors frame the improvement process as a Markov Decision Process (MDP) and solve it using a Policy Gradient algorithm. The core of the approach is a sophisticated neural architecture designed to capture both spatial and sequential information.
Dual Encoder Architecture
The model processes two inputs: the "Current Solution" ($S$) and the "Best Solution Found So Far" ($S'$). Each input is processed by an encoder consisting of:
- Graph Convolutional Networks (GCNs): These capture the spatial relationships between nodes, regardless of their order in the tour.
- Bidirectional LSTMs (RNNs): These process the specific sequence of the tour. The bidirectional nature allows the model to recognize that a tour is identical whether traversed forward or backward.
Policy and Value Decoders
The Policy Decoder uses a pointer attention mechanism to select two nodes for a 2-opt swap. By "pointing" to specific nodes, the model identifies which parts of the tour should be rewired. Simultaneously, a Value Decoder estimates the expected reward, aiding the reinforcement learning process.
Key Insights
- Improvement vs. Construction: Starting with a complete solution allows the model to focus on fixing errors rather than learning the basic concept of a tour, leading to better sample efficiency.
- Best-So-Far State: Including the best-visited solution provides a reference point, helping the agent distinguish between minor fluctuations and significant breakthroughs.
- Zero-Shot Generalization: Policies trained on 50-node problems (TSP50) generalize remarkably well to 100-node problems (TSP100), suggesting the model learns fundamental rules for edge swapping.
Experimental Results
The model was evaluated on synthetic Euclidean TSP instances, the standard TSPlib library, and variants like the Capacitated Vehicle Routing Problem (CVRP).
- TSP Performance: On TSP100, the model achieved an optimality gap of only 0.87% after 2000 steps, outperforming other DRL improvement methods like GAT-T.
- Generalization to Real-World Data: On TSPlib benchmarks, the learned policy outperformed the specialized commercial solver OR-Tools in 12 out of 35 instances, despite no prior exposure to those specific node distributions.
- VRP Success: For CVRP20, the model achieved a tiny 0.37% gap compared to the highly optimized LKH3 heuristic.
Conclusion
This work demonstrates that DRL can effectively learn improvement heuristics for complex routing problems. By intelligently selecting 2-opt moves, the proposed model achieves near-optimal performance and exhibits strong generalization capabilities. Future work may extend this architecture to handle $k$-opt moves (swapping 3 or more edges) and further optimize the computational cost of feasibility checking in constrained problems like CVRP.
Summary updated