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

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.


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].

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: V : maximum number of vehicles C : capacity of vehicle L : maximum distance that can be traveled by a vehicle n : total number of customers demand to be delivered to customer routed after node and transported in , The VRPTW model is adopted from [13] and rewritten as follows: , where 0 j ≠ (4) , where , 0,1, , 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.

The 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.

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.

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].

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,   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.

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).

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.

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 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.

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 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.

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.Particularly, 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 customers 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).
ij c : distance between customer i and j ik s : start time of service at customer i by vehicle k i s : start time of service at customer i i t : service time at customer i i d : demand required by customer i ( ) 1, if , belongs to the route by vehicle 0, otherwise

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.

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.