Skip to content

A column generation algorithm (CG) for the capacitated vehicle routing problem (CVRP)

Notifications You must be signed in to change notification settings

Pigzaum/cg_cvrp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capacitated vehicle routing problem (CVRP) column generation algorithm

A C++ implementation of a column generation algorithm for the CVRP [1] using GUROBI's API and CVRPSEP package [2]. In addition, this code uses the LKH heuristic [4] to compute the TSP cost of the initial pool of columns. Note that the LKH code is distributed for academic and non-commercial use only.

Column generation algorithm (CG)

Following [1], this code uses a set covering model as the restricted main problem (RMP). Let $G = (V, E)$ be an undirected graph, $K$ a set of vehicles with capacity of $Q$, and let vertex 0 be the depot and vertices $V' = V \setminus {0}$ be the customers. Consider that there is a demand $d_i$ for each $i \in V'$ and there is a cost $w_ij$ associated to each edge $(i, j) \in E$. Also, let $R$ be a set of routes and $c_r$ the cost of route $r \in R$. The RMP is defined as below:

$$ \begin{align} \min & \sum\limits_{r \in R} c_{r} y_r \\ \text{subject to} & \nonumber \\ & \sum\limits_{r \in R} a_{ir} y_r \geq 1, & \forall i \in V, \\ & \sum\limits_{r \in R} y_r \leq K, \\ & y_r \geq 0, & \forall r \in R. \end{align} $$

The initial RMP pool of columns $R$ is generated as following. First, each vertex is randomly assigned to one of the $|K|$ vehicles where the capacity can hold the vertex demand. Then, we use the LKH [4] algorithm to find a route (TSP solution) for each vehicle.

A new column is generated by solving the subproblem. Here, a prize collecting travelling salesman problem (PCTSP) is solved using the dual values ($\pi_i$) of the main problem as the visiting prizes as described by [1, 5]. The PCTSP formulation is defined as follows:

$$ \begin{align} \min & \sum\limits_{(i, j) \in E} w_{ij} x_{ij} - \sum_{i \in V'} \pi_i z_i\\ \text{subject to} & \nonumber \\ & z_0 = 1, \\ & \sum_{(i, j) \in E} x_{ij} = 2z_i, & \forall i \in V, & \\ & \sum\limits_{i \in V} d_i z_i \leq Q, \\ & \sum\limits_{(i, j) \in S} x_{ij} \leq \sum\limits_{i \in S} z_i - 1, & \forall S \subseteq V', |S| \geq 2, \\ & x_{ij}, z_k \in {0, 1}, & (i, j) \in E, k \in V. \end{align} $$

The subtour elimination constraints (9) are separeted using the CVRPSEP package. In this code it is used this fork of the CVRPSEP package which fixes some minor issues. Please refer to [3] for further details.

Prerequisites

  • CMake.

  • C++17 compiler or an early version.

  • Boost library (program_options)

  • GUROBI solver (9 or an early version). Academics can obtain it via this link.

Compile and run instructions

Go to the source code folder and to compile type:

cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug
cmake --build build

for the debug version or

cmake -H. -Bbuild
cmake --build build

for the release version.

To run with a configuration file:

$ ./build/cg_cvrp -f [configuration file path]

See the "example.cfg" file at the "input" folder for an example of the input configuration file and

$ ./build/cg_cvrp --help

to see usage.

References

[1] P. Toth and D. Vigo. The Vehicle Routing Problem, Discrete Mathematics and Applications, SIAM, 2002

[2] J. Lysgaard, A.N. Letchford and R.W. Eglese. A New Branch-and-Cut Algorithm for the Capacitated Vehicle Routing Problem, Mathematical Programming, vol. 100 (2), pp. 423-445

[3] CVRPSEP package SAS software repository.

[4] Lin-Kernighan heuristic (LKH) for solving the traveling salesman problems.

[5] Bixby, A.E., Coullard, C., Simchi-Levi, D. The capacitated prize-collecting traveling salesman problem. Working paper, Department of Industrial Engineering and Engineering Management, Northwestern University, 1997.

About

A column generation algorithm (CG) for the capacitated vehicle routing problem (CVRP)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published