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

Hybrid Genetic Search for the CVRP: Open-Source Implementation and SWAP* Neighborhood

Thibaut Vidal · DOI

Abstract: The vehicle routing problem is one of the most studied combinatorial optimization topics, due to its practical importance and methodological interest. Yet, despite extensive methodological progress, many recent studies are hampered by the limited access to simple and efficient open-source solution methods. Against this background, we introduce a simple, open-source implementation of the hybrid genetic search (HGS) specialized to the capacitated vehicle routing problem (CVRP). This state-of-the-art algorithm uses the same general methodology as Vidal et al. (2012) but also includes additional methodological improvements and lessons learned over the past decade of research. In particular, it includes an additional neighborhood called SWAP which consists in exchanging two customers between different routes without an insertion in place. As highlighted in our study, an efficient exploration of SWAP moves significantly contributes to the performance of local searches. Moreover, as observed in experimental comparisons with other recent approaches on the classical instances of Uchoa et al. (2017), HGS still stands as a leading metaheuristic regarding solution quality, convergence speed, and conceptual simplicity.

Introduction

The Capacitated Vehicle Routing Problem (CVRP) is a fundamental challenge in logistics: determining the most cost-effective way to deliver goods to customers using a fleet of limited-capacity vehicles. While the field has seen significant algorithmic advances, researchers often face hurdles regarding the complexity and reproducibility of top-tier methods. Furthermore, standard local search techniques frequently struggle with local minima. This paper addresses these issues by introducing HGS-CVRP, a high-performance, open-source C++ implementation that prioritizes both performance and accessibility.

The Hybrid Genetic Search Framework

The algorithm is built on the Hybrid Genetic Search (HGS) framework, which synergizes the global exploration capabilities of genetic algorithms with the intensive local refinement of neighborhood searches.

As illustrated in Figure 1, the HGS process is an iterative loop. It begins with a population divided into feasible and infeasible individuals. The search proceeds by selecting parents based on cost and diversity, applying crossover operators, and then "educating" the resulting offspring through a local search phase. A critical component of this framework is the maintenance of population diversity, which prevents premature convergence and allows the algorithm to escape local optima more effectively than traditional methods.

General structure of the hybrid genetic search

The SWAP* Neighborhood

The primary methodological innovation presented is the SWAP neighborhood. Traditional swap moves exchange the positions of two customers "in place." In contrast, SWAP allows two customers from different routes to be exchanged and then re-inserted into the best possible positions within their new respective routes.

While a naive exploration of this neighborhood would be computationally prohibitive ($O(n^4)$), the implementation utilizes a pruning theorem. This theorem proves that the optimal new position for a customer is either its counterpart's previous position or one of the top three insertion spots identified during a preprocessing phase. This allows the algorithm to explore a massive search space in sub-quadratic time, as detailed in the search phase algorithm shown in Figure 2.

Algorithm for the efficient exploration of the SWAP* neighborhood

Experimental Results

The HGS-CVRP algorithm was evaluated on the 100 classical benchmark instances of Uchoa et al. (2017). The results demonstrate state-of-the-art performance:

  • Solution Quality: The algorithm achieved an average gap of only 0.11% from the Best Known Solutions (BKS) across all benchmarks.
  • New Benchmarks: During testing, the algorithm discovered 17 new Best Known Solutions, which have since been adopted by the official CVRPLib repository.
  • Efficiency: The SWAP* neighborhood proved highly effective, accounting for approximately 15% of all solution improvements while consuming less than 32% of the total computational time.
  • Robustness: By intentionally exploring "infeasible" solutions with linear penalties, the search can "tunnel" through restricted regions of the search space to find high-quality feasible solutions.

Conclusion

HGS-CVRP provides a transparent and powerful tool for the optimization community. By combining a robust genetic framework with the efficient SWAP* neighborhood, it achieves leading results on standard CVRP benchmarks. Future work will focus on extending this framework to more complex variants, such as those involving time windows or heterogeneous fleets, and further refining sub-quadratic search strategies.

Summary updated

BibTeX
@article{vidal2020hybrid,
  author = {Thibaut Vidal},
  title = {{Hybrid Genetic Search for the CVRP: Open-Source Implementation and SWAP* Neighborhood}},
  journal = {Comput. Oper. Res.},
  year = {2020},
  doi = {10.1016/j.cor.2021.105643},
}
Figure