NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Deep Reinforcement Learning Algorithm Using Dynamic Attention Model for Vehicle Routing Problems

Bo Peng, Jiahai Wang, Zizhen Zhang

TL;DR

This paper introduces AM-D, a Deep Reinforcement Learning approach that solves the Vehicle Routing Problem (VRP) by dynamically updating node embeddings as a solution is constructed. By re-encoding the graph to reflect visited nodes and remaining capacity, the model achieves significantly lower optimality gaps than previous state-of-the-art attention models.

What Problem Does This Paper Address?

The Vehicle Routing Problem (VRP) is a classic NP-hard combinatorial optimization challenge: how can a fleet of vehicles deliver goods to a set of customers with minimum total distance while respecting capacity constraints?

Traditionally, researchers used exact algorithms (which are too slow for large scales) or hand-crafted heuristics (which require intense expert knowledge). Recently, "Learning to Optimize" has emerged, using neural networks to learn these heuristics automatically. However, previous state-of-the-art models (like the Attention Model or AM) treated the problem as a static graph. They computed node features once at the start and used them for the entire construction process.

The authors argue this is a flaw: as a vehicle visits customers, the "state" of the problem changes. A customer who was central to the original cluster might become an outlier once their neighbors are served. Static embeddings fail to capture this evolving structural information.

Methods

The authors propose the Dynamic Attention Model (AM-D), which utilizes a dynamic encoder-decoder architecture based on the Transformer.

  1. The Encoder: Like standard models, it uses Multi-Head Attention (MHA) to create embeddings for each node (coordinates + demand).
  2. The "Dynamic" Twist: Instead of encoding once, the model re-encodes the remaining nodes whenever the vehicle returns to the depot to start a new route.
  3. Structural Masking: During re-encoding, nodes that have already been visited are masked out. This forces the attention mechanism to focus only on the "new" instance formed by the remaining customers, effectively capturing the updated graph topology.
  4. The Decoder: At each step, the decoder uses a context vector (representing the current node, the graph average, and remaining capacity) to point to the next node to visit.
  5. Training: The model is trained using the REINFORCE algorithm (a policy gradient method) with a greedy rollout baseline to reduce variance and speed up convergence.

Datasets

The researchers evaluated the model on synthetic VRP instances of three sizes:

  • VRP20, VRP50, and VRP100 (20, 50, and 100 customer nodes).
  • Coordinates: Randomly sampled from a unit square $[0, 1] \times [0, 1]$.
  • Demands: Discrete values between 1 and 9.
  • Capacities: Scaled based on problem size (30, 40, and 50 respectively).

The model was compared against exact solvers (Gurobi), classic heuristics (LKH3), and previous RL-based approaches.

Key Insights and Ideas

  • The "New Instance" Perspective: The authors treat the remaining unvisited nodes as a completely new sub-problem. By re-encoding, the model "sees" the simplified graph structure, which is easier to solve than the original complex one.
  • Efficiency vs. Accuracy Trade-off: Re-encoding at every step would be computationally prohibitive. The authors found that re-encoding only when the vehicle returns to the depot provides a significant performance boost without making the inference time explode.
  • Generalization via Incrementalism: Because the model learns to solve the "remaining" part of a problem, a model trained on 100 nodes performs surprisingly well on 20 or 50 nodes, as it essentially treats the smaller problems as the "tail end" of a larger route.

Key Results

AM-D consistently outperformed the vanilla Attention Model (AM) and other RL baselines:

  • Optimality Gap: On VRP100, AM-D reduced the optimality gap to 4.79% (compared to 7.34% for the standard AM).
  • Refinement: When combined with a simple 2OPT local search, the gap for VRP100 dropped further to 3.96%.
  • Speed: While training is intensive (250 hours for VRP100), the actual inference (testing) is lightning-fast. Solving a VRP20 instance takes only 0.29 milliseconds, making it viable for real-time logistics applications.

Limitations and Future Work

  • Training Time: The dynamic re-encoding significantly increases the training burden. The authors suggest that parallel computing techniques will be necessary to scale this to much larger instances (e.g., 500+ nodes).
  • Trigger for Re-encoding: Currently, the model re-encodes only at the depot. Future research could explore more flexible triggers for re-encoding based on the "entropy" or change in the graph state.
  • Complexity of Constraints: This paper focuses on the simplest capacitated VRP. Real-world logistics involve time windows, heterogeneous fleets, and stochastic demands, which the authors aim to address in future iterations.

Summary updated

BibTeX
@inproceedings{peng2019deep,
  author = {Bo Peng and Jiahai Wang and Zizhen Zhang},
  title = {{A Deep Reinforcement Learning Algorithm Using Dynamic Attention Model for Vehicle Routing Problems}},
  booktitle = {ISICA},
  year = {2019},
  url = {https://openreview.net/forum?id=LIx6Y0OHj8q},
}

Loading related content...

Figure