Advances in Pure Mathematics
Vol.06 No.05(2016), Article ID:65771,9 pages

An Alternative Algorithm for Vehicle Routing Problem with Time Windows for Daily Deliveries

Nor Edayu Abdul Ghani, S. Sarifah Radiah Shariff, Siti Meriam Zahari

Centre for Statistics and Decision Science Studies, Faculty of Computer and Mathematical Sciences, Universiti Teknologi MARA, Shah Alam, Malaysia

Copyright © 2016 by authors and Scientific Research Publishing Inc.

This work is licensed under the Creative Commons Attribution International License (CC BY).

Received 30 December 2015; accepted 19 April 2016; published 22 April 2016


This study attempts to solve vehicle routing problem with time window (VRPTW). The study first identifies the real problems and suggests some recommendations on the issues. The technique used in this study is Genetic Algorithm (GA) and initialization applied is random population method. The objective of the study is to assign a number of vehicles to routes that connect customers and depot such that the overall distance travelled is minimized and the delivery operations are completed within the time windows requested by the customers. The analysis reveals that the problems experienced in vehicle routing with time window can be solved by GA and retrieved for optimal solutions. After a thorough study on VRPTW, it is highly recommended that a company should implement the optimal routes derived from the study to increase the efficiency and accuracy of delivery with time insertion.


Vehicle Routing Problem with Time Windows (VRPTW), Genetic Algorithm (GA), Random Population Method

1. Introduction

In daily distribution business activities, no company is free from vehicle routing problem especially in terms of searching the minimum distance to deliver the goods. The travelled distance related to people and goods is very significant. It is motivated by the continuously increasing business complexity experienced today [1] . Based on King and Mast [2] , 10 to 15 percent of the final values of traded goods correspond to its distance travel. The transportation problem can be represented in forms of its routing distribution, many constraints and particularities, such as capacity of the vehicle, and time window need to be considered in solving the real world problem. The study with regard to the problem becomes popular as its applications can contribute to the industry and others.

In today’s world, everything is desired by the customers just at one click of a button and the requirement of products becomes so fast. Therefore, delivering products faster and in efficient ways have become very important. The objective of delivering products at a minimum cost (as highlighted earlier, in this study, we consider travelled distance as the cost) involves several other factors. The factors are routes taken, capacity of the vehicles, requirement and constraints sets by the customers and many more. To achieve the objective, several models have been introduced in the previous years.

Vehicle Routing Problem with Time Windows (VRPTW) involves several customers (nodes) to be served by a fleet of vehicles within time interval and each vehicle has its limited capacity. The vehicles deliver the products from the depot to the customers and the trip ends at same depot. The size of the delivered products is identical and consumes same amount of capacity of each vehicle. In addition, the delivery locations are unique and any activities of feeding customers at a node other than main depot are not allowed. The service level efficiency depends on the time required by the customers. Thus, the aim of the study is to minimize the total travel distance of the fleet vehicle every time it travels to deliver the items requested by each customer. Travelling at the minimum route can reduce cost and also increase the efficiency of service time [3] .

Vehicle Routing Problem (VRP) is described as the designation of least cost routes from a central depot to a set of geographically dispersed points with various demands [4] . The vehicle routing problem (VRP) was first proposed by Dantzig and Ramser [5] . It is an extension of the travelling salesman problem. During the past five decades, the VRP models have been developing rapidly and many other new models have derived from this original model [6] . VRPTW is an extension of the VRP with the insertion of time boundaries required by each customer. The time windows become additional constraints whereby in practice the restriction degree of time windows can be varied. In the extreme case, the vehicle needs to arrive within the time window and vehicles that violate this requirement will be rejected. In most cases, violation of time window is acceptable but a penalty will be applied. VRPTW is a combinatorial optimization problem that belongs to NP-hard problems and solving it by exact algorithms is inefficient in general [7] . Additional complexities encountered in VRPTW are length of route constraint arising from depot time windows and cost of waiting time, which is incurred when a vehicle arrives too early at a customer location [8] . Therefore, heuristic algorithms became popular in solving VRPTW. Solomon [9] developed a few heuristics for solving the VRPTW, including saving method, nearest neighbor, insertion and sweeping method. These heuristic algorithms are modified from the original versions which are used to solve the VRP.

Since year 1999, the methods for solving VRPTW have been developed and the most efficient method is two-phased hybrid algorithms. Two-phase hybrid algorithms are divided into two stages which are the minimization of routes number and minimization of travel cost. Basically, the two-phase hybrid algorithm uses the local search procedures to minimize the routes and then minimize the total cost of vehicle routing. Gehring and Homberger [3] have introduced the two-stage hybrid search which minimized the vehicles number using the evolutionary strategy and the minimization of total distance using the tabu search algorithm. Potvin and Bengio [10] used two-phase hybrid algorithm using tabu search, in which in the first phase, the customers are moved out of routes to reduce the total number of vehicles while the second phase is about the exchange between external and internal customer in order to reduce travel costs.

Genetic Algorithm (GA) has been popular due to its contribution in obtaining good solutions for complicated optimization problems in a reasonable amount of time. In particular, heuristic search strategies based on GA have been explored in recent years in order to improve the solutions in VRPTW problems. GA deals with a population of solutions subjected to reproductive processes. Those processes occur under the direct influence of each individual’s relative fitness. The fitness of each individual of a population is defined by the quality of its solution with respect to the objective under consideration. Such a setup contributes to increasing the average fitness of a population in each subsequent generation. After a certain number of generations, we are likely to get a solution of the quality we need. The applicability of GA is spread over a wide variety of fields, such as single to multi-objective optimization, engineering, bin packing, multidimensional numerical optimization, pattern recognition and routing. However, GA has obtained very limited success in the area of vehicle routing, due to their high computational cost [11] .

2. VRPTW Model

In order to ensure that the data is suitable for the comparison purpose, a model has been adapted. Together with the model, several assumptions have been identified to describe the model [12] . The assumptions are listed as follows:

1) There is a demand required by each and every customer in the network.

2) All of the capacities of the vehicles used to transport the goods are identical and limited.

3) The customers have to be served by the fixed number of vehicles.

4) Vehicles have to leave the depot carrying the amount of goods equal to the amount it must deliver to the customers.

5) Time window is given in two values described as lower bound (start time of service at visited customer by respected vehicle) and upper bound (finish time of service at visited customer by respected vehicle).

6) Vehicle is not supposed to begin service at a customer once it crosses the latest time limit.

7) If the vehicle reaches before the earliest time limit, the respected route is rejected and search for new route is analyzed.

8) Service time is allotted to each vehicle for loading and unloading goods to each customer in the network.

9) The total route time of each vehicle is calculated as the sum of travel time (proportional to travel distance), waiting time and service time.

10) The maximum route travelled by a vehicle must be higher than the total route travel distance.

The following are the notations used to describe the model:

: maximum number of vehicles

: capacity of vehicle

: maximum distance that can be traveled by a vehicle

: total number of customers

: distance between customer i and j

: start time of service at customer i by vehicle k

: start time of service at customer i

: service time at customer i

: demand required by customer i

The VRPTW model is adopted from [13] and rewritten as follows:

Subject to

, where and (1)

, where and (2)

, where (3)

, where (4)

, where (5)

, where and (6)

, where and (7)

, where and (8)

The objective function of VRPTW model is to minimize the distance travel. Constraint 1) ensures that each customer is visited by a vehicle while Constraint 2) ensures that same vehicle arrives and departs from each customer it serves. Constraint 3) is to ensure that at most k vehicles are used and Constraint 4) indicates the flow equations for dynamic demands. Constraint 5) is the flow equation for delivery demands and Constraint 6) is to make sure that demands will only transported in the exact route. Constraint 7) is time window constraint and Constraint 8) defines the nature of the decision variables.

3. The Incorporation of Genetic Algorithm in VRPTW

There are many studies in solving VRPTW using GA that have been done. However, in this study the application does not only concentrate on the trial solution but also generating the initial solution. In doing so, random population initialization (GA/R) is used to generate candidate solutions. In addition, the fitness function of this study is the summation of the traveling distance of all the routes as discussed in [14] . This method is then compared with other initialization GA which are Nearest Neighbor (GA/NN) and Greedy Randomized Adaptive Search Procedure (GRASP) in order to observe its performance. In this process, the initial population is selected randomly and population size defined as n, where n does not change during the process and each individual is an n-dimensional solution vector which indicates the permutation of customer’s number. Then the capacity constraint, time constraints and maximum distance constraint are checked at the same time from the first number of chromosome. If it does not violate the constraints, the next number is considered and if it violates the constraints, the next number from other vehicle chromosome will then be applied. The process is repeated until all customers are served [15] . In this study, MATLAB programming software is employed to analyze the data.

The modified Genetic Algorithm in VRPTW consists of three phases namely: 1) initialization of population and chromosome representation; 2) selection and; 3) crossover and mutation. All three phases are discussed in detail as follows.

3.1. Initialization of Population and Chromosome Representation

It is the first stage where GA starts with a set of chromosomes. Initial population is randomly generated in the case where the time taken for converging to the solution is longer. The initial population size used is 100. It defines the size of population at each generation in a GA. Hence 100 sets of random integer N is created where N is the number of customers in the problem. The solution space may not be adequately explored by the algorithm, if the population size is too small. Increasing the population size enables the GA to search more points thereby obtain a better result. However, the larger the population size, the longer the GA takes to compute each generation [16] .

In this study, chromosome representation is in the form of network configuration given by an integer string of length N. A gene in a given chromosome is the point assigned to a customer. The sequence of genes in chromosome string is the order of visitations of the customers. An example of a chromosome resulting in a solution for the network is given in Figure 1 [4] . Based on Figure 1, a chromosome is represented by a series of number. The number shows the sequence of visitation by a vehicle. The chromosome is represented by 1, 3, 5, 7, 6, 8, 9, 4 and 2. It describes that first vehicle leaves depot, travels to customer number 1, then customer number 3, 5 and 7 and then 6, 8, 9, 4 and 2, and finally returns to depot.

3.2. Selection

Selection function is used to select the prospective parents based on evaluation of the fitness function. Then, the selected parent chromosomes are recombined by the crossover operator for creating new population. This study uses a tournament selection in which two identical copies of the population are kept. For each generation, the adjacent chromosomes in one copy of the population are compared pair by pair, and then the chromosome with greater fitness value is selected. Tournament selection is applied because genetically fitter chromosomes are given priority in this mechanism [16] .

3.3. Crossover and Mutation Operators

Single point crossover operator that swaps the whole portion in Figure 2 is used to create a new offspring.

To prevent the premature convergence by involving the random changes of the segments of the parent string,

Figure 1. Chromosome representation.

Figure 2. Single point swap crossover.

Figure 3. Swap mutation.

this study uses swapping mutation where the selection is random for the two segments in the string and then swaps them. Figure 3 visualizes the swap mutation process based on Eiben and Smith [17] .

Iteration process will run for hundred times before terminated.

4. Experimental Results and Comparisons

The analysis is divided into two phases; the first phase analysis is on VRP without time windows and second phase of the analysis is on VRPTW. In phase one, two sets of data comprising small and medium sizes are used to validate the performance of the proposed algorithm (random population initialization (GA/R)) in solving VRP. In phase two, the same sets of data are used to validate the performance of the proposed algorithm (random population initialization (GA/R)) in solving VRPTW. The comparison is made with other type of initializations, GA/NN and GA/GRASP. Below are the conditions of each parameter:

1) Population size (Popsize) defined as the number of chromosomes in each generation (10, 20, 40 and 60).

2) Maximum generation (Maxgen) which is a termination criterion that sets the maximum number of chromosome populations generated before the top scoring chromosome return as the search answer (100).

3) Crossover probability is the probability that a pair of chromosomes cross (0.95).

4) Mutation probability is the probability that a gene on a chromosome randomly mutate (0.01).

4.1. Phase One (VRP) Results

In this benchmarking phase, the results indicate that the performance of GA/R is better compared to other competing heuristics. Moreover, GA/R is also the fastest in computing the results. By observing the shortest distance in all three algorithms and different problem sizes, GA/R provides excellent results by producing the smallest standard deviation. For GA/R, the smallest computational time of 2.49 occurs when population size used is 10. Table 1 and Table 2 summarize the results. Hence, the best route obtained is from the population size of 10. GA/R reaches optimum solution very fast in each of population size. Besides that, the distance obtained by this type of initialization is the minimum, compared to GA/NN and GA/GRASP. In addition, the observation showed that when population size is small, the chances of the algorithm to reach the optimum solution are maximized. GA/GRASP population sizes of 40 and 60 take less than 2 seconds to compute the results. However, in general GA/R takes less optimum time to compute the results. Table 2 shows that large population size has bigger chances for the algorithms to reach the optimum solution. GA/GRASP population sizes of 10 and 60 take less than 2 seconds to compute the results. However, in general GA/R takes less time and optimum time to compute the results.

4.2. Phase Two (VRPTW) Results

The validation phase proved that the proposed method is capable to be applied for small and medium size data. In this phase, the analysis is carried out on two types of data with the insertion of time windows. Table 3 and Table 4 summarize the results of the analysis. Table 3 shows that GA/R performed better than GA/NN and GA/GRASP as the shortest distance comes from GA/R (765 km) compared to GA/NN and GA/GRASP shortest

Table 1. Comparison of initialization for problem size of 8 customers and 3 vehicles.

Table 2. Comparison of initialization for problem size 25 customers and 5 vehicles.

distance is higher (795 km). For the standard deviation, mixed results are found between GA/R and GA/N in which, when only population sizes are 10 and 40, GA/R outperforms GA/NN. In term of average distance GA/R also did well as it has the smallest average distance contributed by population size 40 (783 km) compared to its competitors. However, for bigger population size, the initialization based on GA/R needs to be improved.

4.3. Discussions and Solutions

From the analysis, GA/R has performed well where it generates smaller distance as well as computational time. The best route obtained from GA/R initialization can be used and applied to the vehicle routing problem either with or without time window. The analysis has proved that the VRPTW can be solved by the GA/R and this may helps organizations to consider of using the routes in order to reduce distance travel. Table 5 is the suggested route for each problem size.

Table 3. Comparison of initializations for problem size 8 customers and 3 vehicles (VRPTW).

Table 4. Comparison of initializations for problem size 25 customers and 5 vehicles (VRPTW).

Table 5. Proposed routes according to the problem sizes (VRPTW).

Table 6. Route solutions based on population sizes.

5. Application on Real World Data

Nowadays, logistics and transportation are needed for daily delivery in order to deliver the items demanded by customers. In daily delivery, they practically experience many types of the vehicle routing problems. Par- ticularly, the problem is based on the distribution time which does not meet the time that is required by customers. The problem that considers the distribution time is specified as the vehicle routing problem within time interval or VRPTW and is designed to solve and increase the company’s delivery efficiency in future. This is a case study of a district in Selangor, Malaysia in which the company is supplying ice cubes for several cus- tomers within the area. We capture and analyze the problem in details and report the solutions.

Based on the results in Table 6, we observe that the best route can be obtained within 2 to 3 seconds and the results are consistent based on small standard deviations values (ranges from 1.24 to 2.56).


We would like to acknowledge Ministry of Higher Education Malaysia and Research Management Institute (RMI) of Universiti Teknologi MARA, Malaysia, for funding this research through Grant No: 600-RMI/FRGS 5/3 (9/2013).

Cite this paper

Nor Edayu Abdul Ghani,S. Sarifah Radiah Shariff,Siti Meriam Zahari, (2016) An Alternative Algorithm for Vehicle Routing Problem with Time Windows for Daily Deliveries. Advances in Pure Mathematics,06,342-350. doi: 10.4236/apm.2016.65025


  1. 1. Alvarenga, G.B., Mateus, G.R. and de Tomi, G. (2007) A Genetic and Set Partitioning Two-Phase Approach for the Vehicle Routing Problem with Time Windows. Computer & Operation Research, 34, 1561-1584.

  2. 2. King, G.F. and Mast, C.F. (1999). Excess Travel: Causes. Extent and Consequences. Transportation Research Record, 1111, 126-134.

  3. 3. Gehring, H. and Homberger, J. (1999) Two Evolutionary Meta-Heuristics for the Vehicle Routing Problem with Time Windows. INFORMS Journal on Computing, 37, 297-318.

  4. 4. Ombuki, B., Ross, B.J. and Hanshar, F. (2006) Multi-Objective Genetic Algorithms for Vehicle Routing Problem with Time Windows. Applied Intelligence, 24, 17-30.

  5. 5. Dantzig, G. and and Ramser, R. (1959) The Truck Dispatching Problem. Management Science, 6, 80-91.

  6. 6. Becker, B., Furnon, V., Shaw, P., Killby, P. and Prosser, P. (2000) Solving Vehicle Routing Problems Using Constraint Programming and Metaheuristics. Journal of Heuristics, 6, 501-523.

  7. 7. Cormen, T.H., Leiserson, C.E., Rivest, R.L. and Stein, C. (1999) Introduction to Algorithms. Cambridge MIT Press, Massachusetts, 1111.

  8. 8. Braysy, O. (2001) Metaheuristics for Vehicle Routing Problem with Time Windows (Internal Report STF42 A01025). SINTEF Applied Mathematics, 30.

  9. 9. Solomon, M.M. (1987) Algorithms for the Vehicle Routing and Scheduling Problems with Time Window Constraints. Operation Research, 35, 254-265.

  10. 10. Potvin, J.Y. and Bengio, S. (1996) The Vehicle Routing Problem with Time Windows-Part II: Genetic Search. INFORMS Journal of Computing, 8, 165-172.

  11. 11. Chang, Y. and Chen, L. (2007) Solve the Vehicle Routing Problem with Time Windows via Genetic Algorithm. Discrete and Continuous Dynamical Systems Supplement, 6, 240-249.

  12. 12. Mingyong, L. and Erbao, C. (2010) An Improved Differential Evolution Algorithm for Vehicle Routing Problem with Simultaneous Pickups and Deliveries and Time Windows. Journal Engineering Applications of Artificial Intelligence, 23, 188-195.

  13. 13. Díaz-Parra, O., Ruiz-Vanoye, J.A. and Zavala-Díaz, J.C. (2010) Population Preselection Operators Used for Generating a Non-Random Initial Population to Solve Vehicle Routing Problem with Time Windows. Scientific Research and Essays of Academic Journals, 5, 3529-3528.

  14. 14. Baker, B.M. and Ayechew, M.A. (2003) A Genetic Algorithm for the Vehicle Routing Problem. Computer and Operation Research, 30, 787-800.

  15. 15. Gen, M. and Cheng, R. (2000) Genetic Algorithms and Engineering Optimization. Wiley, New York.

  16. 16. Ishtiaq, M.S. (2011) Vehicle Routing Problem in Logistic: A Genetic Algorithm Based Comparative Study. PhD Thesis, UMI, 41-50.

  17. 17. Eiben, E. and Smith, J.E. (2003) Introduction to Evolutionary Computing. Natural Computing Series, MIT Press/ Springer, Berlin.