Upload
doandung
View
232
Download
1
Embed Size (px)
Citation preview
1
Vehicle Routing ProblemsMassimo Paolucci([email protected])
010-353 2996
DIST – Università di Genova
2VRP – Massimo Paolucci
Vehicle Routing ProblemsVehicle Routing Problems (VRP) deal with the management of pickup and/or delivery activities
Critical problems, in particular in short distance transportation
Operational decisions: how the available fleet of vehicles (resources) can be efficiently used to satisfy a given service demand according to a set of operational requirements?
Vehicle Routing: define the routes and possibly the schedule for the available vehicles
2
3VRP – Massimo Paolucci
Vehicle Routing ProblemsVRPs include:
Static problems: the service demand is fixed and a priori knownDynamic problems: all or part of the service demand may become known when the vehicles have already started their service (the vehicle routes may be defined or changed on-line)
Main assumptions for the problems considered in the following:
The problems are staticThe available vehicles are homogeneous (every vehicle provide the same kind of service)
4VRP – Massimo Paolucci
VRP – Characteristics and ComponentsFreight transportation provided by vehicles through a route network
Main components:Road networkCustomersVehiclesDepotsDriversOperational constraints:
globalfor single routes
Optimization objectives
3
5VRP – Massimo Paolucci
VRP – Characteristics and ComponentsThe road network:
A graph G=(V, A), G=(V, E) or G=(V, A∪ E)Directed, undirected or mixedSparse vs Dense
Sparse ⇒ |A|=O(|V|)Dense ⇒ |A|=O(|V|2)
Undirected graph: large scale road network (countries, regions)
Directed graph:small scale road network (cities)
6VRP – Massimo Paolucci
The road network:Vertices
depots, customers, road intersectionsV={0, 1, …, n}
Arcsroadsdirected (i, j)∈A or undirected e∈Elength, or travel cost cij ∀ (i, j)∈Atravel time tij ∀ (i, j)∈A
VRP – Characteristics and Components
cijj0 i
4
7VRP – Massimo Paolucci
VRP – Characteristics and Components
The road network:The triangle inequality
ji
k
cij
cik ckj
cij ≤ cik + ckj ∀i, j, k
8VRP – Massimo Paolucci
VRP – Characteristics and ComponentsCustomers:
The entities requiring service Associated with vertices or arcs Service demand ⇒ quantity of goods or materials to be delivered or picked upCharacteristics:
Service time windowsDesired service start time (with penalties)Service time (load/unload)Vehicle compatibilityPossibility of splitting service
5
9VRP – Massimo Paolucci
VRP – Characteristics and Components
Vehicles:Fleet size (fixed or variable)Company or outsourced fleet (fixed vehicle cost)Depot of reference (single, multiple, possibility of change)Vehicle capacity (maximum load allowed; weight, volume)Freight compatibility (perishable goods, dangerous materials)Compatibility with streetsLoad/unload procedureCosts (associated with mileage, time, fuel, journey, load)
10VRP – Massimo Paolucci
VRP – Characteristics and ComponentsDrivers
Employee workers or vehicle ownersUnion and contract conditionsWorking periods, shifts and breaksAvailability and possibility of overtime
DepotsSingle or multipleNumber and type of available vehiclesSet of a priori assigned customers
⇒ decomposable problems
6
11VRP – Massimo Paolucci
VRP – Characteristics and ComponentsOperational constraints
Relevant to:the nature of transportthe quality of servicethe driver working contract
Two classes of constraints:Local constraints (single route)Global constraints (the whole set of routes)
12VRP – Massimo Paolucci
VRP – Characteristics and ComponentsOperational constraints
Local constraints (single route)vehicle capacitymaximum allowed route distance/durationtime constraints (arrival, departure, time windows) kind of service (pickup, delivery or both)precedence among customers:
pickup and deliverylinehaul/backhaul
Global constraints (whole set of routes)maximum number of vehiclesmaximum number of routes (for vehicle or depot)workload balancingworking periods and shifts (minimum time between routes)
7
13VRP – Massimo Paolucci
VRP – Characteristics and ComponentsObjectives
Minimize: the global transportation cost + drivers and vehicles fixed costsMinimize: the number of vehicles and/or driversBalancing of the routesMinimize: penalties for not/partially served customers
⇒ Conflicting objectives
14VRP – Massimo Paolucci
VRP – Characteristics and ComponentsOther characteristics
Service split on several daysMore routes for vehicles in a dayMore requests for a customerDemand partially or not a priori known (dynamic, on-line problems)Stochastic and/or time dependent arc costs/travel times
8
15VRP – Massimo Paolucci
The General Vehicle Routing Problem Problem formulation
Given a generic graph G=(V, A∪E) determine a minimum cost set of M cycles (routes) that serve the required vertices U⊆V and the required edges R⊆A∪E satisfying a set of operational constraintsCost of a route = the sum of the cost of the edges belonging to the route
Applications: collection and delivery of goodswaste collectionstreet cleaningschool-bus routingdial-a-ride systemstransportation of people with handicaprouting of salespeople
16VRP – Massimo Paolucci
The General Vehicle Routing ProblemTwo main classes of problems
Node Routing Problem (NRP)Customers/demand concentrated in sites associated with vertices
only required vertices U, R=∅frequently denoted as VRP or Vehicle Scheduling Problem
Arc Routing Problem (ARP)Customers/demand evenly distributed along the edges
only required edges R, U=∅
The problems without operational constraints:NRP reduces to Traveling Salesman Problem (TSP)ARP reduces to Rural Chinese Postman Problem (RCPP)ARP with R=A reduces to Chinese Postman Problem (CPP)
9
17VRP – Massimo Paolucci
The Node Routing Problems-
The Traveling Salesman Problem (TSP)The Capacitated Vehicle Routing Problem (CVRP)
Characteristics
Models
Algorithms (heuristics)
18VRP – Massimo Paolucci
VRP – Node routing problemsIt concerns the distribution/collection of goodsMain components:
VehiclesDepotsDriversRoad Network
Solution:A set of routes performed by a fleet of vehicles such that:
each route starts and ends at vehicles’ depotsthe customers’ requirements are satisfiedthe operational constraints are fulfilledthe global transportation cost is minimized
10
19VRP – Massimo Paolucci
VRP – Node routing problemsRelationships among the basic VRP (NRP) problems
TSPTW
CVRP
TSP
MTSP
TSPB
DCVRP
VRPPD
VRPTW
VRPB
VRPPDTWVRPBTW
Backhauling Time windows
M vehcles
Vehicle capacity
Route length
Time windows
Backhauling
Mixed service
20VRP – Massimo Paolucci
VRP – Node routing problemsTraveling Salesman Problem (TSP)Traveling Salesman Problem with Backhauls (TSPB)Traveling Salesman Problem with Time Windows (TSPTW)Multiple Traveling Salesman Problem (MTSP)Capacitated Vehicle Routing Problem (CVRP)Distance Constrained Vehicle Routing Problem (DCVRP)Vehicle Routing Problem with Backhauls (VRPB)Vehicle Routing Problem with Time Windows (VRPTW)Vehicle Routing Problem with Pickup and Delivery (VRPPD)
11
21VRP – Massimo Paolucci
VRP – Node routing problemsRoad graph
G=(V,A) (strongly) connected → G’=(V, A’) completeV ={0,1,...,n} , |V| = n+1, set of vertices
0 the depot
1,..., n customers’ locations (cities)
∀(i, j)∈A’ cij≥0 is a positive minimum cost (distance) of traveling from city i to city j
22VRP – Massimo Paolucci
VRP – Node routing problemsRoad graph
if G’=(V, E’) undirected define∀i∈V δ(i)={(i, j): (i, j)∈E’} star of i
if G’ =(V, A) directed define∀i∈V δ+(i)={(i, j): (i, j)∈A’} forward star of i
∀i∈V δ-(i)={(j, i): (j, i)∈A’} backward star of i
∀S⊆V
δ(S)={(i, j): (i, j)∈A’ i∈S j∉S}∪{(i, j): (i, j)∈A’ i ∉S j∈S}
12
23VRP – Massimo Paolucci
VRP – Node routing problems
Triangle Inequality (TI)Given G=(V, A’) complete ∀(i, j, k)∈V such that i≠j ≠k
cij ≤ cik + ckj
TI is satisfied if G’ is derived from G by the computation of the shortest paths between each pair of vertices
Euclidean problemif the vertices are associated with points in a plane and the cost is given by the euclidean distance between two points (the cost matrix is symmetric)
24VRP – Massimo Paolucci
VRP – Node routing problemsTSP (node routing problems without operational constraints)
A traveling salesman must visit his customers located in different cities and come back homeSingle vehicleRoad graph G=(V, A) → G’=(V, A’) complete
V = customers’ cities and TS home (depot); |V|=n∀(i, j)∈A’ cij≥0 the minimum cost (distance) of traveling from city
i to city j
Solution: a minimum cost route which starts and ends at depot and reaches each customer
13
25VRP – Massimo Paolucci
VRP – Node routing problemsTSP (node routing problems without operational constraints) (cont.)
Feasible solutions in G’: any hamiltonian circuit in G’Hamiltonian circuit: a closed path which visit each vertex exactly once.Solution: the minimum cost hamiltonian circuit in G’Two cases:
G’ directed: asymmetric TSP (ATSP): cij≠cji
G’ undirected: symmetric TSP (STSP): cij=cji
Complexity: Strongly NP-hard optimization problem
26VRP – Massimo Paolucci
VRP – Node routing problemsMTSP (multiple traveling salesmen)
M vehiclesA single common depotEach vehicle (salesman) must visit at least one customer
Solution: M minimum cost routes (tours) which start and end at depot so that each customer is visited exactly once
14
27VRP – Massimo Paolucci
VRP – Node routing problemsCVRP (Capacitated VRP)
K identical vehicles
C vehicle capacity
A single common depot
∀i∈V\{0} customer a demand di≥0 is defined (d0=0) such that di≤C
∀S⊆V define
Each vehicle performs at most one route
K≥Kmin where Kmin is the minimum number of vehicles to serve all the customers
Kmin may be determined solving a Bin Packing Problem (BPP) (NP-hard problem but with fast approximation algorithms)
∑=∈Si
idSd )(
28VRP – Massimo Paolucci
VRP – Node routing problemsCVRP (Capacitated CRP) (cont.)
∀S⊆V\{0} define r(S) the minimum number of vehicles to serve the customers in S
trivial bound
Solution: a set of exactly K routes (circuits) with minimum cost such that:
(a) each circuit visits the depot
(b) each customer is visited by exactly a single route
(c) the sum of the customer demands visited by a route does not exceed C
⎥⎥⎤
⎢⎢⎡=
CSdSr )()(
15
29VRP – Massimo Paolucci
VRP – Node routing problemsCVRP (Capacitated CRP) (cont.)
Simple variants:If K>Kmin some vehicle may not be used
find at most K routes
fixed costs for using vehicles
find the minimum number of routes
Different vehicle capacities Ck k=1,...,K
The routes must contains more than a single customer
Complexitythe CVRP is a Strongly NP-hard optimization problem
it generalizes the TSP
30VRP – Massimo Paolucci
VRP – Node routing problemsDCVRP (Distance Constrained VRP)
A variant of CVRP:the capacity constraints is replaced by a maximum route length (time) constraint
∀(i, j)∈A’ tij≥0 the length (time) to travel from i to j
T = maximum route length (time)
Tk k=1,..,K if the vehicles are different
∀i∈V customer, a service time si may be defined explicitly or added to the travel times (t’ij= tij + si/2 + sj/2 )
The cost usually coincides with length (time)
Solution: the minimum total length (time) solution as for CVRP
DC-CVRP: both distance and capacity of vehicles are constrained
16
31VRP – Massimo Paolucci
VRP – Node routing problemsVRPTW (VRP with time windows)
A variant of CVRP:∀i∈V customer, a time window (TW) is defined as the time interval [ai, bi]
∀i∈V\{0} customer, a service time si is given
∀(i, j)∈A’ tij≥0 a travel time is given
the service for each customer must start within his TW
in case of early arrival the vehicle must wait time instant ai before starting the service
the routes starts at time 0
Travel times usually coincide with costs
TWs induce an implicit orientation (an asymmetric model can be used)
32VRP – Massimo Paolucci
VRP – Node routing problemsVRPTW (VRP with time windows) (cont.)
A variant of CVRP:Solution: a set of exactly K routes (circuits) with minimum cost such that:
(a) each circuit visits the depot
(b) each customer is visited by exactly a single route
(c) the sum of the customer demands visited by a route does not exceed C(e) for each customer the service starts within the TW [ai, bi] and the vehicle stops si time instants
Complexity: Strongly NP-hard generalizes CVRP (ai=0 bi=∞)
TSPTW is the special case for K=1 and C≥d(V)
17
33VRP – Massimo Paolucci
VRP – Node routing problemsVRPB (VRP with backhauls)
An extension of CVRP:the set of customers is partitioned into Linehaul Customers (LC) and Backhaul Customers (BC)
V=L∪B |L|=n |B|=m
LC require a quantity of goods to be delivered
BC require a quantity of goods to be picked up
Precedence constraint among the LC and BC served by the same route:
all LC must be served before any BC
34VRP – Massimo Paolucci
VRP – Node routing problemsVRPB (VRP with backhauls) (cont.)
An extension of CVRP:∀i∈B BC, di is the demand to be collected
∀i∈L LC, di is the demand to be delivered
In general, routes including only BC are not allowed
K≥max[KL, KB] where Kθ is the minimum number of vehicles to serve the customers of type θSolution: a set of exactly K routes (circuits) with minimum cost such that:
(a) each circuit visits the depot
(b) each customer is visited by exactly a single route
(c) the total demand of LC and BC visited by a route do not exceed separately the vehicle capacity C
(d) in each route all the LC must preceede the BC, if any
18
35VRP – Massimo Paolucci
VRP – Node routing problemsVRPB (VRP with backhauls) (cont.)
An extension of CVRP:Complexity: Strongly NP-hard generalizes CVRP (B=∅)
TSPB is the special case for K=1 and C≥max[d(L), d(B)]
36VRP – Massimo Paolucci
VRP – Node routing problemsVRPPD (VRP with Pickup and Delivery)
A further extension of CVRP:each customer is associated with two quantities:
di demand of commodities to be delivered
pi demand of commodities to be picked up
the commodities are assumed homogeneous (sometimes only di= di - pi is specified)
for each customer is defined:Oi vertices that are origin of the delivery demand
Di vertices that are destination of the picked up demand
at each customer location the delivery is performed before the pickup
19
37VRP – Massimo Paolucci
VRP – Node routing problemsVRPPD (VRP with Pickup and Delivery) (cont.)
A further extension of CVRP:Solution: a set of exactly K routes (circuits) with minimum cost such that:
(a) each circuit visits the depot
(b) each customer is visited by exactly a single route
(c) the current load of a vehicle along the circuit is non negative never exceed the vehicle capacity C
(d) ∀ customer i, the customer in Oi (different from the depot) are served in the same circuit before i
(e) ∀ customer i, the customer in Di (different from the depot) are served in the same circuit after i
38VRP – Massimo Paolucci
VRP – Node routing problemsVRPPD (VRP with Pickup and Delivery) (cont.)
A further extension of CVRP:If the origin and destination of demands are common (e.g., the depot) they may be not explicitly considered ⇒ VRP with simultaneous P & D (VRPSPD)
Complexity: Strongly NP-hard generalizes CVRP (Oi= Di={0}, pi=0 ∀i) TSPPD specializes the VRPPD for K=1
20
39VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP VRP (NRP) basic and very important particular case:
single depotsingle vehicleunlimited vehicle capacity (the demand quantities are neglected)objective: find a mininum cost route to serve all the customers
The TSP solution is a minimum cost Hamiltonian circuitComplete graph with n vertices: the solution ≡ a permutation of {1,…, n}The number of possible solutions is (n-1)!
40VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP The TSP is an extensively studied NP-hard problem"[...] the TSP is one of the most intensely studied problems in computational mathematics and yet no effective solution method is known for the general case. Indeed, the resolution of the TSP would settle the P versus NP problem and fetch a $1,000,000 prize from the Clay Mathematics Institute (www.claymath.org/millennium/).[...] for over 50 years its study has led the way to improved solution methods in many areas of mathematical optimization." (www.tsp.gatech.edu//index.html)
21
41VRP – Massimo Paolucci
The Traveling Salesman Problem - TSPThe currently largest instance ever solved:the tour visiting all the 24.978 cities in Sweden (2004)
"The majority of the work was carried out on a cluster of 96 dual processor Intel Xeon 2.8 GHz workstations at Georgia Tech's School of Industrial and Systems Engineering"...
“The cumulative CPU time used in the five branch-and-cut runs and in the cutting-plane procedures for the five root LPs was approximately 84.8 CPU years on a single Intel Xeon 2.8 GHz processor. ”(www.tsp.gatech.edu//index.html)
42VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP Two cases depending on the structure of the cost matrix:
ATSP : Asymmetric TSPdirected graph G=(V,A)∀(i, j)∈A cij≠cji or cij=cji
TSP o STSP : Symmetric TSPundirected graph G=(V,E)∀ (i, j)∈E cij=cji
22
43VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP The TSP is a Strongly NP-hard problem
How to solve it?Exact algorithms are based on Mixed Integer Programming (MIP) formulations and branch and cut approachesHeuristics approaches:
constructive heuristicsimprovement heuristicsmetaheuristics
44VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP Heuristics vs Exact algorithms
Heuristic algorithms should be used when:the problem dimensions exceed the maximum dimensions which can be dealt with exact approaches in acceptable computation timesthe problem, although of limited dimensions, must be solved in a very short computation timethe problem data are approximated (seeking for optimality is not worthy)there are problem variations for which exact approach cannot be easily extendedthe problem is dynamic
23
45VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP The study of MIP formulations can provide insights for a better understanding of the problem properties and lead to the computations of Lower Bounds
Lower bounds provide an estimation of the quality of sub-optimal solution and are fundamental in branch & bound or branch & cut approaches
Z*TSP optimal solutionZLB lower boundZTSP a feasible sub-optimal solutionZLB≤ Z*TSP≤ ZTSP
LB
LBTSP
Z
ZZ −
46VRP – Massimo Paolucci
The Traveling Salesman Problem - TSP Two MIP formulations
MIP formulation for the ATSPMIP formulation for the STSP
24
47VRP – Massimo Paolucci
ATSP – MIP formulation Directed and complete graph G’=(V,A’)
|V|=n|A’|=n⋅(n-1) cij=cji or cij≠cji
The solution is an hamiltonian circuit with minimum cost
VariablesBinary variables xij ∀(i, j)∈A’
⎩⎨⎧
=01
ijxif vertex j is visited immediately after vertex i
otherwise
48VRP – Massimo Paolucci
ATSP – MIP formulation Objective function
Find the solution that minimizes Z
ijAjiij xcZ ∑
∈=
'),(
2 1
65
4
3
0
12c32c
34c
45c56c
60c
01c
ijAjiijATSP xcZ ∑
∈=
'),(
* min
25
49VRP – Massimo Paolucci
ATSP – MIP formulation Constraints - Degree constraints
In a hamiltonian circuit each vertex is visited only once:
Vix
Vjx
iVjij
jViij
∈∀=
∈∀=
∑
∑
∈
∈
1
1
}{\
}{\
i
)(iδ)(i−δ )(i+δ
50VRP – Massimo Paolucci
ATSP – MIP formulationConstraints - STE
Degree constraints are not sufficient ...
Subtour Elimination Constraints (STE)Two classes of connectivity STE (cardinality of exponential order)A class of polynomial order cardinality STE
2 0
65
4
3
7
8 1
Subtours
26
51VRP – Massimo Paolucci
ATSP – MIP formulationConstraints – STE – Connectivity contraints
Connectivity constraints are defined for any proper subset of vertices with at least two vertices
2||,1 ≥⊂∀≥∑ ∑∈ ∉
SVSxSi Sj
ijS
2||,1|| ≥⊂∀−≤∑ ∑∈ ∈
SVSSxSi Sj
ij S
Note that the orientations must satisfy the degree contraints
1)( ≥Sδ
52VRP – Massimo Paolucci
ATSP – MIP formulationConstraints – STE – Connectivity constraints
Drawback: the number of connectivity constraints grows as the number of subset of a given set ⇒ O(2|V|)
Example: A choice of S satisfying the connectivity constraints
2 0
65
4
37
8 1
S
27
53VRP – Massimo Paolucci
ATSP – MIP formulationConstraints – STE – Connectivity constraints
2 0
65
4
37
8 1
S
Example: A choice of S not satisfying the connectivity constraints
2 0
65
4
37
8 1
S
STE
Degree
54VRP – Massimo Paolucci
ATSP – MIP formulationConstraints – STE – Polynomial cardinality constraints (Miller, Tucker, Zemlin, 1960)
a new set of real variables is needed: ui ∀i∈V\{0}, ui ≥ 0(n-1)⋅(n-2) ⇒ O(n2) constraints
How these constraints work?they eliminate any circuit not including vertex 0
jiVjinxnuu ijji ≠∈∀−≤⋅+− },0{\,1
2 0
65
4
3
78
1
Example
Not allowed circuit
Allowed circuit
28
55VRP – Massimo Paolucci
ATSP – MIP formulationConstraints – STE – Polynomial cardinality constraints
014849
89898989
7337
5775
4554
3443
≤⇒⋅≤⋅
≤⋅+−≤⋅+−≤⋅+−≤⋅+−
xuuxuuxuuxuu
5
4
3
7
Example: not allowed circuit
73x34x
57x45x
Always false !
56VRP – Massimo Paolucci
ATSP – MIP formulationConstraints – STE – Polynomial cardinality constraints
Only hamiltonian circuits are finally allowedThe values assigned to ui denote the order with which the vertices are visited
3,0..33839
898989
62
2662
1661
8118
2882
==⇒≥−⇒⋅≤⋅+−
≤⋅+−≤⋅+−≤⋅+−
uugeuuuu
xuuxuuxuu2 0
68
1
Example: allowed circuit
28x
81x 16x
29
57VRP – Massimo Paolucci
ATSP – MIP formulationLower bound
Assignment Problem (AP)linear relaxation the STE constraints are eliminated
The solution is binaryThe bound is good for strongly asymmetric cost matrices (<1% from the optimal solution)
10
1
1
min
}{\
}{\
'),(
≤≤
∈=
∈=
∑
∑
∑
∈
∈
∈
ij
iVjij
jViij
ijAjiij
x
Vix
Vjx
xc
58VRP – Massimo Paolucci
ATSP – MIP formulationAn example
a complete graph
a MIP formulation with a mathematical modelling language and a solver (Lingo – www.lindo.com)
2
1
34
5
6
0 702 454 842 2396 1196
702 0 324 1093 2136 764
454 324 0 1137 2180 798
842 1093 1137 0 1616 1857
2396 2136 2180 1616 0 2900
1196 764 798 1857 2900 0
A (symmetric) cost matrix
30
59VRP – Massimo Paolucci
ATSP – MIP formulationAn example
AP relaxation (Z*AP= 5668)
2
1
3 4
5
6
S={1,3}
11 1615141236353432 ≥+++++++⇒≥∑ ∑∈ ∉
xxxxxxxxxSi Sj
ij
60VRP – Massimo Paolucci
ATSP – MIP formulationAn example
STE cut for S={1,3} (Z* = 5950)
2
1
3 4
5
6
S
11 1615141236353432 ≥+++++++⇒≥∑ ∑∈ ∉
xxxxxxxxxSi Sj
ij
112 =x
31
61VRP – Massimo Paolucci
ATSP – MIP formulationAn example
STE cut for S={1,3} (Z* = 5950)
2
1
34
56
S’={4,5}
11 5653525146434241 ≥+++++++⇒≥∑ ∑∈ ∉
xxxxxxxxxSi Sj
ij
62VRP – Massimo Paolucci
ATSP – MIP formulationAn example
STE cut for S={1,3} and for S’={4,5} (Z* = 6610)
2
1
34
56
S’={4,5}
11 5653525146434241 ≥+++++++⇒≥∑ ∑∈ ∉
xxxxxxxxxSi Sj
ij
152 =x
Optimal hamiltonian circuit
32
63VRP – Massimo Paolucci
STSP – MIP formulation Undirected and complete graph G’=(V,E’)
|V|=n|E’|=n⋅(n-1) cij=cji ⇒ ce ∀e∈E’The solution is an hamiltonian circuit with minimum costThe traveling direction is not imposed
VariablesBinary variables xe ∀e∈E’ (one variable for edge)
⎩⎨⎧
=01
exif edge e is in the solution
otherwise
64VRP – Massimo Paolucci
STSP – MIP formulationThe MIP formulation
'
2
min
)(
'
EeBxXx
Vix
xcZ
e
STE
iee
EeeeSTSP
∈∀∈∈
∈=
=
∑
∑
∈
∈
δDegree constraints
i
)(iδ
33
65VRP – Massimo Paolucci
STSP – MIP formulationThe MIP formulation
STEXx ∈
1||)(
−≤∑∈
SxSe
eσ
2)(
≥∑∈ Se
exδ
⎡ ⎤2/||||2, VSVS ≤≤⊂∀
S
2)( ≥Sδ
S
66VRP – Massimo Paolucci
STSP – MIP formulationLower bound
A relaxationMin Hamiltonian Circuit
Min Spanning Tree (MST)
Spanning Treer-Spanning Tree
r
34
67VRP – Massimo Paolucci
STSP – MIP formulationLower bound
A relaxationMin hamiltonian circuit is
an r-spanning treeMin Spanning Tree (MST)
Z*STSP=ZST+ca+cb
r-Spanning Treer
ca cb
Z*MST
Z*STSP≥ Z*MST+ca+cb=Zr-ST
ZST
rca cb
68VRP – Massimo Paolucci
STSP – MIP formulationLower bound
The Z*MST objective is a LB for Z*STSP
The Z*r-ST is a better LB for Z*STSP
The MIP formulation for the Min r-ST (r arbitrary vertex)
'
1||},{\1
2
2
min
)(
)('\
)(
'
EeBx
SrVSx
nx
x
xc
e
See
rEee
ree
Eeee
∈∀∈
≥⊂∀≥∑
−=∑
=∑
∑
∈
∈
∈
∈
δ
δ
δ
Constraints defining a ST for the sub-graph
induced in G’ by V\{r}
Constraint imposing that 2 edges are incident in r
Note that this constraint may be neglected
35
69VRP – Massimo Paolucci
STSP – MIP formulationLower bound
The Min r-ST lower bond can be improved:
Initialize ZLB=-∞
For each i∈V
Find the MST Ti for Gi(V\{i}, Ei) the graph induced in G’ by vertices V\{i}
Find the Min r-ST where r=i adding to Ti the vertex i with 2 edges at minimum cost, and compute Z*r-ST
If ZLB< Z*r-ST then ZLB= Z*r-ST
70VRP – Massimo Paolucci
STSP – MIP formulationLower bound
A simple example
1
34
25
810
3
352
4
1
34
25
810
3
352
4
Z*MST=16
1
34
25
810
3
352
4
Z1-ST=26
36
71VRP – Massimo Paolucci
STSP – MIP formulationA better lower bound: the Held and Karp Bound
The Min r-ST lower bound can be further improved (Lagrangean
relaxation of degree constraints):
Associate a multiplier πi with each vertex i
Replace the costs: c’e= ce+ πi + πj where e=(i, j)∈E’:
every tour increases its cost of
the cost of optimal r-tree changes of where δi is the degree of
vertex i in the r-tree
Then
∑∈Vi
iπ2
∑∈Vi
iiπδ
)(max
)(])2([min
][min2
**
*
*
π
ππδ
πδπ
πwwZ
wZZ
ZZ
STSP
ViiiSTrSTSP
ViiiSTr
ViiSTSP
=≥
=−+≥
+≥+
∑
∑∑
∈−
∈−
∈
is the best lower bound
72VRP – Massimo Paolucci
STSP – MIP formulationA better lower bound: the Held and Karp Bound
The bounding procedure (subgradient optimization)
1. πi=0, i =1, …, n; Set k=0, w(π)=0, and t0 according to (a)
2. Determine the Min r-ST and set w(π)=max{w(π), Z*r-ST(π)}
3. Determine δ ki (the vertices degree at iteration k) for i=1, …, n
4. If δ ki = 2 for i=1, …, n then Z*STSP=w(π) and stop;
Else set k=k + 1;
5. if k>kmax then stop
Else set πi =πi+ tk(δ ki −2) for i=1, …, n and continue with step 2.
20)2(
))((2 ≤<
∑ −−=
∈
αδ
πα
Vi
ki
kwUBt (a)
37
73VRP – Massimo Paolucci
STSP – MIP formulationLower bound
A simple example
Z*1-ST=29=w(π)
δ 1=(2,2,2,2,2)
⇒Z*STSP=29
1
34
25
812
5
443
2
1
34
25
8πi=10+2=12
3+2=5
3+2-1=45-1=42+2-1=3
4-1-1=2
1
34
25
810
3
352
4
πi=0 UB=30
Z*1-ST=26= w(π)
δ 0=(2,2,1,1,4)
1411
)2630(20 ≈
++−=t
πi= πi+t0(δ 0i – 2)
74VRP – Massimo Paolucci
CVRP – MIP formulationCVRP (Capacitated VRP) – Asymmetric network
K identical vehiclesC vehicle capacityA single common depot∀i∈V\{0} customer a demand di≥0 is defined (d0=0) such that di≤CEach vehicle performs at most one routeThe problem: find a set of exactly K routes (circuits) with minimum cost such that:
(a) each circuit visits the depot(b) each customer is visited by exactly a single route(c) the sum of the customer demands visited by a route does not exceed C
A vehicle flow formulationBinary variables xij ∀(i, j)∈A’
⎩⎨⎧
=01
ijxif (i, j) is in the solution
otherwise
38
75VRP – Massimo Paolucci
CVRP – MIP formulationThe solution structure
K=3
101
3 7
4
9
0
2
12
8
11
56CdSd
S
Sii ≤=
=
∑∈ 1
1
1)(
}10,6,1{
CdSdS
Sii ≤=
=
∑∈ 2
2
2)(
}12,11,8,3,2{
CdSdS
Sii ≤=
=
∑∈ 3
3
3)(
}9,7,5,4{
76VRP – Massimo Paolucci
CVRP – MIP formulationA MIP formulation
'),(
|},0{\)(
}0{\1
}0{\1
min
}0{\0
}0{\0
}{\
}{\
'),(
AjiBx
SVSSrx
Kx
Kx
Vix
Vjx
xc
ij
Si Sjij
Vjj
Vii
iVjij
jViij
Ajiijij
∈∀∈
∅≠⊆∀≥
=
=
∈∀=
∈∀=
∑ ∑
∑
∑
∑
∑
∑
∉ ∈
∈
∈
∈
∈
∈
out-degree constr.
in-degree constr.
out-degree of depot (K vehicle must be used)
in-degree of depot
Capacity Cut Constraints (CCC)
39
77VRP – Massimo Paolucci
CVRP – MIP formulationA MIP formulation
The Capacity Cut Constraints impose both the connectivity and the vehicle capacity requirementsr(S) is the minimum number of vehicle needed to serve the vertices in S, found as solution of a BP problem or simply fixed
⎥⎥⎤
⎢⎢⎡=
CSdSr )()(
V\S - S Cut
S
2)( =Sr
V\S
implied by degree constraintsimposed by CCC
∑ ∑∑ ∑∈ ∉∉ ∈
=⇒Si Sj
ijSi Sj
ij xx
78VRP – Massimo Paolucci
CVRP – MIP formulationA MIP formulation
The CCC avoid subtours not including the depot ... e.g.:
S1)( =SrV\S
S
S’
CSdSd ≤+ )'()(S
CSdSdSSSVS
>+≠⊆∀
)'()(',\'
2)'( =∪ SSr S’
40
79VRP – Massimo Paolucci
CVRP – MIP formulationA MIP formulation
Alternative: generalized subtour elimination constraints (GSEC)
The cardinality of CCC and GSEC is exponential
Alternative: constraints with polynomial cardinality (Christofides, Mingozzi, Toth, 1979)
∑ ∑∈ ∈
∅≠⊆∀−≤Si Sj
ij SVSSrSx },0{\)(||
Cdd
jiVjidCxCuu
ji
jijji
≤+
≠∈∀−≤⋅+−
such that
},0{\,
}0{\, VjiCud ii ∈∀≤≤ui = the vehicle load after visiting customer i
80VRP – Massimo Paolucci
CVRP – MIP formulationA MIP formulation
ui = the vehicle load after visiting customer i
if
otherwise
jji dCuu −≤−⇒0=ijx always true
jij duu +≥⇒1=ijx
41
81VRP – Massimo Paolucci
CVRP – MIP formulationCVRP extensions
Tracing vehicles need O(n2K) binary variables
O(nK) binary variables
which can be eliminated noting that ∑∈
=}{\ iVjijkik xy
⎩⎨⎧
=01
ijkxif (i, j) is traversed by vehicle k
otherwise
⎩⎨⎧
=01
ikyif customer i is served by vehicle k
otherwise
82VRP – Massimo Paolucci
CVRP – MIP formulationCVRP extensions
KkVixx
Viy
xc
iVjjik
iVjijk
K
kik
Aji
K
kijkij
,...,1,
}0{\1
min
}{\}{\
1
'),( 1
=∈∀=
∈∀=
∑∑
∑
∑ ∑
∈∈
=
∈ =
each customer is served by exactly one vehicle
the same vehicle that enters a customer vertex also leaves it
42
83VRP – Massimo Paolucci
CVRP – MIP formulationCVRP extensions
KkViuBy
KkAjiBx
Cud
Cdd
KkVjidCxCuu
Ky
ikik
ijk
kiki
kji
jkijkkjkik
K
kk
,...,1},0{\
,...,1,'),(
such that
,...,1},0{\,
10
=∈∀ℜ∈∈
=∈∀∈
≤≤
≤+
=∈∀−≤+−
≤∑=
at most K vehicles are used (some vehicle may be not used)
STE and capacity constraints (different vehicles)
vehicles’ load after serving customer i
84VRP – Massimo Paolucci
CVRP – MIP formulationCVRP extensions
Distance constrainedtij travel time from i to j
si service time at customer i
T maximum total service time for the vehicles
Basic LBs for CVRP derive from the extension of LBs for ATSP and STSP
Exact algorithms (B&B, B&C) are able to solve small instances (n<50 sometimes n<100)
TysxtVi
ikiVi Vj
ijkij ≤+ ∑∑ ∑∈∈ ∈ }0{\
43
85VRP – Massimo Paolucci
VRP – Heuristic approaches Heuristics in general allow finding sub-optimal, usually good, solutions in an acceptable computation time
Three main classes of heuristicsConstructive (the solution progressively build) Improvement (a given solution is progressively improved by a local search process)Metaheuristic (extend local search, consider a population o solution)
Summary:Constructive heuristics for the TSPLocal search approaches for TSPConstructive heuristics for CVRP
86VRP – Massimo Paolucci
TSP – Constructive heuristics Constructive heuristics for the TSP:
Nearest Neighbour algorithmInsertion algorithmPatching/Merger algorithmMinimum spanning tree (based) algorithmChristofides’ algorithm
44
87VRP – Massimo Paolucci
TSP – Constructive heuristics Performance guarantees of TSP heuristics
Bad news for the general case
TheoremLet A be a heuristic alg., A(I) the tour length produced by A and Opt(I) the optimal tour length for an instance I of the TSP. If given a constant 1≤r<∞, for all instances I
A(I) ≤ r⋅ Opt(I) then P=NP.
That means ... no hope of defining a heuristic algorithm with any fixed performance guarantee for the general TSP case
The theorem does not hold true for the STSP restricted to distance matrices satisfying the triangle inequality (metric TSP), a property mostly verified for real world logistic problems
88VRP – Massimo Paolucci
TSP – Constructive heuristics Nearest Neighbour (NN)
Start from an arbitrary vertex v (e.g., the depot), set k=1 and U={v}the set of visited vertices
While k<nselect the next vertex w to visit such that
update U=U∪{w}, set the current vertex v=w and k=k+1
Greedy heuristic simple to be implementedBad performance: it selects short arcs only in the first iterations and final arcs are usually quite longAverage solution are 25% greater than the optimum O(n2) complexity: too slow for more than 10.000 verticesCould be a good starting solution for improvement heuristics
vhUh
vw cc∉
= min
45
89VRP – Massimo Paolucci
TSP – Constructive heuristicsNearest Neighbour (NN)
An example: euclidean distance matrix
Bad news for NN (Theorem):For every r>0 there exists an n-vertices instance I, for arbitrarily large n, satisfying the triangle inequality such that
NN(I)≥ r⋅Opt(I)
depot: starting vertex
customer
Note that in this case in an optimal tour no crossing would appear ...
90VRP – Massimo Paolucci
TSP – Constructive heuristics Insertion Algorithm
Base algorithmStart from a partial circuitInsert a new vertex in the circuit until all the vertices have been considered
Insertion rules (average error):– the nearest vertex (20%)– the farthest vertex (10%)– the cheapest insertion (17%)– random (11%)
46
91VRP – Massimo Paolucci
TSP – Constructive heuristics Insertion Algorithm
An example (with the farthest vertex rule)Distance Matrix (symmetric)
A B C D EA 0 85 47 57 87B 85 0 43 52 38C 47 43 0 48 58D 57 52 48 0 32E 87 38 58 32 0 A
B
C
DE
92VRP – Massimo Paolucci
TSP – Constructive heuristics Insertion Algorithm
First step: start from A (depot)
Distance Matrix (symmetric)A B C D E
A 0 85 47 57 87B 85 0 43 52 38C 47 43 0 48 58D 57 52 48 0 32E 87 38 58 32 0 A
B
C
DE
the farthest
length(T)=174
47
93VRP – Massimo Paolucci
TSP – Constructive heuristics Insertion Algorithm
Second step: the farthest from A or E
Distance Matrix (symmetric)A B C D E
A 0 85 47 57 87B 85 0 43 52 38C 47 43 0 48 58D 57 52 48 0 32E 87 38 58 32 0 A
B
C
DE
Tour(T, k): a procedure which selects the edge (i, j) in the tour T where to insert vertex k as
length(T)=210
( )ijkjikji
ccc −+).(
minarg
94VRP – Massimo Paolucci
TSP – Constructive heuristics Insertion Algorithm
Third step: the farthest from A or E or B
Distance Matrix (symmetric)A B C D E
A 0 85 47 57 87B 85 0 43 52 38C 47 43 0 48 58D 57 52 48 0 32E 87 38 58 32 0 A
B
C
DE
Tour(T, C): (A, B): ∆c = 47 + 43 - 85 = 5(B, E): ∆c = 43 + 58 - 38 = 63(E, A): ∆c = 58 + 47 - 87 = 18
length(T)=215
48
95VRP – Massimo Paolucci
TSP – Constructive heuristics Insertion Algorithm
Fourth step: where to insert D?
Distance Matrix (symmetric)A B C D E
A 0 85 47 57 87B 85 0 43 52 38C 47 43 0 48 58D 57 52 48 0 32E 87 38 58 32 0 A
B
C
DE
Tour(T, C): (A, C): ∆c = 57 + 48 - 47 = 58(C, B): ∆c = 48 + 52 - 43 = 57(B, E): ∆c = 52 + 32 - 38 = 46(E, A): ∆c = 32 + 57 - 87 = 2
length(T)=217
96VRP – Massimo Paolucci
TSP – Constructive heuristics Patching/Merger algorithm
MergerStart from n single-vertex tourWhile number of tours >1
select a pair of tours (T, T’) to be merged such that is minimum
merge the selected toursIf T and T’ are single-vertex tour then Tour(T, k’) or Tour(T’, k)Else determine (i, j)∈T and (k, h)∈T’ such that is minimum
h
ki
j
}',:min{ TjTicij ∈∈
khijhjik cccc −−+
T T’
49
97VRP – Massimo Paolucci
TSP – Constructive heuristics Patching/Merger algorithm
Patching (ATSP)Start from the subtours generated by the AP relaxation of the ATSP While number of tours >1
select a pair of tours (T, T’) to be merged such that is minimum
being (i, j)∈T and (h, k)∈T’merge the selected tours
h
ki
j
hkijhjik cccc −−+
T
T’
98VRP – Massimo Paolucci
TSP – Constructive heuristics Minimum Spanning Tree (MST) based algorithm
FoundationsGiven a complete undirected graph G, a Hamiltonian Path (HP) is a tree in G with cost not less than the cost c(MST) of the Minimum Spanning Tree (MST)
The MST can be found in O(n2)
A Hamiltonian Circuit (HC) is a HP with an added edge ...
then the cost of the minimum cost HC is c(TSP) and c(MST)≤ c(TSP)
A circuit (possibly visiting some vertex more than once) can be generated from a MST by a procedure which doubles all the MST edges
50
99VRP – Massimo Paolucci
TSP – Constructive heuristics Minimum Spanning Tree (MST) based algorithm
FoundationsDepth first MST traversal procedure
Start from a leaf vertex (current vertex) repeatIf there is any not traversed MST edge from the current vertex follow that edge to a new current vertexotherwise go back to the vertex from which the current vertex was first reached traversing backward the edge previously followeduntil all the MST edges have been traversed twice
The procedure terminates in the starting vertexThe cost of the circuit is 2⋅c(MST) then
c(MST) ≤ c(TSP) ≤ 2⋅c(MST)
100VRP – Massimo Paolucci
TSP – Constructive heuristics Minimum Spanning Tree (MST) based algorithm
An example
A
B
DE
C
AB
D
E
C
G (edges have been neglected) MST
51
101VRP – Massimo Paolucci
TSP – Constructive heuristics Minimum Spanning Tree (MST) based algorithm
An example
A
B
DE
C
Doubled MST (DMST) circuit: B-E-D-A-D-C-D-E-B
102VRP – Massimo Paolucci
TSP – Constructive heuristics Minimum Spanning Tree (MST) based algorithm
FoundationsIf the triangle inequality holds the DMST circuit can be transformed in a HC of lesser cost, c(HC) ≤ 2⋅c(MST), by introducing shortcuts
Shortcut traversal: whenever the depth first traversal would take back to an already-visited vertex, skip ahead in the traversal and go directly to the next unvisited vertex (if all vertices have been visited come back to the start)
Algorithm (MSTS)Find a MST of GBuilt a HC by a Depth First Traversal with Shortcuts
The HC cost is lower and upper bounded c(MST) ≤ c(TSP) ≤ c(HC) ≤ 2⋅c(MST)
MSTS(I)≤2⋅Opt(I)
52
103VRP – Massimo Paolucci
TSP – Constructive heuristics Minimum Spanning Tree (MST) based algorithm
FoundationsAn example
A
B
DE
C
Traversal with shortcuts: B-E-D-A-C-B
Note that following a different depth first traversal B-E-D-C-D-A-D-E-B and introducing shortcuts the final HC would be longer
104VRP – Massimo Paolucci
TSP – Constructive heuristics Christofides’ algorithm
Algorithm (CA)Find a MST for GTransform the MST in an Eulerian graph by introducing minimum cost edges between pairs of vertices with odd degree (minimum weight matching problem)Build a HC by an Eulerian Traversal with Shortcuts
Note that:The number of vertices with odd degree in a graph is always evenThe minimum weight matching problem can be solved in polynomial time (O(n3))It can be proved that
C(I)≤ 3/2 ⋅ Opt(I)
53
105VRP – Massimo Paolucci
TSP – Constructive heuristics Christofides’ algorithm
An example
A
B
D
E CF
GH
I
MST
A
B
D
E CF
GH
I
Eulerian graph by minimum weighted matching
106VRP – Massimo Paolucci
TSP – Constructive heuristics Christofides’ algorithm
An example
A
B
D
E CCF
GH
I
Eulerian traversal of the graph HC (shortcuts)
start A
B
D
E CCF
GH
I
start
Note that the solution generated by the MSTS algorithm is differentABCDEFGHI and longer
54
107VRP – Massimo Paolucci
TSP – Improvement heuristics Improvement heuristics for the TSP:
Local search based on:2-OPT3-OPT
Lin-Kerninghan
108VRP – Massimo Paolucci
TSP – Improvement heuristics Basic Local Search (LS) Algorithm
Initialization:generate a initial solution xSet the current solution and objective xc=x; Zc= Z(x)
RepeatSet xb=xc; Zb= Zc
For each candidate solution x∈N(xb) If Z(x)<Zc then xc=x; Zc= Z(x)
Until Zc< Zb
N(x) is the neighbourhood of solution xA neighbourhood of x is made of solutions that can be generated by modifying xIf xa∈N(xb) then xb∈N(xa)
55
109VRP – Massimo Paolucci
TSP – Improvement heuristics 2-OPT and 3-OPT
The N(x) is generated by 2-exchange (3-exchange) moves 2 (3) egdes in the current solution are removed and substituted with 2 (3) other edges so that a different HC is produced
Good performance (small % deviation from optimal in the average)
If all the possible moves are explored it may be time consuming
Best Improvement (default) vs First Improvement strategy
110VRP – Massimo Paolucci
TSP – Improvement heuristics 2-OPT
An example (ATSP)
Start HC
Arcs to be removed
Partial circuits
56
111VRP – Massimo Paolucci
TSP – Improvement heuristics 2-OPT
An example (ATSP)
New arcs
Flipped path
HC at step 1
112VRP – Massimo Paolucci
TSP – Improvement heuristics 2-OPT
An example (ATSP)
Further steps
Arcs to be removed
New arcsFlipped path
57
113VRP – Massimo Paolucci
TSP – Improvement heuristics 2-OPT
An example (ATSP)
Further steps
Flipped path
Arcs to be removed
New arcs
114VRP – Massimo Paolucci
TSP – Improvement heuristics 3-OPT
An example (STSP)
Edges to be removed
New edges
58
115VRP – Massimo Paolucci
TSP – Improvement heuristicsLin-Kernighan (variable k-OPT)
A trade-off is neededk-exchange moves provide solutions said k-optimal:
A tour is said to be k-Optimal (or simply k-OPT) if it is impossible to obtain a shorter tour by replacing any k of its links by any other set of k links
Any k-OPT tour is also k’-OPT with k’≤kA tour is optimal if is n-OPTThe larger is k the more likely the solution is optimalIncreasing k the required computation time also rapidly increase (for naive implementation O(nk) and k is limited to 2 and 3 in practiceDrawback: the value of k must be a priori specified
116VRP – Massimo Paolucci
TSP – Improvement heuristicsLin-Kernighan (variable k-OPT)
Lin-KernighanOne of the best heuristic availableVariable k-OPTAverage running time O(n2.2) (original implementation)Not easy to implement ⇒ extensively studiedThe algorithm changes the value of k during its execution deciding at each iteration which value should be assigned to k
Basic LK heuristic (LKH)At each iteration step examine for ascending values of k if an interchange of k edges may result in a shorter tour:
Given that the exchange of r edges is being considered, a series of tests is performed to determine whether r+1 edge exchanges should be considered
The iterations continue until some stopping condition is satisfied
59
117VRP – Massimo Paolucci
TSP – Improvement heuristicsLin-Kernighan (variable k-OPT)
At each step LKH considers a growing set of potential exchanges(starting with r = 2)The exchanges are chosen so that a feasible tour may be formed at any stage of the processIf the exploration finds a new shorter tour then the current tour is replacedThere are several variations of the basic LKH
Let:X the set of r edges to be removed and Y the set of r edges to be added (initially empty)(vi, vi+1) be an edge, x an edge in X and y an edge in YG=c(xi)-c(yi) the gain of replacing xi with yi
118VRP – Massimo Paolucci
Lin-Kernighan (variable k-OPT)An example of LKH iteration
TSP – Improvement heuristics
Initial tour T
v1
x1
v2
v3v1
x1
v2y1
x2
X={x1, x2}Y={y1}
G1=c(x1)- c(y1)>0
v4
A tour must always be closed with an edge (v4,v1)
Such edge is not chosen since G<0
60
119VRP – Massimo Paolucci
Lin-Kernighan (variable k-OPT)An example of LKH iteration
TSP – Improvement heuristics
v3v1
x1
v2y1
x2
v4
y2x3
X={x1, x2, x3}Y={y1, y2}
G2=c(x2)- c(y2)>0
v3v1
x1
v2y1
x2
v4
y2x3
v5
v6 v5y3X={x1, x2, x3}
Y={y1, y2, y3}G3=c(x3)- c(y3)>0
A tour can be closed with an edge (v6,v1)
v6
The step executes a k=3 exchange
120VRP – Massimo Paolucci
Heuristics for the CVRP Exact algorithms for VRP are based on models generalizing the TSP onesOnly quite small instances can be optimally solved (e.g., 100 customers, and 5 vehicles)Heuristic approaches are always used in the practice:
Constructive heuristicsTwo phase methods:
Cluster First – Route SecondRoute First – Cluster Second
Improvement heuristics
Metaheuristics: Actually the most powerful ones (but more time consuming and difficult to tune, extend, adapt) ... will be covered in a dedicated lecture
61
121VRP – Massimo Paolucci
Heuristics for the CVRP Constructive heuristics
Sequential: the solution is built one tour at a timeParallel: more tours are built in parallel
Two main techniquesMerge existing route (savings criterion)Assign customer to routes (insertion cost criterion)
Clark and Wright Savings Algorithm Both sequential and parallel versionIt can be applied when the number of vehicles is a decision variableIt merges pairs of routes so that the end of one route continue with the start of the other in order to maximise the distance savings derived from the merges
122VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (sequential version)
InitializationFor each vertex i=1,.., n generate a route (0, i, 0)
For each i compute the savings sij=ci0+c0j-cij for j=1,…, n, j≠i, and sort the savings in non increasing order
Define route (0, 1, 0) as the current route
Depot
62
123VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm
Iteration (sequential version: route extension)Let route (0, i,…., j, 0) be the generic current route
Determine the first saving ski or sje so that the route can be feasibly merged with another route including edge (arc) (k,0) or (0,e).
If a feasible merge exists then implement it and iterate with the current routeElse
If there are other routes not considered so far, then select a next route as current route and iterateElse stop (no more feasible merge is possible)
124VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (sequential version)
An example
i j
1) Current route (0, i, 0)
ijjiij cccs −+= 001) Best saving
ij
2) Current route (0, i, j, 0)
k
63
125VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (sequential version)
An example
i
j
2) Current route (0, i, j, 0)
k
jkkjjk cccs −+= 00
2) Best saving
i
j
k
3) Current route (0, i, j, k, 0) cannot be extended anymore in a feasible way.
The next current route is (0, h, 0)
h
126VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (sequential version)
An example
ghhggh cccs −+= 00
3) Best saving
i
j
k
3) Current route (0, h, 0)
h
g
i
j
kh
g
4) Current route (0, g, h, 0)
No more merge is feasibly possible.
A 3-routes solution is found !
64
127VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (parallel version)
InitializationFor each vertex i=1,.., n generate a route (0, i, 0)
Compute the savings sij=ci0+c0j-cij for j=1,…, n, j≠i, and sort the savings in non increasing order
Iteration (parallel version: best feasible merge)If a positive saving does exist then
Starting from the largest saving sij determine if the two routes, one including edge (arc) (i, 0) and the other (0, j) can be feasibly merged;If so, merge the two routes by deleting (i, 0) and (0, j) and iterate with the next saving
128VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (parallel version)
An example: Symmetric and euclidean distancesVehicles’ capacity C=8Customer demands associated with vertices
Depot
E,2
A,3
C,4F,2
B,2
D,3 0417191814041F410611121138158E71610729210341D91112720369554C81113923607058B40811039570064A4158415458640Dep
FEDCBADepcij
65
129VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (parallel version)
An example:
Initial routes and lengths
• c(0-A-0) = 128
• c(0-B-0) = 116
• c(0-C-0) = 108
• c(0-D-0) = 82
• c(0-E-0) = 116
• c(0-F-0) = 82
Total cost = 632
Number of vehicles = 6
Depot
E,2
A,3
C,4F,2
B,2
D,3
130VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm (parallel version)
An example:
0581141865F580380341E113802372D
402307623C183776052B6541223520A
FEDCBAsij
Depot
E,2
A,3
C,4F,2
B,2
D,3
sAB= cADep+cDepB-cAB
= 64 + 58 – 70 = 52
64
58
70
66
131VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm
An example:
0581141865F580380341E113802372D
402307623C183776052B6541223520A
FEDCBAsij
Depot
E,2
A,3
C,4F,2
B,2
D,3No more merges are possible without violating the capacity constraint
3 vehicles
total cost=433
132VRP – Massimo Paolucci
Heuristics for the CVRP Clark and Wright Savings Algorithm
An example:
0581141865F580380341E113802372D
402307623C183776052B6541223520A
FEDCBAsij
Depot
E,2
A,3
C,4F,2
B,2
D,3 The heuristic is not able to find a 2-vehicle solution (total cost=459)
67
133VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Cluster First – Route Second
Phase 1: ClusteringA clustering problem is solved to assign each customer to a single vehicle
Phase 2: RoutingFind the route for each vehicle (solving a TSP problem)
134VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Cluster First – Route Second
Methods:Elementary clustering methods
Sweep algorithmFisher-Jaikumar Generalized Assignment (GA) based algorithmLocation-based heuristic
Truncated Branch-and-Bound approachesLevels of the exploration tree ⇒ vehicle routesEach level contains a set of (partial) feasible routes generated by one or more criteria (e.g., savings)Branching ⇒ route selection
Petal Algorithms
68
135VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Cluster First – Route Second
Sweep AlgorithmPlanar VRPFeasible cluster initially obtained by rotating a ray centred at the depotA vehicle route is found by solving a TSP problem for each cluster
ray
Cluster 1 (customers assigned to vehicle 1)
Cluster 2
Cluster 3
Cluster 4
Cluster 5
136VRP – Massimo Paolucci
Two phase methods: Cluster First – Route SecondSweep Algorithm
Planar VRPFeasible cluster initially obtained by rotating a ray centred at the depotA vehicle route is found by solving a TSP problem for each cluster
Heuristics for the CVRP
Route 1
Route 2
Route 3
Route 4
Route 5
69
137VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Cluster First – Route Second
Fisher-Jaikumar Generalized Assignment based algorithm
Step 1 (seed selection): select a seed jk in V for each cluster k=1,...,KStep 2 (allocation of customers to seed): compute cik the cost of allocating customer i to k as the cost of inserting i in the route 0-jk-0
Step 3 (generalized assignment): Solve a GA problem with costs cij, weights for the customers di, and vehicle capacity QStep 4 (TSP solution): solve a TSP for each cluster found
)(},min{ 000000 kjkjiikjkjkjkijiik ccccccccc +−++++=
138VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Cluster First – Route Second
Generalized Assignment Problem
GAP is a strong NP-hard for which both exact and heuristic approach exist
i
Customers Vehicles/Clusters
kxik
dicik
Q
Kknix
KkQxdb
nixa
xc
ik
n
iiki
K
kik
n
i
K
kikik
,...,1;,...,1}1,0{
,...,1)(
,...,11)(
min
1
1
1 1
==∀∈
∑ =∀≤⋅
=∀=∑
∑ ∑ ⋅
=
=
= =
(a) assignment constraints(b) capacity contraints
70
139VRP – Massimo Paolucci
Two phase methods: Cluster First – Route SecondLocation based heuristic
Step 1 (concentrators selection): select a concentrator jk in V for each cluster k=1,...,K such that the total distance of allocating the n customers to the closest concentrator is minimized, and the total capacity of each cluster does not exceed QStep 2: Build the vehicle route for each cluster by inserting a customer at a time with the minimum (estimated) insertion cost
Heuristics for the CVRP
K=2
140VRP – Massimo Paolucci
Two phase methods: Cluster First – Route SecondPetal heuristic
Order the vertices (v1, v2,..., vn), e.g., use sweep order.
For every vertex vi create clusters {vi}, {vi, vi+1}, {vi, vi+1, vi+2}, ..., as long as it is possible to feasibly serve the cluster by a single vehicle (Note that subscripts should be interpreted modulo n)
Heuristics for the CVRP
swee
p dire
ction
Cluster 1
Cluster 2
Cluster 3
Cluster 4
71
141VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Cluster First – Route Second
Petal heuristic (cont.)Compute for each cluster k the cost ck by solving (exactly or with a heuristic) the associated TSP problemDefine end solve a set partitioning problem (SPP) associating a column with each cluster and assigning ck cost to it
Rkx
Vixa
xc
k
Rkkik
Rkkk
∈∀∈
∈∀=∑
∑
∈
∈
}1,0{
1
min
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
==
111111
1111111
][ ikaA
If the incidence matrix A is an interval matrix the SPP is polynomially solvable
RouteServed
customers
142VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Route First – Cluster SecondBeasley's algorithm
Phase 1: RoutingSolve a single TSP problem relaxing the capacity (duration) constraints
Phase 2: ClusteringCut the TSP solution into routes that satisfy the capacity (duration) constraints
Note: Phase 2 can be optimally solved in polynomial time using the approach of the Petal heuristicRFCS heuristic is a special case of the Petal one
72
143VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Route First – Cluster Second
An example: Vehicles’ capacity C=8
Depot
E,2
A,3
C,4F,2
B,2
D,30417191814041F
410611121138158E
71610729210341D
91112720369554C
81113923607058B
40811039570064A
4158415458640Dep
FEDCBADepcij
The TSP solution Route length=343 (not feasible)
144VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Route First – Cluster Second
An example: Vehicles’ capacity C=8
Depot
E,2
A,3
C,4F,2
B,2
D,3
0417191814041F
410611121138158E
71610729210341D
91112720369554C
81113923607058B
40811039570064A
4158415458640Dep
FEDCBADepcij
First set of clusters/routes Total length=484 (feasible)
starting vertex
73
145VRP – Massimo Paolucci
Heuristics for the CVRP Two phase methods: Route First – Cluster Second
An example: Vehicles’ capacity C=8
Depot
E,2
A,3
C,4F,2
B,2
D,3
Second set of clusters/routes Total length=433 (feasible)
starting vertex ... and so on
0417191814041F
410611121138158E
71610729210341D
91112720369554C
81113923607058B
40811039570064A
4158415458640Dep
FEDCBADepcij
146VRP – Massimo Paolucci
Heuristics for the CVRP Improvement heuristics
Based on LS: exploration of a neighbourhood N(x) of solutionsN(x) is built using “moves”
Possible moves:Insert a customer in a different position in the sequence of visitSwap the positions of a pair of customersk-Opt
Two classes of methods:Single route improvement
the assignment of customers to routes (vehicles) not change (analogous to TSP improvement heuristic)
Multi route improvementthe moves may also change the customer-route assignment
74
147VRP – Massimo Paolucci
Heuristics for the CVRP Improvement heuristics
Multi route improvements:String crossing
Two chains of customers are exchanged by exchanging the endpoints of two edges in two different routes
148VRP – Massimo Paolucci
Heuristics for the CVRP Improvement heuristics
Multi route improvements:String relocation
A chain of at most k customers is moved from one route to anotherHigher value of k may produce better results but the neighbourhood exploration time also increases
75
149VRP – Massimo Paolucci
Heuristics for the CVRP Improvement heuristics
Multi route improvements:String exchange
Two chain of at most k customers are exchanged between two routesIf k = n then string exchange contains string cross as well (but this is a large
neighborhood which is time consuming to evaluate).The values for k are usually small {1, 2, 3}
String relocation is a special case if k1>0 and k2=0String crossing is a special case if k1=k2 and the strings are at the routes’ ends.
150VRP – Massimo Paolucci
The Arc Routing Problems-
The Chinese Problem (CPP)
Characteristics
Models
Algorithms (heuristics)
76
151VRP – Massimo Paolucci
ARP – Arc Routing ProblemsARPs concern the distribution/collection of goods or materials along the arcs (edges) of a road networkSame main components as NRP The density of customers along streets is sufficiently high to consider the associated arc (edge) the key network element to be served Solution:
A set of routes performed a fleet of vehicles such that:each route starts and ends at vehicles’ depotsthe requests for service associated with arcs or edges are satisfiedthe operational constraints are fulfilledthe global transportation cost is minimized
152VRP – Massimo Paolucci
ARP – Arc Routing ProblemsOperational constraints of the same kind of the ones for NRP (e.g., number of available vehicles, vehicles’ capacity, route duration ...)ARP without operational constraints:
All arcs (edges) must be served: the Chinese Postman Problem (CPP)Only a subset of arcs (edges) must be served: the Rural Chinese Postman Problem (RCPP)
Other ARP variations:The Windy Chinese Postman ProblemThe Stacker Crane Problem
77
153VRP – Massimo Paolucci
ARP – Arc Routing ProblemsThe CPP is characterized by:
A single vehicleAll the arcs (edges) must be servedThe service demand is neglected (as well as the vehicle capacity)For each arc (edge) the service cost and the traversing cost (without service) are known
Solution: a minimum cost route that traverses at least once every arc (edge)
An example
1starting vertex = depot 2
3
45
678
9
10
111213Does a route exist which traverses
each edge exactly once?edge traversal without service = deadheading
154VRP – Massimo Paolucci
ARP – Arc Routing ProblemsThe Könisberg’s Bridges problem (Euler, 1707-1783)
Pregel river
Since the end of World War II (1946), Königsberg became a Russian city named Kaliningrad
The capital of Eastern Prussia, Königsberg
78
155VRP – Massimo Paolucci
ARP – Arc Routing ProblemsThe Könisberg’s Bridges problem (Euler, 1707-1783)
Is it possible to cross each bridge exactly once starting and ending at the same point? (Euler, 1736)
The answer is ...
A
B C
D
A
B
D
CPregel river
The graph model is a Multi-Graph
156VRP – Massimo Paolucci
ARP – Arc Routing ProblemsThe Könisberg’s Bridges problem (Euler, 1707-1783)
The answer is ... the same of the following decision problem:
Is the graph in the figure an eulerian graph ?i.e., does it contain a tour (closed walk) that transits on every edge exactly once?
Unfortunately the answer is no ! (the graph is not an eulerian one)
A
B
D
C
79
157VRP – Massimo Paolucci
ARP – Arc Routing ProblemsEuler showed that for an eulerian cycle to exist, all the vertices must have even degree
Note that an eulerian (not closed) path can exist if the graph includes at most two vertices with odd degree
Every vertex has an odd degreeNote that
A
B
D
C
|δ(A)|=3
|δ(C)|=3
|δ(D)|=3
|δ(B)|=5
∑ ⋅=∈Vi
i E ||2|| δ
158VRP – Massimo Paolucci
ARP – Arc Routing ProblemsAn eulerian tour in a graph is a tour that contains each edge (arc) exactly once
A postman tour in a graph is a tour that contains each edge (arc) at leastonce
If the (multi) graph G(V,A) is eulerian the optimal solution to the CPP is trivially
and the CPP problem reduces to find the eulerian tour in the graph
If G is not eulerian the CPP solution is a tour that transit on a subset of arcs (edges) more than once
Then the problem reduces to add to G copies of the arcs (edges) so that G becomes eulerian while the increment of the cost so generated
∑=∈Ee
eCPP cZ *
80
159VRP – Massimo Paolucci
ARP – Arc Routing ProblemsHow to determine if a connected graph G is eulerian?
An undirected G(V, E) is eulerian ⇔ ∀i∈V |δ(i)| is even (G is even)A directed G(V, A) is eulerian ⇔ ∀i∈V |δ -(i)|=|δ +(i)| (G is symmetric)A mixed G(V, A∪E) is eulerian ⇔ G is even and satisfies the following balanced set condition (balanced)
For every subset of vertices S⊂V, the difference between the number of directed arcs that cross the cut (S, V\S) from S to V\S and the number of the directed arcs from V\S to S must be less than or equal to the number of undirected edges crossing (S, V\S)
5
2
4
3
1
S V\SEulerian
mixed graph 5
2
4
3
1Non-Eulerianmixed graph
Examples
160VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemFormulation of the Undirected PP (UPP)
Notation:G(V, E) undirected graphVO⊆V the subset of odd verticesAG=[aie i∈V, e∈E] the vertex-edge adjacent matrix (aie=1 if e∈δ(i), 0 otherwise)
Variables:xe = number of times edge e is added to G to transform it into an eulerian graph (xe=0 for every e∈E if G is eulerian)wi for i∈V a positive integer
81
161VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemFormulation of the Undirected PP (UPP)
ViwEex
Viwxa
Viwxa
xc
i
e
OiEe
eie
OiEe
eie
Eeee
∈∀≥∈∀≥
∉∀=∑
∈∀+=∑
∑
∈
∈
∈
integer 0integer 0
2
12
min
Every vertex must have an even degree
∑⇒∑ +=∈∈ Ee
eEe
eeUPP cxcZ )1( ** for eulerian graphs
162VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the UPP
The UPP is solvable in polynomial timeIf G is eulerian determine the eulerian tour
Fleury AlgorithmEnd-Pairing Algorithm
If G is not eulerian:First add copies of the edges in order to transform it into an eulerian graph G’ with the minimum additional cost by solving a Matching Problem (polynomial)Then determine the eulerian tour in G’
82
163VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the UPP
The Fleury Algorithm1. Let T=E, W=V. Select a starting vertex v=i2. Select randomly an edge e∈T incident in v, e∈δ(v), e=(v, h), such
that e is not a bridge (if no other choice exists the graph is not eulerian)
3. Traverse e and remove it from T; if δ(v)∩T=∅ then W=W\{v}; set v=h
4. If T≠∅ and v≠i then continue with step 2
Definition:An edge is a bridge if the number of connected components in F(W,T\{e}) is increased by 1
164VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the UPP
The Fleury AlgorithmAn example: G eulerian
starting vertex
21
traversed edge 1
3
2
1
3
forbidden traversal
bridge edge
2
1
34
5 67
89
10F is disconnected
83
165VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the UPP
The End-Pairing Algorithm1. Trace a first simple T1 tour in G (that may not contain all
vertices). If all the edges are traversed then stop2. Consider any vertex v on T1 which is incident to an edge not on
the tour, and form a second tour T2 from v not overlapping T1
3. Merge T2 with T1: starting from v follow T1 and then continue with T2
4. If all the edges are traversed then stop, otherwise continue with step 2
Both Fleury and End-Pairing algorithms are easily generalized to directed eulerian graphs
166VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the UPP
The End-Pairing AlgorithmAn example
A BC
D
E
F
GH
A BC
D
E
F
GH
T1=A-B-F-A
A BC
D
E
F
GH
T2=A-C-D-A
A BC
D
E
F
GH
T1 merged with T2: T1=A-B-F-A-C-D-A
T2=D-E-G-DT1 merged with T2:
T1=A-B-F-A-C-D-E-G-D-A
84
167VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the UPP
Undirected non eulerian G(V, E): the Matching Problem1. Let E’=E. Identify the set VO of odd degree vertices and compute the
shortest paths spij between all pairs of vertices i, j∈VO i<j2. Build a complete undirected graph GO(VO,EO), EO={(i, j): i, j∈VO i<j} ,
and associate the costs spij to each edge in EO
3. Find a minimum cost matching M in GO where M⊂EO such that every v∈VO is incident to exactly an edge in M
4. For each edge (i, j)∈M add to E’ a copy of the edge included in the shortest path between i and j
5. Form the eulerian graph G’(V,E’)6. The optimal solution of the UPP corresponds to the eulerian tour in G’
The minimum matching problem can be solved with polynomial algorithms with complexity of O(|V|3) or less
168VRP – Massimo Paolucci
Solution of the UPPUndirected non eulerian G(V, E): the Matching Problem
An example
CPP – The Chinese Postman Problem
AB
5
DE
FG
H
A B
C E
eulerian graph with doubled
edges
3 2 1
6
524
34
2
3 1
CA
B
5
DE
FG
H
3 2 1
524
34
2
3 1
C
6
22
6
73
3
4
2
AB
DE
FG
H
C
A-B-E-F-H-G-A-C-G-F-D-B-E-D-A
85
169VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemFormulation of the Directed PP (DPP)
Notation:G(V,A) directed graph∀i∈V in-degree and out-degree∀i∈V
Variables:xij = number of additional copies of arc (i, j) added to G to transform it into an eulerian graph (xij=0 ∀(i, j)∈A if G is eulerian)
|)(|)( iid −− = δ |)(|)( iid ++ = δ)()()( ididib +− −=
170VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemFormulation of the CPP Directed PP (DPP)
Ajix
Viibxx
xc
ij
ijji
ijij
Ajiijij
∈∀≥
∈∀=∑−∑
∑
−∈+∈
∈
),(integer 0
)(
min
)()(
),(
δδ Every vertex must be symmetric
∑⇒∑ +=∈∈ Aji
ijAji
ijijDPP cxcZ),(),(
** )1( for eulerian graphs
86
171VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the DPP
The DPP is solvable in polynomial timeIf G is eulerian determine the eulerian tour
Fleury or End-Pairing Algorithms adapted to directed graphsvan Aardenne-Ehrenfest and De Bruijn Algorithm
If G is not eulerian:First add copies of the arcs in order to transform it into an eulerian graph G’ with the minimum additional cost by solving a Transportation Problem (polynomial)Then determine the eulerian tour in G’
172VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the DPP
The van Aardenne-Ehrenfest and De Bruijn Algorithm1. Build an spanning in-tree arborescence routed in an arbitrary vertex v2. Label all arcs in G as follows: order and arbitrary label the arcs
outgoing from v; order and label the arcs outgoing from any other vertex consecutively in an arbitrary way but selecting as the last arc an arc used in the arborescence
3. Starting from an arbitrary vertex traverse the lowest labelled arc outgoing from it and continue by leaving any entered vertex following the arc not yet traversed with the lowest label. When all arcs have been traversed the eulerian tour is found
Definitions:An in-tree is an oriented tree in which a single vertex is reachable from any other one.An spanning arborescence of a directed graph G (if it exists) is an arborescence with include every vertex of G
87
173VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the DPP
The van Aardenne-Ehrenfest and De Bruijn AlgorithmAn example
A BC
D
E
F
GH
Starting from vertex D
D-G-E-D-C-A-H-F-B-A-D
in-tree spanning arborescence
A BC
D
E
F
GH
labelling of arcs
A BC
D
E
F
GH
7
6
5
12
4
10
38 9
174VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the DPP
Directed non eulerian G(V, A): the Transportation Prob.1. Define the subset of V
S={i∈V: b(i)>0} (supply vertices)D={i∈V: b(i)<0} (demand vertices)
2. Compute the shortest paths spij between all pairs of vertices (i, j) such that i∈S, j∈D
3. Solve a transportation problem for the supply and demand vertices defined with the spij costs, finding the optimal flow yij for each pair (i, j)
4. For each yij>0 augment the original graph G with the copies of the arcs associated to the shortest path between vertex i and j, forming the eulerian graph G’(V,A’)
5. The optimal solution of the UPP corresponds to the eulerian tour in G’
The transportation problem can be solved with complexity of O(|V|3)or O(|A||V|2)
88
175VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the DPP
Directed non eulerian G(V, A): the Transportation Prob.An example
S={B,D}
D={A,C,F}
the transportation
problem
B C
D
E
A4
1
85
10
35
F2
6
bB=1
bA=-1
bF=-1
bC=-1
bD=2 bE=0
∑ =∈Vi
ib 0)(
B
D
A
C
F
bB=1
bD=2
bA=-1
bC=-1
bF=-1
spBA=17 spBC=8spBF=19 spDA=5spDC=18 spDF=7
yBA=0 yBC=1yBF=0 yDA=1 yDC=0 yDF=1
176VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemSolution of the DPP
Directed non eulerian G(V, A): the Transportation Prob.An example
Starting from vertex B
B-C-D-A-F-B-C-E-D-A-F-D-A-B
B C
D
E
A
F
B C
D
E
A
F
B C
D
E
A 813
6
112 9
7
F
3
10
2114
5
89
177VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemThe Mixed PP (MPP)
If G(V, A∪E) mixed graph is eulerian (even and balanced) the postman tour is found as follows:
assign a direction to some edges in order to make G symmetric
complete the orientation of the remaining edges to transform Ginto an eulerian directed graph
determine the postman tour with one of the available algorithms
If G is even but not balanced the problem is solved by the Minieka’s Algorithm
Note that if G is even and symmetric is also balanced but symmetry is not a necessary condition to eulerian
178VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemThe Mixed PP (MPP)
The Ford-Fulkerson’s procedure for transforming an eulerian mixed graph G(V, A∪E) into a eulerian directed graph
Transform G into a symmetric graph1. replace each (i, j)∈E with two directed arcs (i, j) and (j, i)
transforming the graph into G(V, A’). Assign to each arc in A a lower bound of 1 and to each arc in A’\A a lower bound of 0. Assign to any arc in A’ an upper bound of 1.
2. Determine a feasible circulation for the network flow model so defined. Let xij the flow in arc (i, j)
3. Orient the edge (i, j)∈E as arc (i, j), if xij=1 and xji=0, remove the edge from E and include the arc in A.
90
179VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemThe Mixed PP (MPP): eulerian graphs
The Ford-Fulkerson’s procedure for transforming an eulerian mixed graph G(V, A∪E) into a eulerian directed graph
Transform G into a symmetric graph: an example
10
11
≤≤
≤≤
jk
ij
x
xsolution of the network
flow problem (circulation)
i
j
k
i
j
k
180VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemThe Mixed PP (MPP): eulerian graphs
The Ford-Fulkerson’s procedure for transforming an eulerian mixed graph G(V, A∪E) into a eulerian directed graph
Transform the mixed symmetric graph G into a directed symmetric one1. If E is empty then stop2. Le i a vertex with at least an incident edge (i, j)∈E. Set v=i and w=j3. Orient (v, w) from v to w. If w=i go to step 14. Set v=w and identify an edge (v, w) incident to v. Go to step 3
91
181VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemThe Mixed PP (MPP): eulerian
The Ford-Fulkerson’s procedure for transforming an eulerianmixed graph G(V,A∪E) into a eulerian directed graph
Transform the mixed symmetric graph G into a directed symmetric one: an example
v1
w1
v2
w2v3
w3
v4
w4
182VRP – Massimo Paolucci
CPP – The Chinese Postman ProblemThe Mixed PP (MPP)
Even graphThe Minieka’s Algorithm transforms an even unbalanced mixed graph G(V, A∪E) into an even and balanced one (i.e., into an euleriandirected graph)The algorithm is based on the definition and solution of a minimum cost flow problem:
if no feasible solution exists then the graph cannot be balancedand no postman tour exists
For not even mixed graph the problem is NP-hardA possible heuristic is a two-stage procedure:
(1) optimally adding edges (matching) to make the graph even(2) to apply the Minieka’s algorithm
The procedure may not find the optimal solution even if each single stage is performed optimally.
92
183VRP – Massimo Paolucci
RCPP – The Rural Chinese Postman ProblemThe Rural CPP
Given a general G(V, A∪E) only a subset R⊂A∪E of arcs and edges must be servedSolution: a minimum cost circuit that traverses each arc and edge in R at least onceNotation: let GR the graph induced in G by R
Complexity:G directed or undirected and GR connected
⇒ RCPP polynomially solvableG directed or undirected and GR not connected
⇒ RCPP is NP-hard
184VRP – Massimo Paolucci
RCPP – The Rural Chinese Postman ProblemThe Rural CPP
Algorithm for G undirected and GR connectedDetermine the minimum cost paths in G between every pair of odd vertices in GRSolve a minimum cost matching for such verticesAugment GR by adding the edges corresponding to the minimum matchingSolve a UPP on GR
RG
93
185VRP – Massimo Paolucci
RCPP – The Rural Chinese Postman Problem
The RCPP: G undirected and GR not connectedBalance-and-Connect Heuristic
Build and extend GR by solving a matching problem to obtain and even graphConnect the GR components by solving a MST problem on a complete graph T(Vc, Ec) such that
the vertices in Vc correspond to the components of GR
the cost associated with each edge (r, s)∈T is computed as the minimum cost path connecting any pair of vertices in G belonging to the components of GR the node r and s are associated with
Apply the algorithm for RPP with connected GR
186VRP – Massimo Paolucci
RCPP – The Rural Chinese Postman Problem
The RCPP: directed GThe approaches for the undirected case can be extended:
The exact algorithm when GR is connected is extended by solving a transportation problem to make GR symmetricThe balance-and-connect heuristic is extended by solving a minimum spanning arborescence problem to connect the components of GR
An example (Directed RCPP)
2
2 2
2
2
1 1
3
5 5
94
187VRP – Massimo Paolucci
RCPP – The Rural Chinese Postman ProblemThe RCPP: directed G
A “reversed” heuristic:Connect-and-Balance
Strongly connect the components of GR
Obtain an even graph
2
2 2
2
2
1 1
3
5 5 2 2
2
1 15 5
2
2 2
2
2 3
Balance&
Connect
Non-required arcs cost=12
Non-required arcs cost=5
188VRP – Massimo Paolucci
RCPP – The Rural Chinese Postman ProblemOther PP
The Stacker Crane ProblemA RPP on a mixed graph where R=A (NP-hard – close to TSP)
The Windy CPPA UPP where the costs of edge traversing depend on the travel direction (polynomially solvable if the graph is eulerian, NP-hard otherwise)
95
189VRP – Massimo Paolucci
CARP – The Capacitated ARPARP with operational constraints
Components:A connected road network G =(V, A)A cost (distance) cij is associated with each arc (i, j)∈AA demand dij is associated with each arc (i, j)∈R⊆AA fleet made of K vehicle with capacity CA depot associated with vertex 0
Solution: A set of K routes, all including vertex 0, covering all the arcs in Rand such that:
the total demand served by each vehicle does not exceed the capacity Ceach arc in R is served by a unique route (vehicle)
Objective:Minimize the total cost (distance) of the K routes
190VRP – Massimo Paolucci
CARP – The Capacitated ARPExamples of CARP applications:
Street sweepingWinter grittingRefuse collectionElectric meter readingAirline scheduling
96
191VRP – Massimo Paolucci
CARP – MIP formulationCARP – Symmetric network G=(V, E)
R⊆E R={(i, j)∈E: dij>0}
k=1,...,K identical vehicles with capacity C
Binary variables
Formulation (Golden & Wong)
traversed),( if 1 Ejixijk ∈=served ),( if 1 Rjilijk ∈=
KkRjilx
KkVixx
xc
ijkijk
Ejijjikijk
K
k Ejiijkij
,...,1),(
,...,10)(
min
),(:
1 ),(
=∀∈∀≥
=∀∑ ∈∀=−
∑ ∑
∈
= ∈
(Route continuity)
(Objective)
(Serviced edge must be traversed)
192VRP – Massimo Paolucci
CARP – MIP formulationCARP – Symmetric network G=(V,E)
Formulation (cont.)
KkVS
uyuy
ux
ynSx
KkCdll
Rjill
kS
kS
kS
kS
kS
Si Sjijk
kS
Sjiijk
Rjiijjikijk
K
kjikijk
,...,1}0{\
}1,0{,1
1
1||
,...,1)(
),(1)(
2
,
),(
1
=∀⊆∀
⎪⎪⎭
⎪⎪⎬
⎫
∈≤+
−≥
+−≤
=∀≤+
∈∀=+
∑ ∑
∑
∑
∑
∈ ∉
∈
∈
=
(Capacity)
(Required edges must be served)
(Elimination of disconnected subtours)
97
193VRP – Massimo Paolucci
CARP – MIP formulationDisconnected subtour elimination constraints
Examples
00 == kS
kS uy
Simpose that:
• vehicle k cannot traverse more than 2 edges of S
• S is connected to V\S by at least 1 edge
S
01 == kS
kS uy
impose that:
• vehicle k is allowed to traverse the 3 required edges of S
• S is connected to V\S by at least 1 edge
194VRP – Massimo Paolucci
CARP – The Capacitated ARPCARP is NP-hard even for directed and undirected graphs
Heuristics for the CARPClasses of heuristics:
Constructive heuristicsImprovement heuristicsTwo-phase methods
Cluster First – Route SecondRoute First – Cluster Second
An undirected graph G=(V, E) is assumed in the following
98
195VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Path Scanning Algorithm
1. Let RU⊆R the subset of service edges not yet served.Initialize RU=R, k=1, v=0
2. (Decision at vertex v) If an edge can be selected from RU that can be served by route k, then
serve the edge and remove it from RU
update the vehicle capacity and the vehicle position v with the reached vertex wgo to step 2
Otherwise reach the depot following the shortest path SP(v,0), and set k=k+1 and v=0
3. If k≤K and RU≠∅ then go to step 2Otherwise stop
196VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Path Scanning Algorithm
The edge selected at each iteration (step 2) from RU must satisfy the vehicle capacity constraint and can be chosen with one among the following criteria:
the cost increment is minimizedthe residual capacity is maximizedthe distance from the depot is either maximized or minimizedthe distance from the depot is maximized if half of the vehicle capacity is available, otherwise is minimizedrandom
99
197VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Augment-Merge Algorithm
Build a distinct tour for serving each single edge in RAugment:
starting from the longest tour, serving, e.g., edge e, extend the service to edges different from e but included in the tour as long as it is allowed by the vehicle capacity
Merge: compute the savings caused by any possible merge of pairs of routessort the savings in non increasing ordermerge the pair of tours starting from the greatest saving as long as the vehicle capacity allowed it and the savings is positive
198VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Augment-Insert Algorithm
Initialize:Set RU=R, and the list L of edges (i, j) in RU in descending order of SP(0, i) + SP(j,0). Find the least cost cycles C(i, j) that serves the required edges
IterationAugment:
Select the first (farthest) edge in RU from L. If no edge is found go to the following step. Augment C(i, j) by assigning edges in RU on the cycle following L until the vehicle capacity is exhausted. Remove the serviced edges from RU
Insert:Following L insert in the current cycle edges in RU as long as the insertion cost does not exceed the upper bound CLIM (parameter) or the vehicle capacity is exhausted.
100
199VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Augment-Insert Algorithm
In a version II of the algorithm the priority is given to the edge with smaller demand
The value assigned to CLIM influence the length of the cycles, and larger values allows greater detours
200VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Construct-Strike Algorithm
IterationConstruct:
By sequentially adding edges form a capacity-feasible cycle Csuch that G-C remains connected
Strike: remove the cycle from G and repeat the construct step until all the required edges are served or no more cycles are found.
Remove any non required edges added in previous iterationObtain an eulerian circuit by solving a matching problem for the odd degree vertices remaining in G and two copies of the depot (that must have even degree)Iterate until all the required edges are served
101
201VRP – Massimo Paolucci
Heuristics for the CARPConstructive heuristics: The Construct-Strike Algorithm
Criteria similar to the Path-Scanning can be used for edge selection in the construct phaseA good quality alternative is to select the (i, j) edge that maximize the total demand on the path from j back to the depot with the smallest total demand
The heuristics behaving better:Augment-InsertConstruct-Strike (with the above selection rule)Path Scanning with random insertion
No constructive algorithm is dominant
202VRP – Massimo Paolucci
Heuristics for the CARPTwo-Phase heuristics: The Route First - Cluster SecondAlgorithm (Ulusoy)
Route: Determine a single tour C that include all the required edges but disregards the vehicles’ capacity (solve a RCPP)
Balance&
Connect
102
203VRP – Massimo Paolucci
Heuristics for the CARPTwo-Phase heuristics: The Route First - Cluster SecondAlgorithm (Ulusoy)
Cluster: Build an auxiliary directed graph T = (V,A) as follows:
the vertices in V correspond to the edges in R, plus a final vertex feach arc (i, j)∈A connects a pair of vertices associated with two edges in R such that i is visited before j and the partial tour from ito j-1 can be feasibly served by vehicle. An arc (i, f)∈A means that all the edges from i to the end of tour C can be feasibly served by a vehiclea cost is associated with each arc (i, j)∈A which includes the cost from depot to edge i, from edge i to edge j-1 and from this latter to the depotFind the min cost path on T from the vertex associated with the first edge of C to vertex f. Each arc on such path corresponds to a vehicle route on the original network
204VRP – Massimo Paolucci
Heuristics for the CARPTwo-Phase heuristics: The Route First - Cluster SecondAlgorithm (Ulusoy)
fa
b
cd
ea b c d e
3
2Vehicle capacity = 5
2
2
3
cac ⇒ cost of cycle =
from depot to edge a
+ from edge a to edge b
+ from edge b to depot
cac
103
205VRP – Massimo Paolucci
BibliographyHandbooks in Operations Research and Management Science, Vol. 8: Network. Routing, eds M. O. Ball, T. L. Magnanti, C. L. Monma, and G. L. Nemhauser, Elsevier, Amsterdam, NL (1995).
The vehicle routing problem, eds P. Toth, D. Vigo, SIAM, Philadelphia, USA (2001).
Scienze delle decisioni per i trasporti, eds S. Pallottino, A. Sciomachen, Franco Angeli, Milano, I (1999).
Arc Routing : Problems, Applications and Algorithms. Eiselt,H.A., Gendreau,M., Laporte,G., Centre for Research in Transportation Edition, University of Montreal, (1992).