Keywords

1 Introduction

Planning and managing transportation activities plays a fundamental role in the modern supply chain. Two categories are well known to address the problem, those who are related to long-distance cargo transport and other related with pick-up and delivery of packages in short distances [16]. The first category consists most of the cases in assignment related formulations with linear restrictions. By the other hand, the initial formulation of vehicle routing problems is proposed by Dantzing & Ramser as a generalisation of Flood’s travelling salesman problem [13] in their work [11] proposed a matching-based heuristic for its solution. The vehicle routing problem objective is finding the best routes for delivery minimising a linear cost function over a set of nodes or clients, usually diverse and disperse forming an integer and combinatorial optimisation-problem. Years later, several heuristic solutions to VRP problem appeared including, savings, proximity, matchings, and intra-route inter-route improvement [20]. The most prominent savings algorithm is the Clarke and Wright savings heuristic, it has remained until now, due to its simplicity and speed for implementation [10]. Exact solution algorithms appear in the 80’s whit two works proposed by Chistofides et al. the first one is a dynamic programming formulation [8] and the second one a mathematical programming formulation making use of q-paths and k-shortest spanning trees [9]. Later, Laporte et al. propose a VRP algorithm based on the solution of linear relaxation of an integer model [19]. Since then, several exact formulations appear but in most cases are solved by branch-and-cut. Also, its posible to formulate VRP as a partitioning problem like the successfull applications [5, 14]. Modern heuristic development is related to the last years, here we highlight the works in tabu search based algorithms [15, 28, 32]. According with [20] vehicle some algorithms were over-engineered and the best meta-heuristic procedure must have a broad and in-depth search of the solution space and can solve several variants of the problem [23]. This work addresses the problem of a classical formulation of capacitated vehicle routing problem with time windows; the case study refers to a cargo company who have to pick packages in 25 locations or nodes. They also count on 13 vehicles with different capacity. The capacity of the vehicles and the demand show kg as cargo units. The structure of the paper show first a short literature review about the CVRPTW and some applications in a similar context in Colombia, later presents de methodological approach and the model design including mathematical formulation, software and hardware used for solve the model. Finally, shows the results and a short discussion about the benefits and difficulties of this approach to solve CVRTW. The main contribution of this article is to show how a complex problem such as CVRPTW can be solved efficiently and simply, allowing the use of different vehicle capacities, which in the classical formulation is not easy to handle.

2 Literature Review

In this item, the work shows relevant and similar applications of vehicle routing problems in Colombia. As designed, the VRP applications solve instance for develope routes in short-haul transport; the particular characteristics of urban development in Colombia, do not allow parking on the street for a long time and also presents demand points without cargo bays. Along whit, present themselves the recurrent issues in cargo transportation as traffic, road maintenance, new works, small roads, among others. The incremental relevance of the CVRPTW in academic literature shows a rise of publications in this problem among last years, from a search in Scopus®. The results show 1429 documents only in the maim formulation over CVRP; including the time windows restrictions, the number of documents in Scopus® gives 722 document results (Fig. 1).

In Colombia the CVRP and his generalization CVRPTW aplies in many contexts, but in litterature can be highligted the works in collection of food donations [4], also in distribution patterns [7] and school bus routing [26]; also there are interesting works applied in other simmilar countries for pharmaceutical distribution [18]. From the same search in Scopus, notice that there are 10 Documents, 6 original articles and 4 proceedings since 2015 [3, 6, 12, 17, 21, 22, 24, 25, 27, 29].

3 The CVRPTW Model Design

The family of VRP models and his study is extensive. The most study model in their taxonomy is the capacitated vehicle routing problem CVRP; the time windows restrictions form a generalisation of this model named VRPTW. The approximation in this work includes the capacity and time windows constraints simultaneously. Fist, we describe and show the mathematical formulation of the model, later also present the solution algorithms and tools to solve the problem.

Fig. 1.
figure 1

Documents per year

3.1 Mathematical Formulation to CVRPTW

The mathematical formulation for modelling CVRPTW shows as follows and its described according [30, 31, 33].

$$\begin{aligned} Min\ \sum _{k\ \in \ K}\sum _{\ ( i,j) \ \in \ A} c_{ij} x_{ijk} \end{aligned}$$
(1)

subject to

$$\begin{aligned} \sum _{k\ \in \ K}\sum _{\ \ \ j\ \in \ \Delta +( i)} x_{ijk} =1\ \ \ \ \ \ \ \ \ \forall \ i\ \in N, \end{aligned}$$
(2)
$$\begin{aligned} \sum _{\ \ \ j\ \in \ \Delta +( 0)} x_{0jk} =1\ \ \ \ \ \ \ \ \ \forall \ k\ \in N, \end{aligned}$$
(3)
$$\begin{aligned} \sum _{\ \ \ i\ \in \ \Delta +( j)} x_{ijk} \ -\sum _{ i\ \in \ \Delta +( j)} x_{jik} =0\ \ \ \ \ \ \forall \ k\ \in N,\ j\ \in N, \end{aligned}$$
(4)
$$\begin{aligned} \sum _{\ \ \ i\ \in \ \Delta -( n+1)} x_{i,n+1,k} =1\ \ \ \ \forall \ k\ \in K, \end{aligned}$$
(5)
$$\begin{aligned} x_{ijk}( w_{ik} +s_{i} +t_{ij} -w_{jk}) \le 0\ \ \ \ \forall \ k\ \in K,( i,j) \ \in A, \end{aligned}$$
(6)
$$\begin{aligned} a_{i}\sum _{\ \ \ j\ \in \ \Delta +( i)} x_{ijk} \le w_{ik} \le b_{i}\sum _{j\ \in \ \Delta +( i)} x_{ijk} \ \ \ \ \forall \ k\ \in K,\ i\in N, \end{aligned}$$
(7)
$$\begin{aligned} E\le w_{ik} \le L\ \ \ \ \ \forall \ k\in K,\ i\ \in \ \{0,n+1\} , \end{aligned}$$
(8)
$$\begin{aligned} \sum _{i\ \in \ N} d_{i}\sum _{j\ \in \ \Delta +( i)} x_{ijk} \le C\ \ \ \ \ \forall \ k\ \in K, \end{aligned}$$
(9)
$$\begin{aligned} x_{ijk} \ge 0\ \ \ \ \ \forall \ k\in K,\ ( i,j) \ \in \ A, \end{aligned}$$
(10)
$$\begin{aligned} x_{ijk} \in \{0,1\} \ \ \ \ \ \forall \ k\in K,\ ( i,j) \ \in \ A. \end{aligned}$$
(11)

The objective function 1 refers to minimize the total cost expressed like distance units in the distance matrix. Constraints 2 restric the assignment of each customer to exactly one vehicle route. Next, constraints 35 characterize the flow on the path to be followed by vehicle k. Additionally, constraints 68 and 9 guarantee schedule feasibility with respect to time considerations and capacity aspects, respectively. Note that for a given k, constraints 7 force \(W_{ik} \)= 0 whenever customer i is not visited by vehicle k. Finally, conditions 11 impose binary conditions on the flow variables.

3.2 Solution Method

  • googleDistance Matrix API: The CVRPTW is solved using google maps distance matrix API [1], and for solve the algorithm this work use google or-tools [2] for developers.

  • googleORTools: OR-Tools is open source software for combinatorial optimization, which seeks to find the best solution to a problem out of a very large set of possible solutions.

  • Routing Options: Time spend in every search of 100 s, fist solution strategy cheapest insertion, local search objective tabu search.

  • IDE: IPython/Jupyter notebooks.

The distance matrix \(C_{ij}\) is created by calling google maps distance matrix API, with units as distance in meters using the directions for every client from the Table 1 and represented in the Fig. 2.

Fig. 2.
figure 2

Clients map - nodes for pick packages

Each client has different demands, the entire fleet is available, but they have different cargo capacity. The first module for the main program developed in python 3.0 is the data creation module, as we say before we use the google distance matrix API, then we add time window constraints with an initial time at 2:00 pm.

The time windows data is a set of pairs with initial time and final time for each time window in every pair into the set.

The vehicle capacities are added as another set of data in the first module of data creation. The second module calculates the distance between directions using the distance matrix created before.

The velocity for every truck is added as a mean velocity for vehicles at the day in Bogota, Colombia (25 km/h). An exciting and useful characteristic of the Google API is the possibility of getting the distance matrix data in real time.

All vehicle capacities must be greater than the sum of every demand nodes. Otherwise, the problem has no feasible solution. The use of heuristics helps to find a feasible (but not always the best) solution with faster development in the time of execution for the algorithm previously selected. The imput information for the first module of data creation in our program is Table 3

Table 1. Geographical coordinates for the demand nodes: Lat = Latitude, Lon = Longitude
Table 2. Fleet with heterogeneous capacity
Fig. 3.
figure 3

VRPTW representation of time windows

The CVPTW presents in each node a time window expressed as the initial time \(i_{t}\) and the final time \(f_{t}\) when a truck can visit a demand node at a time \(v_{t}\) as we show as follows (Table 2):

The vehicle routing problem with time-windows (CVRPTW) reffers to: As can bee seen in the Fig. 3 a fleet of shipping cars with uniform capability must serve clients with known demand and opening hours for a single commodity. At a D depot node, the cars begin and end their paths. Only one car can serve each client. The goals are to minimize the fleet size and assign a sequence of customers to each fleet truck minimizing the total distance traveled so that all customers are served and the total demand served by each truck does not exceed its capacity. The time windows are represented as the time interval vt from it to ft in which each customer can receive deliveries (Table 4).

Table 3. Time windows in minutes starting at 2:00 pm and demands for everey client

4 Results

The solution of the problem was performed using the algorithm of Objective tabu search and includes time window constraints and capacity constraints simultaneously. The performance of the algorithm was measured, given a solution at a time execution of 0.09 s.

The routes for the Trucks contains load in every node, total time and total distance for each. The total distance for every route was 10044 m, the total time of every route was 2174 min, but the more significant time for every rout was 333 min for truck number 4039. Also, we can plot every route, as can see the first two of them as follows:

Table 4. Results for the CVPTW
Table 5. Solution for the CVRPTW

As can be seen in Table 5a it is possible to obtain the routes of each vehicle where the first row shows the route that each vehicle must follow starting from the deposit and returning to it.

Fig. 4.
figure 4

Route 1 - Route generator in google maps

Fig. 5.
figure 5

Route 2- Route generator in google maps

The second row shows the load collected at each point, rows 3 and 4 show the total load collected by each vehicle and the total route time (Figs. 4 and figura4).

5 Conclusions

The use of google optimization tools allows to solve optimization and metaheuristic problems efficiently and also allows its integration with visualization tools such as google maps for a better understanding of the results.

The routing problem in a real case for a Bogota company is solved by reducing the delivery time and the fleet required to carry out the cargo collections.

The biggest contribution of google tools in this case is the possibility of changing the loading capacity of trucks in a simple way.

The solution time is very efficient, achieving a response in a short time for a complex metaheuristic problem.

The company do not need 6 trucks of 13; the demand is satisfied with 7 trucks as it was described in the last item. The model provides dynamic planning for delivery routes using a heterogeneous capacity fleet.

Future research can include machine learning algorithms to add human preference behaviour to chose how to accomplish the routes, including perception aspects like security or comfort.