CS 286P Final Project
Capacitated Vehicle Routing
Metaheuristics or Column Generation
Amelia Regan, Julian Yarkony
December 2, 2021
1 The Problem
We now consider the Capacitated Vehicle Routing Problem (CVRP) which is defined as follows. We are
given a set of items, and a starting/ending depot embedded in a metric space. Each item is associated with
an integer demand and the vehicles have a common capacity. We seek to partition the items into ordered
lists of items called routes each serviced by a unique vehicle so as to minimize the total distance traveled
while ensuring that no vehicle services more demand than it has capacity. The number of vehicles used is
bounded.
We now consider the mathematical description of the CVRP. We use N to denote the set of items, which
we index by u. We define N+ to be N augmented with the starting depot, and ending depot which are
denoted −1,−2 respectively (and are typically the same place). Items and depots are embedded on a metric
space, and hence distances between them satisfy the triangle inequality. We use cuv to denote the distance
between any pair of u, v each of which lie in N+. Each item is associated with an integer demand du, which
1
lies in the set of unique demands D where D0 is the capacity of a vehicle. A route is feasible if it satisfies
the following.
• The route starts and ends at the starting/ending depot respectively.
• The route visits an item no more than once.
• The route services total demand that does not exceed D0.
We denote the set of routes with Ω, which we index by l. We describe the mapping of items to routes using
aul ∈ {0, 1} where aul = 1 if and only if route l contains item u for any u ∈ N. For short hand we use
Nl = {∀u ∈ N s.t. aul = 1} meaning that Nl is the set of items serviced by l. For any u, v pair where each
lie in N+ we set auvl = 1 IFF v follows u immediately in route l and otherwise set auvl = 0. The cost of a
route is denoted cl is defined as the total distance traveled, which we write formally as follows.
cl =
∑
u∈N+
v∈N+
cuvauvl ∀l ∈ Ω (1)
The constraint that a route services no more demand than D0 is written below using du to denote the demand
of item u.
∑
u∈N
duaul ≤ D0 ∀l ∈ Ω (2)
A set of routes provides a feasible solution to CVRP if it services every item at least once and uses no more
than K routes where K is the number of vehicles available. We describe a solution to CVRP using decision
variables θl ∈ {0, 1} where θl = 1 indicates that route l is selected and otherwise θl = 0. We write the
selection of the optimal solution below as follows with annotation describing the equations subsequently.
min
θ∈{0,1}
∑
l∈Ω
clθl (3a)
∑
l∈Ω
aulθl ≥ 1 ∀u ∈ N (3b)
∑
l∈Ω
θl ≤ K (3c)
In (3a) we seek to minimize the total cost of the routes selected. In (3b) we ensure that every item is covered
at least once. We should note that in any optimal solution that each item is covered exactly once since cl
increases as Nl grows. ...
CS 286P Final ProjectCapacitated Vehicle RoutingMetahe
1. CS 286P Final Project
Capacitated Vehicle Routing
Metaheuristics or Column Generation
Amelia Regan, Julian Yarkony
December 2, 2021
1 The Problem
We now consider the Capacitated Vehicle Routing Problem
(CVRP) which is defined as follows. We are
given a set of items, and a starting/ending depot embedded in a
metric space. Each item is associated with
an integer demand and the vehicles have a common capacity.
We seek to partition the items into ordered
lists of items called routes each serviced by a unique vehicle so
as to minimize the total distance traveled
while ensuring that no vehicle services more demand than it has
capacity. The number of vehicles used is
bounded.
We now consider the mathematical description of the CVRP.
We use N to denote the set of items, which
2. we index by u. We define N+ to be N augmented with the
starting depot, and ending depot which are
denoted −1,−2 respectively (and are typically the same place).
Items and depots are embedded on a metric
space, and hence distances between them satisfy the triangle
inequality. We use cuv to denote the distance
between any pair of u, v each of which lie in N+. Each item is
associated with an integer demand du, which
1
lies in the set of unique demands D where D0 is the capacity of
a vehicle. A route is feasible if it satisfies
the following.
• The route starts and ends at the starting/ending depot
respectively.
• The route visits an item no more than once.
• The route services total demand that does not exceed D0.
We denote the set of routes with Ω, which we index by l. We
describe the mapping of items to routes using
aul ∈ {0, 1} where aul = 1 if and only if route l contains item u
for any u ∈ N. For short hand we use
Nl = {∀ u ∈ N s.t. aul = 1} meaning that Nl is the set of items
serviced by l. For any u, v pair where each
3. lie in N+ we set auvl = 1 IFF v follows u immediately in route l
and otherwise set auvl = 0. The cost of a
route is denoted cl is defined as the total distance traveled,
which we write formally as follows.
cl =
∑
u∈ N+
v∈ N+
cuvauvl ∀ l ∈ Ω (1)
The constraint that a route services no more demand than D0 is
written below using du to denote the demand
of item u.
∑
u∈ N
duaul ≤ D0 ∀ l ∈ Ω (2)
A set of routes provides a feasible solution to CVRP if it
services every item at least once and uses no more
than K routes where K is the number of vehicles available. We
describe a solution to CVRP using decision
variables θl ∈ {0, 1} where θl = 1 indicates that route l is
selected and otherwise θl = 0. We write the
selection of the optimal solution below as follows with
annotation describing the equations subsequently.
4. min
θ∈ {0,1}
∑
l∈ Ω
clθl (3a)
∑
l∈ Ω
aulθl ≥ 1 ∀ u ∈ N (3b)
∑
l∈ Ω
θl ≤ K (3c)
In (3a) we seek to minimize the total cost of the routes selected.
In (3b) we ensure that every item is covered
at least once. We should note that in any optimal solution that
each item is covered exactly once since cl
increases as Nl grows. In (3c) we enforce that no more than K
routes are used.
2
2 The Assignment
2.1 Option I.
5. • 1. Develop the metaheuristic of your choice to solve this
problem.
• 2. Some suggestions:
– GRASP
– Genetic Algorithm
– Ant Colony Optimization
– Tabu Search
• 3. Whatever choice you make, you will need to examine some
of your implementation choices.
– Parameters are choices but we are interested in
– Route construction choices
– Post processing route improvement choices
2.2 Option II.
Continue your exploration of Column Generation by
implementing a simple version of that method.
Below we discuss how to go about that.
We solve (3) via solving the linear programming (LP)
relaxation, which is referred to as the master
problem (MP). This LP relaxation is very tight in practice. We
write the MP below with dual variables
written in brackets ([]) after the equations.
6. min
θ≥0
∑
l∈ Ω
clθl (4a)
∑
l∈ Ω
aulθl ≥ 1 ∀ u ∈ N [πu] (4b)
∑
l∈ Ω
θl ≤ K [−π0] (4c)
We write the dual form of (4) below.
max
π≥0
−Kπ0 +
∑
u∈ N
πu (5a)
cl + π0 −
∑
u∈ N
aulπu ≥ 0 ∀ l ∈ Ω (5b)
7. 3
Since the set of routes (Ω) grows exponentially in the number of
items we cannot trivially solve (4).
Instead column generation (CG) is employed to solve (4). CG
constructs a sufficient subset of Ω denoted
ΩR s.t. solving (4) over ΩR provides an optimal solution to (4)
over Ω. To construct ΩR, we iterate
between (1) solving (4) over ΩR, which is referred to as the
restricted master problem (RMP) and (2)
identifying variables with negative reduced cost, which are then
added to ΩR. Typically the lowest
reduced cost column is generated. We write the selection of this
column as optimization below using
c̄ l to denote the reduced cost of column l.
min
l∈ Ω
c̄ l (6a)
c̄ l = cl + π0 −
∑
u∈ N
aulπu (6b)
The operation in (6) is referred to as pricing. One or more
8. negative reduced cost columns are generated
during pricing. CG terminates when pricing finds no column
with negative reduced cost. This certifies
that CG has produced the optimal solution to (4). We write
pricing as an integer linear program
(ILP) in Appendix 2.2.1 though it is often solved with a
resource constrained shortest path solver (?).
We terminate CG when no l in Ω has negative reduced cost. CG
initializes ΩR with a heuristically
generated feasible integer solution or using artificial variables
that have prohibitively high cost but
ensure a feasible solution. In Alg 1 we describe CG in pseudo-
code.
4
Algorithm 1 Basic Column Generation
1: ΩR ← from user
2: repeat
3: Solve for θ, π using (4),(5) over ΩR
4: l∗ ← minl∗Ω c̄ l
5: ΩR ← ΩR ∪ l∗
6: until c̄ l∗ ≥ 0
7: Return last θ generated.
2.2.1 Pricing as an Integer Linear Program
9. We now consider the solution to pricing 6 as an integer linear
program (ILP).
We use decision variable xuvd if the generated route services u
then v and contains exactly d units of
demand after leaving u. The following combinations of u, v, d
exist
– xuvd exists if dv ≤ d ≤ D0 −du where d−1 = d−2 = 0
The set of valid combinations of u, v, d is denoted P . We define
c̄ uv to be the cost of traveling from u
to v minus the additional cost corresponding to dual variables.
c̄ uv = cuv −πv∗(u, v, d) ∗ P, v ̸= −2 (7a)
c̄ uv = cuv + π0∀ (u, v, d) ∈ P, v = −2 (recall v=-2 is the end
depot) (7b)
We write the lowest reduced cost resource constrained shortest
path as pricing below in the form of an
ILP which we annotate below.
min
x∈ {0,1}
∑
u,v,d∈ P
c̄ uvxuvd (8a)
∑
u,v,d∈ P
10. xuvd ≤ 1 ∀ u ∈ N (8b)
∑
−1,v,d∈ P
x−1vd ≤ 1 (8c)
∑
u∈ N
xuvd =
∑
u∈ N
xv,u,d−dv ∀ v ∈ N, d ≥ dv (8d)
In (8a) we minimize the reduced cost of the route. In (8b) we
ensure that an item is visited no more
than once. In (8c) we ensure that up to no more than one route
is selected by ensuring that no more
than one unit of flow leaves the start depot. In (8d) we ensure
that the solution describes a route by
enforcing the flow constraint.
5
We should note that for small problems, the solution of (8) can
be solved using a commercial solver
such as Gurobi or C-Plex but for larger problems we would
11. develop our own solutions.
6
3 Results
Present your results in the following way:
– Introduction – Discuss the heuristic you are using (or CG)
– Discuss Sources of Information – Papers, Codes
– Discuss any choices you made for the metaheuristics
(parameters, route construction, route im-
provement, parallelization etc.)
– Present your results (see the table below)
– Summarize – Discuss any insights gained
– Discuss the role of each member of the group in the project
– Include Your codes
Problem Instance Objective Function Value Best known
Solution
Time to