You are on page 1of 21

Master Cloud Computing & HPC

Research Project
Mathematical modelling & graph theory
Subject :

Using distributed and high performance


computing to solve vehicle
routing problem with stochastic demands

Realized by :

Yassine AMMAR, Hamid ELBOUABIDI,


Youssef CHARKAOUI and Sara MAFTAH

Academic Year : 2019-2020


PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 2

Using distributed and high performance


computing to solve vehicle routing problem with
stochastic demands
Yassine AMMAR*, Youssef CHARKAOUI*, Hamid ELBOUABIDI* and
Sara MAFTAH*

Abstract—After introducing the general classes of Vehicle Routing Problem and some related solutions, this report
focuses on the Vehicle Routing Problem with Stochastic Demands (VRPSD) within the safety stocks approach that
deals with uncertainty in the customer demands by considering safety stocks, i.e. when designing the routes, part of the
vehicle capacity is reserved to deal with potential emergency situations caused by unexpected demands. We will
discuss the methodology used by Juan and al. and we will see how the parallelization of this methodology can be
employed to efficiently solve the VRPSD.
Thus, for a given VRPSD instance, our algorithm considers different levels of safety stocks. For each of these levels, a
different scenario is defined.

Index Terms—Vehicle Routing Problems, Stochastic demands, Stochastic optimisation, Stochastic Planning, Safety
Stocks, Parallel Metaheuristic, Parallel and distributed computing.

1 G ENERAL P RESENTATION OF V EHI - 1.1 Components


CLE R OUTING P ROBLEMS Four main components constitute a vehicle
routing problem. The generality, the terminolo-
gies mainly used for these components are:
S INCE the introduction of a paper by Dantzig
and Ramser in 1959 [], the Vehicle Routing
Problems (VRP’s) became an important class
• The network, which is generally de-
scribed as graph.
of integer optimisation problems that was • The sites to be visited (customers to
considered a generalization of Travelling serve, tasks to process, etc.), denoted as
Salesman Problems (TSP’s) and attracted a customers which have a specific request
large part the operational research community. often called a demand. Demands can be
The authors of [] studied the problem in its of many types from a product to be
simplest form as a real-world application supplied/collected to a service to be pro-
concerning the delivery of gasoline to gas vided
stations, and proposed a simple matching- • The fleet of vehicles that represents the
based heuristic for its solution and illustrated mobiles performing the task.
it on a small-sized example. • The depot(s), usually from where the ve-
hicles start and come back.
We begin by given general components of
The network is made up of vertices and arc-
VRP’s.
s/edges representing the links between ver-
tices. In a logistics context, it is characterized
• *ENSIAS Msc Cloud computing & High performance computing by the transport infrastructure. It consists of the
students . fixed installations including the road junctions,
and nodes which are terminals (such as sea-
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 3

ports, stations, warehouses and depots). length (or time) constraint instead of ca-
Nevertheless, in other applications, the net- pacity constraint.
work is not always materialized by a physical ∗ Multi-Depot VRP (MDVRP) : company
structure, and arcs are used to describe the may have several depots from which it
allowed movements. can serve its customers. If the customers
Note that the graph can be direct, particu- are clustered around depots, then the
larly when they can be traversed in only one distribution problem should be modeled
direction because of the presence of one-way as a set of independent VRPs. However,
courses. if the customers and the depots are in-
Each arc is weighted by a cost, which generally termingled, then a MDVRP should be
represents its length and/or travel time. solved. A MDVRP requires the assign-
ment of customers to depots. A fleet of
1.2 Objective vehicles is based at each depot.
The main objective of VRP is the customers’ ∗ VRP with Pick-Up and Delivering
demands satisfaction with the minimization of (VRPPD) : is a VRP in which the pos-
total costs. sibility that customers return some com-
modities is contemplated. So in VRPPD,
it should be taken into account that
1.3 Variants of VRP’s
the goods returned by customers to the
The variations of components with the appear- delivery vehicle must fit into it. These
ance of constraints give the emergence to many restrictions make the planning problem
types of VRP’s. more difficult and can lead to bad uti-
∗ Capacitated VRP (CVRP) : is a Vehicle lization of the vehicles capacities, in-
RoutingProblem (VRP) in which a fixed creased travel distances or a need for
fleet of delivery vehicles ofuniform ca- more vehicles. Hence, it is usual to con-
pacity must provide service to known sider restricted situations where all de-
customerdemands for a single commod- livery demands start from the depot and
ity from a common depot atminimum all pick-up demands shall be brought
transit cost. That is, CVRP is like VRP back to the depot, so there are no in-
with theadditional constraint that every terchanges of goods between the cus-
vehicle must have uniformcapacity of a tomers.
single commodity. ∗ Split Delivery VRP (SDVRP) : a relax-
∗ VRP with Time Windows (VRPTW) : ation of the VRP wherein it is allowed
is a VRP with the additional restriction that the same customer can be served
that each customer ci should be served by different vehicles if it reduces overall
in a time interval [ei , li ] (time window), costs. This relaxation is very important
where ei and li represents the early and if the sizes of the customer orders are as
late time. big as the capacity of a vehicle.
∗ VRP with Backhauls (VRPB) : The ∗ Periodic VRP (PVRP) : In classical
VRPB is the extension ofthe VRP in VRPs, typically the planning period is a
which the customer set is partitioned single day. In the case of the Period Vehi-
into two subsets. One contains cus- cle Routing Problem (PVRP), the classi-
tomers that require a given quantity of cal VRP is generalized by extending the
product to be delivered and the second planning period to a specified number of
contains customers where a given quan- days.
tity of inbound products must be picked
up.
∗ Distance-Constrained VRP (DCVRP) :
In DCVRP, each route has a maximum
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 4

where a set K of a homogeneous fleet of


vehicles of capacity Q can start, and vertices
v = 1, 2, 3, ..., n represent the customers, each
with a given demand qi for a service. A weight
cij is associated with each edge (i, j), i, j ∈ V .
The CVRP can be mathematically formulated
as the following :

X X
min cij · xkij (1)
k∈K (i,j)∈V
X X
xkij = 1 ∀i ∈ V \ {0} (2)
j∈V\{i} k∈K
Fig. 1. Types of VRP’s X X
xkij = xkji ∀i ∈ V \ {0}∀k ∈ K (3)
j∈V\{i} j∈V\{i}
X X
qi · xkij ≤ Q ∀k ∈ K (4)
i∈V\{0} j∈V\{i}

xkij ∈ {0, 1} ∀(i, j) ∈ V∀k ∈ K (5)

(1) is the objective-function, sums the total cost


of the routes.
Constraints (2) and (3) are the continuity con-
straints: a single vehicle visits customer i and
this vehicle leaves it.
Vehicle capacities hold due to constraints (4).
For (5), the binary variables xkij are equal to
1 if vehicle k goes through arc (i, j), and 0
otherwise.

Fig. 2. A pictorial representation of the problem 2 S OLUTION METHODS FOR THE


CVRP
1.4 The mathematical formulation of CVRP 2.1 Classical methods
In this section, we review the formulation Exact algorithms to solve VRP especially the
of a classical VRP variant, namely the CVRP include tree search methods like the
capacitated vehicle routing problem (CVRP). branch-and-bound, the branch-and-cut and the
This formulation is the basis of the other branch-and-price algorithms.
VRP variants. The purpose is to set the A branch-cut-and-price exact algorithm was
notations, nomenclature and foundations for suggested by S. Ropke and al. in [] for the Ca-
the remaining sections of this paper. pacitated Vehicle Routing Problem with Two-
The capacitated vehicle routing problem Dimensional Loading Constraints.
(CVRP) can be defined on a complete and Column generation or Dantzig-Wolfe decompo-
undirected weighted graph G = (V, E), sition provides a flexible framework that can
where V = {0, 1, 2, ..., n} is the vertex set accommodate complex constraints and time-
and E = {(v, u) : v, u ∈ V, v 6= u} is the edge dependent costs.
set. Vertices v = 0 represent the depot from Also dynamic programming and the integer
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 5

programming-based methods are methods to and compact metaheuristics. They are


solve VRP. often designed to replace the local search
Nevertheless, besides to their computational within another metaheuristic. The ap-
cost, all these methods seems to be obslete in proach was introduced by Mladenovi
the case of big instances, thus researchers tried and Hansen.
to find alternatives to this methods.
2.2.2 Bio-inspired methods
2.2 Heuristics and meta-heuristics meth- Bio-inspired methods are class of stochastic
ods search methods that operate on a population
2.2.1 Simple heuristics of solutions by simulating. We could find many
subclasses of Bio-inspired algorithms, such as
Simple heuristics are designed to build a sin-
: genetic algorithms, Ant colony optimisation
gle solution, while local search procedures and
algorithms, neural network algorithms, a full
metaheuristics examine several solutions, ei-
and detailled description of these algorithms
ther by generating a sequence of solutions or
are given in F.B.Pereira and J.Tavares.
working on a population. Apart from the con-
struction of initial solutions in metaheuristics,
they are also widely used in commercial VRP 2.3 SR-GCWS heuristic
software to quickly find feasible solutions of Simulation in Routing via the Generalized
good quality. Two reasons for their popularity Clarke and Wright Savings heuristic (SR-
are their simplicity and the fact that they can GCWS) is a method based on the Clarke and
be easily extended to cope with various con- Wright savings algorithm which is one of the
straints. most known heuristic for VRP. It was devel-
Thera are many meta-heuristic class solutions oped by Clarke and Wright in 1964 and it
to the VRP, a good review can be found in applies to problems for which the number of
[], we give a short description for some of vehicles is not fixed (it is a decision variable),
metaheuristical methods : and it works equally well for both directed
• The simulated annealing (SA) algorithm for and undirected problems. When two routes
combinatorial optimization was intro- (0, , i, 0) and (0, j, , 0) can feasibly be merged
duced by Kirkpatrick et al. in 1983 and into a single route (0, , i, j, , 0), a distance saving
is inspired by a physics phenomenon Sij = ci0 + c0j − cij is generated.
concerning the behavior of atoms under The algorithm works at follows :
temperature changes. • Step 1 : Savings computation
• The Tabu Search (TS) comes from Glover,
and can be applied to various com- – Compute the savings
binatorial problems. Unlike SA, TS is sij = ci0 + c0j − cij for i, j = 1, , n
a fully deterministic method. In sev- and i 6= j .
eral cases, TS provides very good so- – Create n vehicle routes (0, i, 0) for
lutions, making this method among i = 1, , n.
the most effective to tackle difficult – Order the savings in a non in-
combinatorial problems. These successes creasing fashion.
have made the method very popular, • Step 2 : Create the ”savings list” Process
although nowadays, other approaches the savings list beginning with the top
seem to be more efficient, such as evo- most entry in the list (the largest Sij ). For
lutionary methods and iterated local the savings under consideration (Sij ),
search algorithms. include link (i, j) in a route if no route
• The variable neighborhood search (VNS) constraints will be violated through the
and its simpler variant the variable inclusion of (i, j). The following three
neighborhood descent (VND) are fast cases need to be considered.
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 6

– case 1 : If neither i nor j have mechanism is often referred to as short term


already been assigned to a route, memory. Other features such as diversification
then a new route is initiated in- and intensification are often implemented. The
cluding both i and j . purpose of diversification is to ensure that the
– case 2 : If exactly one of the two search process will not be restricted to a lim-
points (i or j ) has already been ited portion of the solution space. A possible
included in an existing route and way to implement diversification is to keep
that point is not interior to that track of past solutions and penalize frequently
route (a point is interior to a route performed moves. This mechanism was first
if it is not adjacent to the depot in applied to the VRP by Taillard (1992), and is
the order of traversal of points), often called long term memory. Intensification
then the link (i, j) is added to that consists of performing an accentuated search
same route. If the point is inte- around the best known solutions.
rior and not violating the capacity
then add (i, j) to the same route.
If its violating the capacity make 3 V EHICLE R OUTING P ROBLEMS WITH
a new route with the point (cus- S TOCHASTIC D EMANDS
tomer) i.
– case 3 : If both i and j have al- 3.1 Uncertainty and VRP
ready been included in two dif- In reality VRP are not always determinsitic,
ferent existing routes and neither many components or constraints could be
point is interior to its route, then stochastic, thus we talk about Stochastic Vehicle
the two routes are merged by con- Routing Problems (SVRP) .
necting i and j . If they are interior The main classes of SVRP are :
then the merge cannot be done.
• VRP with stochastic demands (VRPSD) : A
• Step 3 : If the savings list Sij has not been probability distribution is specified for
exhausted, return to Step 2, processing the demand of each customer, in most
the next entry in the list; otherwise, stop. cases demands are typically assumed to
be independent.
2.4 Tabu search • VRP with stochastic travel times (VRPSTT)
Tabu Search was proposed by Glover (1986) : The travel times required to move be-
and has quickly become one of the best and tween vertices, as well as sometimes ser-
most widespread local search methods for com- vice times, are random variables.
binatorial optimization. The method performs • VRP with stochastic customers (VRPSC) :
an exploration of the solution space by moving Each customer has a given probability of
from a solution xt identified at iteration t to the requiring a visit.
best solution xt+1 in a subset of the neighbour-
hood N (xt ) of xt . Since xt+1 does not necessarily
improve upon xt a tabu mechanism is put in
place to prevent the process from cycling over
a sequence of solutions.
A naive way to prevent cycles is to forbid
the process from going back to previously en-
countered solutions, but doing so would typ-
ically require excessive bookkeeping. Instead,
some attributes of past solutions are registered
and any solution possessing these attributes
may not be considered for θ iterations. This Fig. 3. Types of SVRP
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 7

In this paper we will give a detailled de- As such, on one hand, the vehicle routes are
scription of the Vehicle Routing Problems with designed in advance by applying a particular
Stochastic Demands. algorithm but on the other hand, due to the
uncertainty of the customers demands, at some
point along a route the capacity of the vehicle
3.2 VRPSD basic charcteristics and exam- may be depleted before all demands on the
ples route have been satisfied.
VRPSD have received attention only recently,
the first detailed study of VRPSD was given in The main goal here consists of determin-
a paper by D.J.Bertsimas proposed in 1992, in ing the optimal solution (set of routes) that
wich the author try to configure the problem minimizes those tangible costs subject to the
of money collection/distribution over a central following constraints:
Bank, in this case the demands was stochastic,
1) All routes begin and end at the depot.
following some specific probability law of
2) Each vehicle has a maximum load ca-
distribution. Hence if a bank has to collect
pacity, which is considered to be the
money on a daily basis from several but not all
same for all vehicles.
of its branches. The capacity Q of the vehicle
3) All (stochastic) customer demands
used may not correspond to any physical
must be satisfied.
constraints but to an upper bound on the
4) Each customer is supplied by a single
amount of money that a vehicle is permitted
vehicle.
to carry for safety reasons established by
5) A vehicle cannot stop twice at the
insurance companies. In the same way, there
same customer without incurring in a
is a similar study where the bank decides to
penalty cost.
deliver money to Automated Teller Machines
(ATM) that are geographically dispersed over
several areas. 3.3 Dealing with demands uncertainty
Similarly, the collection of recyclable material Two major techniques are used to deal with
can be considered as a VRSPD, where the stochasticity in VRP’s : a priori optimization and
probability of visiting an assembly point is re-optimization .
given, and the capacity Q corresponds to the
physical constraint that a truck can carry only 3.3.1 A priori optimization
a fixed weight or volume, we talk about Green
In priori-optimization a solution must be deter-
VRPSD (GVRPSD).
mined beforehand, this solution is ”confronted”
Moreover, the VRPSD is related to many
with the realization of the stochastic parameters
practical situations. Psaraftis (1995) and
in a second step.
Chepuri and Homem de Mello (2005)
We can distinguish tree main approaches :
investigated the delivery of petroleum
products, industrial gases, and home heating • Chance-constrained programming :
oil. Shen et al. (2009) presented an example Probabilistic constraints are sometimes
regarding the delivering of supplies to cities transformed into deterministic ones by
under a state of emergency. Markovic et al. the formulation of an optimization
(2005) suggested that the VRPSD could be used problem that ensures that the
to model the delivery and pickup processes probability of meeting a demand is
of mail, packages, and recycled material from above a certain level (for example :
offices and industrial plants. P (Di ≤ capacity) ≤ 1 − α where Di total
demand assigned to a route. In other
The basic characteristic of the VRPSD is that words, it restricts the feasible region so
the actual demand of each customer is revealed that the confidence level of the solution
only when the vehicle reaches the customer. is high. The chance-constrained method
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 8

is a relatively robust approach, however, programming with recourse. In the first stage,
it is often difficult to solve. an a priori solution (i.e. a complete set of routes
• Stochastic programming with recourse as in a deterministic VRP) is planned. Then,
In this approach we must take a recourse in the second stage, this first-stage solution is
which is an action must be done to ”ad- executed; that is, each route is followed, and
just” the a priori solution to accommo- the actual values of the stochastic parameters
date the revealed information. (the customer demands in the case of VRPSD)
are gradually revealed.
3.3.2 Re-optimization In the second stage of the problem, failures may
Re-opitmization technique is based on the be observed when a route is executed. Such
implicit assumption that information (in failures occur when the vehicle performing
VRPSD’s information means demands) is the route arrives at a customers location
revealed over time as the vehicles perform without sufficient residual capacity to service
their assigned routes, routes are created piece the observed demand. These occurrences are
by piece based on the currently available simply referred to as route failures.
information. To recover route feasibility, recourse actions
For example Victor Pillac and al. proposed must be taken. As presented in Gendreau,
an appraoch based on dynamic programming Jabali, and Walter (2014), various studies have
known as Multiple Scenario Approach (MSA) as been conducted to formulate and assess the
if a pool of scenarios is continuously optimized efficiency of the possible recourse actions that
and updated to capture the uncertainties. can be applied to the VRPSD.
Even if internally each scenario in the pool
contains acomplete routing for the customers, In the jargon of transport sciences, the first
the only information visible to the user is the stage is named tactical plannig, and the second
next customerto visit. This study proposes an is operational planning.
adaptation of this framework to the VRPSD,
by maintaining a pool of scenarios containing 3.4.2 recourse policy
possible realizations of the customer demands. Recourse actions that can be implemented
Scenarios are optimized with and Adaptive independently by the vehicles performing the
Variable Neighborhood Search and the next routes determined in the first stage of the
client to visit is selected with a Consensus problem. These recourse actions can either
algorithm. be reactive (i.e., implemented only after a
This technique offer greater flexibility over route failure occurs) or proactive (i.e., made
the recourse optimization action, however, it in anticipation of possible failures that could
have to be run every time a decision has to be take place along the route). A reactive recourse
taken, which can be time consuming for large action takes the form of a back-and-forth (BF),
instances. trip to the depot, where the vehicle is able to
restock and then serve the remaining demand
In the following we’ll try to give a two ex- at the customer location where the failure
amples of both frames of work re-optimization occurred.
and a-priori optimization, in the aim to see how After a BF trip, the vehicle simply proceeds
that affect the formulation of the problem. to the next scheduled customer on the route.
In the case of an exact stockout, whereby the
revealed demand matches exactly the residual
3.4 A priori optimization example : re-
capacity of the vehicle, a restocking trip is
course action
performed, entailing that the vehicle visits the
3.4.1 Recourse action depot before proceeding to the next customer
In this approach, the problem is decomposed along the route, see Gendreau, Laporte, and
into two stages, as in two-stage stochastic Sguin (1995) and Hjorring and Holt (1999). In
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 9

an effort to simplify the presentation of the of the VRPSD is given by :


concepts proposed in this paper, we will refer X
to BF trips as all reactive recourse actions taken M inimize cij xij + Q(x)
after route failures, be it as the consequence i<j
of insufficient residual capacity or an exact n
X
stockout. subject to x1j = 2m
j=2
n
X
To formulate the VRPSD, a policy that gov- xkj = 2 (k = 2, ..., n)
erns how the recourse actions are applied must j=2
be determined. Although a wide variety of P
vi S µi
X 
recourse policies can be envisioned (see Gen- xij ≤ |S| − ,
D
dreau, Jabali, and Walter 2016), research has v ,v
i j S

been performed primarily on two categories of (S ⊂ V \ {v1 } , 2 ≤ |S| ≤ n − 2)


recourse actions. In the case in which only reac- 0 ≤ xij ≤ 1 (0 ≤ i < j < n)
tive recourse actions are considered, the classic
0 ≤ x0j ≤ 2 (j = 2, ..., n)
recourse policy is used to model the VRPSD.
Following this policy each route is executed x = (xij ) integer
until it either fails or faces an exact stockout,
at which point an appropriate reactive recourse
3.5 Re-opimization example : the use of
action is implemented.
safety stocks
Safety stocks approach belongs to the so called
stochastic planning strategies, the main idea be-
hind it is the prevention of route failures.
3.4.3 Formulation and mathematical model The highlight of this methodology is that it can
transform the issue of solving a given VRPSD
instance into an issue of solving a small set of
VRPSD in the priori combinatorial
Capacitated Vehicle Routing Problem (CVRP)
optimization approach is splitted into two
instances. Thus, our approach takes advan-
stages :
tage of the fact that extremely efficient meta-
heuristics for the CVRP already exists, which
First stage : find m routes that visit all clients cannot be done in the reourse action priori-
once. optimization approach.
Second stage : execute the routes apply com- In the next section, we will focus on the safety
plete recourse actions stock as an approach to solve the VRPSD.
Settings : demands follow known
distributions and are revealed when a vehicle 4 VRPSD AND THE S AFETY S TOCKS
arrives at a clients location. FRAME WORK
4.1 Liminary and basic notations
Objective: Min. { routing cost + average re-
course cost } In this section we will be based on the work of
Constraints: The total expected demand of A. Juan and al. and campare it to the method-
each route should not exceed the capacity of ology of parallelization.
a vehicle, each client is served by a single Consider a complete network constituted by
vehicle and each route starts and ends at the n + 1 nodes, V = {0, 1, 2, 3, · · · , n} where 0
depot. symbolizes the central depot and V ∗ = V \ {0}
the n customers. The costs associated with trav-
In this case, the mathematical formulation eling from node i to node j are denoted by
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 10

c(i, j); ∀i, j ∈ V and the following assumptions use of Genetic Algorithms, Tabu Search,
hold true: Simulated Annealing or Ant Colony Op-
timization.
1) c(i, j) = c(j, i) (i.e., costs are symmetric)
2) c(i, i) = 0
Thus, one key idea behind our approach is to
3) The triangle inequality is satisfied :
transform the issue of solving a given VRPSD
c(i, j) ≤ c(i, k) + c(k, j)
instance into a new issue which consists of
These costs are usually expressed in terms of solving several ”conservative” CVRP instances,
traveled distances, traveling plus service time each characterized by a specific probability of
or a combination of both. suffering route failures.
Let Vehicle Maximum Capacity : The term conservative refers here to the fact
V M C > M ax{Di }, where Di ≥ 0 ∀i ∈ V ∗ rep- that only a certain percentage of the vehi-
resent the independent random variables that cle total capacity will be considered as avail-
describe customer demand. able during the routing design phase. In other
For each customer, the exact value of its de- words, part of the total vehicle capacity will be
mand is not known before- hand but it is only reserved for attending possible ”emergencies”
revealed once the vehicle visits. No further as- caused by under-estimated random demands
sumptions are made on these random variables during the actual distribution (routing execu-
other than that they follow a well-known theo- tion) phase. This part can be considered as a
retical or empirical distribution either discrete safety stock since it reflects the level of extra
or continuous with existing mean denoted by stock that is maintained to buffer against pos-
E[Di ]. sible route failures. In fact, in the point of view
In this context, the aim is to find a feasible solu- of Juan and al. the safety stcoks methodology is
tion (set of routes) that minimizes the expected described by the following specific steps :
delivery costs while satisfying all customer de-
mands and vehicle capacity constraints. 1) Consider a VRPSD instance defined by
a set of n customers with stochastic
4.2 Fundamentals of the safety stocks demands : Di ≥ 0 and (1 ≤ Di ≤ n)
methodology where each Di follow a predefined
statistical distribution either theoretical
A safety stock is a certain amount of the vehicle
or empirical as long as its mean exists.
capacity that is not considered while designing
Let the vehicle maximum capacity be
the routes. Then, if the final routes demands
VMC.
surpass their expected values, this stock can
be employed to try to satisfy them. Thus, the
2) Determine a set K of percentages,
aim of considering safety stocks is to reduce the
where each element k is the percentage
probability of a route failure. The safety stocks
of the vehicle capacity W that can be
approach is inspired by the two following ma-
used during the route design phase,
jor facts:
in other words, 1k represents a fixed
• The VRPSD can be seen as a generaliza- level of safety stock. For each of these
tion of the CVRP or, to be more specific, elements, follow the steps 3 to 9.
the CVRP is just a VRPSD with constant
demands -random demands with zero 3) Consider the capacitated CVRP(k ) with
variance-. a total vehicle capacity of W ∗ = kW
• While the VRPSD is yet an emerging with the deterministic demands
research area, extremely efficient meta- d∗i = E[Di ]. Where E[Di ] symbolizes
heuristics do already exists for solving the mean or expected value of each
the CVRP, specially a powerful state- random demand.
of-the-art metaheuristics based on the
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 11

4) Generate an initial solution for the is lower than the fixed cost of the cur-
CVRP(k ). This solution is also an apri- rent base solution, then the list of the
oristic solution for the CVRP-SD. It will best deterministic solutions is updated
be employed as it is as long as there (only if it is not full or if the worst
is no need of corrective actions (routes solution has a higher cost, then a swap
failures and re-stockings). Therefore, is performed) and the expected total
the cost associated to this solution, cost of the new solution is estimated
CCV RP (k) , can be considered as a base with a short simulation. If this cost is
or fixed cost of the CVRP-SD solution. lower than the expected total cost of the
In the case of the stochastic problem, base solution, the latter is replaced and
there is also a variable cost CCA (k) the list of the best stochastic solutions
that depends on the corrective actions is updated. Otherwise, an acceptance
undertaken. Consequently, for a given criterion is used to decide whether the
value of k , the total cost of the ”stochas- base solution is deteriorated to the new
tic” solution (the one associated with one. Before that, if the fixed cost of
the CVRP-SD) is the sum of the fixed the new solution is higher, then that
cost corresponding to the ”determinis- solution is discarded. This iterative pro-
tic” solution (the one associated with cess will provide, after analyzing many
the CVRP) and the variable cost due to possible solutions, a list of promising
corrective actions, therefore : solutions for the CVRP-SD.
8) Try to improve all promising solutions
CCV RP SD (k) = CCV RP (k) + CCA (k) with an intensive routing algorithm.
5) Use Monte Carlo Simulation (MCS) to es- 9) Use a long simulation to generate a
timate the expected cost due to correc- sample of total costs for each promising
tive actions for each route j of the apri- solution. Large samples are required to
j
oristic solution, E[CCA (k)] (1 ≤ j ≤ m), obtain estimates with small confidence
Then aggregate the expected total cost intervals.
for all routes, 10) Finally, return the top best stochas-
m
tic solutions (considering all solutions
found with the different values in K ),
X j
E[CCA (k)] = E[CCA (k)]
j=1
and the corresponding samples (they
will be used for completing a risk anal-
In this phase, a short simulation is used ysis).
to quickly get that estimate. Then, the
expected total cost of the solution is The following flowchart represent a sum-
calculated as follows: mary of this methodology :

E[CCV RP SD (k)] = CCV RP (k) + E[CCA (k)]


6) Set a base solution as the initial solu-
tion.
7) Employ a metaheuristic algorithm,
which starts an improvement process
that will continue until a stopping con-
dition, based on time or a fixed num-
ber of iterations, is reached. At each
iteration the following steps are imple-
mented. First, a perturbation is applied
to the base solution to generate a new
one. If the fixed cost of the new solution
1-2 Stochastic and capacitated MDVRP intance Di random
variable with mean E[Di] K set of values of vehicle safety stock

nlter←1 3
Compute a biased-randomized
Consider the cap,MDVRP instance with di=E[Di] and W*=(1-
priority list of customers for each
K)W,where K is the element of K in the niter position
depot based on marginal savings

4 initSol←generate initial sol for cap.MDVRP


Assign each customer to a
ddepot
nlter←nlter+1
Use a short simulation to estimate E[TC(initSol(K))]
Design routes with the fast CWS
5 basSol←initSol heuristic
6
Create two fixed-size lists,bestDetSol and
bestStochSol,and include baseSol in both Re-allocate a given percentage
of customers to depots
newSol←perturbate(basSol)

Re-design routes with the fast


N
CWS heuristic
Is new sol beter
Y than basSol for
7
the cap.MDVRP
Update bestDetSol

Is newSol better N
than baseSol for Y
the stochastic
and cap .MDVRP N

Does newSol satisfy


baseSol←newSol
acceptance criterion

Update bestSochSol Y
N baseSol←newSol
Is stopping criteria
Y met ?
8
Improve all routing
sols(bestDetSol and bestStochSol)

Obtain sample observations of TC


for bestDetSol and bestStochSol 9

Is nlter<size(K) ? Y

10
Retuen bestDetSol and bestStochSol with
sample observations for risk analysis N
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 13

4.3 Advantages of safety stocks approach the current remaining stock. The cost of this
• The methodology is valid for any statis- strategy incorporates the costs on the edges that
tical distribution with a known mean, link a customer with the depot and the depot
either theoretical e.g., Normal, Log- with the next customer minus the cost of the
Normal, Weibull, Gamma, etc. or even edge linking both customers.
experimental.
• In some sense, the methodology is ”re- 4.5 Computational experiments
ducing” a complex VRPSD -where no
efficient metaheuristics have been de- The algorithm has been implemented as a
veloped yet- to a limited set of more Python application and tested on 23 MDVRP
tractable CVRPs where excellent, fast benchmark instances: the first seven were pro-
and extensively tested metaheuristics ex- posed by Christofides and Eilon (1969), the fol-
ists. This adds credibility to the quality lowing four were created by Gillett and Johnson
of the final solution or solutions pro- (1976) and the remaining are described in Chao
vided to the decision-maker. et al. (1993). Vidal et al. (2012), Escobar et al.
• Thus, the methodology exposed here can (2014), and Juan et al. (2015) are some recent
be applied to CVRPSD instances of vir- works using them. These instances have been
tually any size (e.g., problems with hun- adapted as described next. The demand of each
dreds or even thousands of nodes) since customer (di ) has been considered as a random
complexity due to size can be managed variable Di following a log-normal distribution
by efficient CVRP metaheuristics and with mean d i and variance vdi . Three different
Monte Carlo simulation. scenarios have been considered, each one with
a respectively different variance : 0.1 · E[Di ],
0.5 · E[Di ] and 1 · E[Di ].
4.4 Further considerations The first column identifies the instance and the
The algorithm used to get the initial solution for second shows the best known solution (BKS) for
the CVRP is the one proposed in Juan et al. Ini- the MDVRP. The next five columns are associ-
tially, a customer-depot assignment map is set, ated with the solution with the lowest fixed cost:
and then the CWS heuristic is applied to obtain the first, the best deterministic solution - fixed
a fast routing plan. Regarding safety stocks, it cost (BDS-FC), represents the fixed cost; the
is expected that lower values of k will provide second calculates the gap between the BKS and
more reliable routes, as a high percentage of the BDS-FC, which reveals the performance of
the vehicle capacity will be reserved as safety the algorithm for the deterministic version of
stock. However, a high fixed cost will result too, the problem; the third, the best deterministic
since more vehicles will be needed to cover all solution - total expected cost (BDS-TEC), is the
the customers demands. On the other hand, a expected total cost; the fourth, the best deter-
high value of k is related to a lower fixed cost ministic solution - reliability (BDS-R), has been
but a higher variable cost due to the elevated computed as one minus the number of route
risk of having to return to the depot to reload. failures divided by the number of routes; and
Considering the trade-off between these two the fifth, best deterministic solution - k (BDS-
costs, different values are tested as indicated K), provides the percentage of the vehicle total
in step 2. The cost due to corrective actions is capacity chosen. The following column repre-
computed as follows. In case of route failure, sents the gap between the BDS-TEC and the
it includes the cost of returning to the depot BDS-FC. The next three columns are associated
first and then to the customer being served. with the solution with the lowest expected total
It is assumed that the vehicle delivers all the cost: the best stochastic solution - total expected
remaining stock before going back to reload. A cost (BSS-TEC) contains the expected total cost;
re-stocking is carried out when the expected the following two columns, the best stochas-
demand of the next customer is higher than tic solution - reliability (BSS-R) and the best
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 14

stochastic solution - k (BSS-K), show the asso-


ciated reliability, and the k-value respectively.
The next two columns are the gaps between
the BSS-TEC and the BKS, and between the
BSS-TEC and the BDS-FC, respectively. It is
important to highlight that, provided a large
number of sim- ulation iterations is used, the
BSS-TEC is bounded by the BDS-FC and the
BKS (lower bounds), and the BDS-TEC (upper
bound). Therefore, the previous gaps show the
difference between the BSS-TEC and its lower
bounds. The last column is the gap between the
expected total costs of both solutions. Results
are presented in the following tables.
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 16

5 PARALLELIZATION OF SAFETY stocks level. Once the concurrent execution of


STOCK APPROACH the different scenarios ends, the corresponding
solutions are compared to each other and the
5.1 A multiple scenario solution approach one with the lowest total expected costs is se-
As introduced in the previous section, the lected as the best-found routing plan.
safety stock approach deals with uncertainty Here, Monte Carlo simulation stage has been
in the customer demands by considering a integrated into the multi-start constructive pro-
safety stock in the vehicle load, i.e. a certain cess defined in the original algorithm in order
percentage of the vehicle maximum capacity is to obtain, for each generated solution, estimates
not accounted for when designing the routes. of its expected variable costs.
Instead, this percentage is reserved to deal During its multi-start construction stage, the
with potential emergency situations caused by SR-GCWS-CS algorithm introduces a biased
unexpected demands. random behavior within the Clarke & Wright
Using safety stocks not only contributes to Savings (CWS) heuristic in order to generate al-
reduce variable costs due to route failures but, ternative starting solutions satisfying the prob-
related to that, it also increases the reliability lem constraints. Each of these feasible solutions
or robustness of the planned routes, i.e. as consist of a set of roundtrip routes from the
safety stock levels increase, the probability of depot that, altogether, satisfy all demands of
suffering a route failure diminishes. Notice, the nodes by visiting and serving all of them
however, that employing safety stocks also exactly once. While the classical CWS heuris-
increases fixed costs associated with aprioristic tic always chooses the edge with the largest
routing design, since more vehicles and more savings value at each step, the SR-GCWS-CS
routes are needed when larger buffers are uses a pseudo-geometric distribution to assign
considered. a selection probability to each edge in the sav-
Notice, however, that employing safety stocks ings list. Therefore, for each potential edge its
also increases fixed costs associated with probability of being selected is coherent with its
aprioristic routing design, since more vehicles savings value, i.e. edges with greater savings
and more routes are needed when larger buffers will be more likely to be selected from the
are considered. Therefore, when minimizing list than those with smaller savings. By iter-
the total expected cost a tradeoff exists between ating this solution-construction process, differ-
its two components, fixed costs and expected ent randomized CWS solutions, some of them
variable costs. Thus, the challenge relies in the outperforming the original CWS solution, can
selection of the appropriate buffer size. be obtained in just a few milliseconds for most
small- and mid-size instances.
Given a VRPSD instance, our approach con-
siders different levels of this buffer size and 5.2 The parallelization of the algorithm
then solves the resulting scenarios in parallel
by assigning each to a different processing unit.
This is performed by employing a modified
version of the algorithm proposed by Juan et
al. (introduced in the previous section).
In this modified version a Monte Carlo simu-
lation stage is integrated inside the multi-start
process, which allows estimating the variable
costs associated with each candidate solution.
Thus, among the multiple solutions generated
for each scenario, the ones with lowest total
expected costs are stored as the best-found re-
sult associated with the corresponding safety-
Given a CVRPSD instance withh Di ~
know probability distrubution and
VMC >> Max{Di}

Set scenario #0 Set scenario #1


stock1 = step%
Set scenario #2
stock2 = (2*step)%
…… Set scenario #p
stock = (p*step)%
stock = 0%

Consider the fololowing problem :


CVRP(stock) with di = E[Di] and Avaliable vehicule Capacity = (1 –
stock)*VMC

Assign each problem-scenario to a different processing unit

Solve it by using a variation of the SR-GCWS-CS algorithm tat integrates MC


simulation

Obtain Obtain Obtain Obtain


solution solution solution …… solution
#0 #1 #2 #p

Choose the best-found solution


according to total expected costs
and reliability criteria
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 18

5.3 A multi-computer and multi-process ex- • A viable alternative to parallelizing algo-


periment rithms has been the exploitation of on-
going increases of clock speed of single
In order to analyze how expected total costs
CPUs of modern microprocessors.
provided by the algorithm depend upon the
variables computing time and parallelization Using Parallel and Distributed Computing
level, a final experiment was designed using a Systems help to meet requirements of
heterogeneous cluster environment composed algorithm efficiency and solution quality.
of 16 multi-core node. The experiment con- Moreover, they allow working with a broad
sisted in choosing some of the largest VRPSD range of problem instances in terms of size and
instances, and using the same benchmarks as complexity. Several physical computation units
in the execution of the sequential version of thework concurrently to solve a problem. with the
safety stocks methology. common objective of solving a set of problem
The experience will be executed as a multi- instances.
thread application in Python. These physical computation units can be
a sequential CPU, a multi-core CPU, or
a network of computation nodes. Those
6 C ONCLUSION computing systems can be based on several
decompositions of work units such as
The trend in the VRP concern the use of GPU functional or data parallelism. The basic
(Graphics Processing Unit) in discrete optimiza- idea is to divide conceptual tasks and/or input
tion and in routing problems. The focus is on data into several work packages, which are
GPU-based methods which make use of par- simultaneously processed by different physical
allel processors assigned to different pieces of or logical computational units.
distributed data. The use of these systems is For the CVRP, a large set of efficient
central to the solution of large applications in optimization methods, heuristics, and meta-
which huge data sets must be processed, often heuristics have been already developed,
in real-time. However, this is not yet the case for the
Therefore, this simple report has a principle VRPSD, which is a more complex problem due
aim of introducing a perspective on the use of to the uncertainty introduced by the random
parallel computing to solve VRPSD, so that the behavior of customer demands. Therefore,
programming of VRPSD becomes feasible on there is a real necessity for developing more
GPU. efficient and flexible approaches for the
VRPSD. On one hand, these approaches should
be efficient in the sense that they should
A PPENDIX A provide optimal or near-optimal solutions
T RENDS IN PARALLEL AND DISTRIBUTED to small and medium VRPSD instances in
COMPUTING reasonable computing time. On the other
hand, they should be flexible in the sense
A.1 The overview that no further assumptions need to be made
Parallel and Distributed Computing Systems concerning the random variables used to model
has received attention in the operations customer demands, e.g. these variables should
research (OR) field already for decades, not be assumed to be discrete neither to follow
However, unsurprisingly, the application of any particular distribution.
parallel optimization has been hesitant because:

• Parallelizing algorithms is challenging in A.2 The trends


general from both the algorithmic and Parallel and Distributed Computing Systems
the computational perspective. make possible to distribute the computational
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 19

effort of intensive problem-solving processes cesses in different machines communicate by


through the use of multi-processors and/or interchanging data packets in the form of send-
multi-computers. Thus, these approaches allow ing and receiving messages. Currently, some
the use of various programming paradigms for of these models are mixed in hybrid com-
implementing algorithms. On one hand, in a puting environments, like it happens in some
multi-processor schema some physical process- supercomputers, with hundreds or thousands
ing unit share a machine, which can be a mono- of multi-computers connected to a dedicated
core CPU, a multi-core CPU or a combination local high-speed network, or clusters in a LAN
of both. composed of multiprocessor machines.
The basic paradigm involved in the use of
this schema is shared-memory programming:
the tasks, processes or threads share the com- A.3 The use of Parallel and Distributed
mon global memory system and their in- Computing Systems to solve VRPs
ter task/process/thread communications are Normally, parallel and distributed methods in
memory based. VRP are used based on:
In this context, a task is a logical concept that
• How the global search is conducted, i.e.
represents a set of program instructions to be
either by a unique process or by a coor-
executed by one algorithm or application.
dinated set of processes.
A process refers to a running instance of a com-
• The type of communication and syn-
puter program, i.e., a process might implement
chronization patterns during the global
one or multiple tasks.
search, which might require different
Finally, a process might contain multiple con-
amounts of data exchange.
current execution threads, each of them imple-
• Whether or not the synchronization
menting one or several tasks.
steps are rigid.
On the other hand, in a multi-computer
schema, several physical machines are linked Typically, another point of interest is the set
via network connections such as high-speed of initial parameters of the search, which can
dedicated networks or Ethernet LANs. These be used to find one particular solution from
multi-computer connections can be coupled ge- a set of solutions with different constraints or
ographically (e.g. a cluster-computing environ- different objective functions, thus generating
ment located in a computer room, a super- multiple analysis scenarios. Furthermore,
computing environment with a dedicated net- algorithm parallelization can be done in
work, etc.), or more loosely-coupled in dis- different ways depending on the problem and
tributed environments like it happens in Cloud the hardware/software computing platform
and Grid Computing. These distributed do- being employed.
mains are usually known as meta-computing Several parallel and distributed computing
environments in the sense that a computing in- approaches have been already applied
frastructure is deployed beforehand and it does to different VRP variants. Generally
not necessarily constitute a basic property of speaking, one common resource is to use a
the end-user computer, i.e. this infrastructure is parallel/distributed ”master-slave” approach,
only used as a computing service. The connec- where the master (coordinator) processor can
tions can also be similar to the Internet: a large- take a sequential-based search and dispatch
scale network following different schemes of intensive computations to a set of slave
contributory or volunteer computing. computation processors or workers.
These contributory systems allow the coordi-
nated use of thousands of isolated machines Alternatively, the master processor
in a wide geographically distributed manner. can also take a combination of initial
In a multi-computers schema, the basic parallel parameters/constraints or a set of alternative
paradigm is message passing, where tasks/pro- scenarios, and distribute those scenarios
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 20

it ignores lower-level architectural constraints


and some other important details, such as
memory access contention and overheads,
synchronization overheads,interconnection
network throughput, connectivity, speed limits
and link bandwidths, etc.

Those parameters, in fact, limit the


performance obtained by parallel or distributed
implementations and are not appropriately
considered in most parallel approaches to
VRPs. In our situation we are dealing with
uncertainty in the customer demands by
considering a safety stock in the vehicle
load, i.e. a certain percentage of the vehicle
maximum capacity is not accounted for when
designing the routes. Instead, this percentage
is reserved to deal with potential emergency
Fig. 4. Master-Slave approach
situations caused by unexpected demands.
Using safety stocks not only contributes to
reduce variable costs due to route failures but,
among the slave processors for a concurrent related to that, it also increases the reliability
execution. Information sharing at global level or robustness of the planned routes, i.e. as
can be then used as a way to improve the local safety stock levels increase, the probability of
searches/scenarios. suffering a route failure diminishes. However,
Some of the simplest applications of parallel employing safety stocks also increases fixed
and distributed models do not involve shared costs associated with aprioristic routing design,
information but rather attempt to use as much since more vehicles and more routes are needed
parallel computation as possible. when larger buffers are considered. Therefore,
when minimizing the total expected cost, a
All these parallelization techniques are trade off exists between its two components,
based on: fixed costs and expected variable costs. Thus,
the challenge relies in the selection of the
• The idea of subdividing the direct
appropriate buffer size.
acyclic graph associated with the VRP
instance into several subgraphs, which
are then assigned to the available pro-
cessors in each interaction. A PPENDIX B
• The use of composition operations to P YTHON PARALLEL P ROGRAMMING
allow sharing global information in each B.1 Python in a parallel world
step.
To be an interpreted language, Python is fast,
They use Parallel-shared RAM (PRAM) and if speed is critical, it easily interfaces with
memory models of computation to evaluate extensions written in faster languages, such as
algorithms of high complexity. C or C++. A common way of using Python is
to use it for the high-level logic of a program;
Intuitively, this conceptual model the Python interpreter is written in C and is
corresponds to the programmers view of known as CPython. The interpreter translates
a particular kind of parallel computers (one the Python code in an intermediate language
with a shared-memory multiprocessor), but called Python bytecode, which is analogous to
PROJECT OF MATHEMATICAL MODELLING & GRAPH THEORY. 21

an assembly language, but contains a high level R EFERENCES


of instruction. While a Python program runs, [1] Canhong Lin,Choy, K.L., Ho G.T.S., Chung, S.H., Lam,
the so-called evaluation loop translates Python H.Y. Expert Systems with Applications 41 (2014) 1118-1138.
Survey of Green Vehicle Routing Problem: Past and future
bytecode into machine-specific operations. The trends. Department of industrial and Systems Engineering, The
use of interpreter has advantages in code pro- Hong Kong Polytechnic University, Hung Hom, Hong Kong.
gramming and debugging, but the speed of a 2013 ELSEVIER Ltd.
program could be a problem. A first solution is [2] Clarke, G., & Wright, J. (1964). Scheduling of vehicles from
provided by third-party packages, where a pro- a central depot to a number of delivering points. Operations
grammer writes a C module and then imports Research, 12, 568-581
it from Python. Another solution is the use of [3] Dimitris, J. Bertsimas, (1992). A Vehicle Problem with
a Just-in-Time Python compiler, which is an Stochastic Demand. Operations Research 40(3):574-585
alternative to CPython, for example, the PyPy
[4] Gendreau, M., Laporte, G., Sguin, R. (1996a). A tabu search
implementation optimizes code generation and heuristic for the vehicle routing problem with stochastic
the speed of a Python program. demands and customers. Operations Research, 44(3), 469-477

[5] Hertzberger, L.O. Future Generation Computer Systems


7 (1991) 31-40. Trends in parallel and distributed computing,
Computer Systems Department, University of Amsterdam, FWI,
B.2 Working with processes in Python Kruislaan 403, 1098 SJ Amsterdam, Netherlands.

[6] Juan, A., Faulin, J., Grasman, S., Riera, D., Marull, J.,
On common operating systems, each program Mendes, C. Transportation Research Part C 19 (2011)
runs in its own process. Usually, we start a 751-65 in Using safety stocks and simulation to solve the vehicle
routing problem with stochastic demands, 2010 ELSEVIER Ltd.
program by double-clicking on the icon’s pro-
gram or selecting it from a menu. In this recipe, [7] Juan, AA., Jorba, J., Faulin, J., Caceres, J., Marqus, JM.,
we simply demonstrate how to start a single Using parallel & distributed computing for real-time solving
of vehicle routing problems with stochastic demands, Springer
new program from inside a Python program. A Science+Business Media, LLC 2011 Published online, 23
process has its own space address, data stack, June 2011.
and other auxiliary data to keep track of the
[8] Marinaki, M., Marinakis, Y., Expert Systems With
execution; the OS manages the execution of all Application 46 (2016) 145-163. A Glowworm Swarm
processes, managing the access to the computa- Optimization algorithm for the Vehicle Routing Problem with
tional resources of the system via a scheduling Stochastic Demands. 2015 ELSEVIER Ltd.

procedure. [9] Salavati-Khoshghalb, M., Gendreau, M., Jabali, O., Rei,


W. An Exact Algorithm to solve the Vehicle Routing Problem
with Stochastic Demands under an Optimal Restocking Policy.
September 2017. CIRRELT-2017-61

B.3 Working with threads in Python [10] Salavati-Khoshghalb, M., Gendreau, M., Jabali, O., Rei, W.
(2019) A Rule Based Recourse for the Vehicle Routing Problem
Thread-based parallelism is the standard way with Stochastic Demands. Transportation Science. Published
Online in Articles in Advance 25 June 2019
of writing parallel programs. However, the
Python interpreter is not fully thread-safe. In
order to support multithreaded Python pro-
grams, a global lock called the Global Inter-
preter Lock (GIL) is used. This means that only
one thread can execute the Python code at the
same time; Python automatically switches to
the next thread after a short period of time or
when a thread does something that may take a
while. The GIL is not enough to avoid problems
in your own programs. Although, if multiple
threads attempt to access the same data object,
it may end up in an inconsistent state.

You might also like