Vehicle Routing Problem with Soft Time Windows Based on Improved Genetic Algorithm for Fruits and Vegetables Distribution

Fresh fruits and vegetables, perishable by nature, are subject to additional deterioration and bruising in the distribution process due to vibration and shock caused by road irregularities. A nonlinear mathematical model was developed that considered not only the vehicle routing problem with time windows but also the effect of road irregularities on the bruising of fresh fruits and vegetables. The main objective of this work was to obtain the optimal distribution routes for fresh fruits and vegetables considering different road classes with the least amount of logistics costs. An improved genetic algorithm was used to solve the problem. A fruit delivery route among the 13 cities in Jiangsu Province was used as a real analysis case.The simulation results showed that the vehicle routing problem with time windows, considering road irregularities and different classes of toll roads, can significantly influence total delivery costs compared with traditional VRP models. The comparison between four models to predict the total cost and actual total cost in distribution showed that the improved genetic algorithm is superior to the Group-based pattern, CW pattern, and O-X type cross pattern.


Introduction
Food safety has received a great deal of attention lately from governments and researchers all over the world because of its significance in healthy diets, disease prevention, and public health [1,2].One of the most important considerations in guaranteeing food safety is the distribution of food products.It is important for commodity distribution companies to optimize the vehicle routing problem with soft time windows (VRPTW) and improve their transportation conditions not only to reduce logistics and distribution costs but to promote food safety.Hence, effective and efficient management of food product transportation and distribution is becoming increasingly important with respect to both logistics and marketing/sales for order delivery times.Perishable goods will begin to deteriorate once they are produced [3], especially fresh fruits and vegetables (FFV), due to inventory, long transit times, and frequent stops to serve customers during transportation and distribution.In addition, FFVs usually have a short shelf life and are easily subjected to vibration and shock during transportation.Therefore, it is important for distributors to make timely deliveries of perishable foods and to avoid excessive vibration and shock in transit, which significantly affects not only the delivery operator's costs and the revenues of retailers, but also the quality and safety of the perishable foods.
At present, China's vegetable production accounts for about 60% of global production and fruit production accounts for about 30%; however, the rates of deterioration during transportation are as high as 20-30% for vegetables and 30% for fruits.Thus, the annual loss of FFV is as high as $40 billion in China [4].In addition, the vast majority of highways are toll roads in China, with toll levels set according to road class, such as freeway, state highway, or provincial highway.Highways with higher class collect more tolls and therefore have higher quality road surfaces, resulting in a lower rate of produce deterioration caused by vibration and shock.The opposite holds true for lower-grade highways; lower tolls mean lower-quality road surfaces, which lead to more vibration and shock and a higher rate of produce deterioration.These facts necessitate the arrangement and selection of integrated and well-designed logistics distribution routes so the supplier can ensure the provision of the freshest foods and satisfy customers' requirements in a cost-effective way.However, no work has been done to investigate the coordination of delivery routing and road class for the case of FFV distribution.Thus, this paper particularly focuses on the effect of delivery routing and road class on FFV deterioration and the quantification of costs during transportation.
A brief literature review is presented in Section 2. In Section 3, the delivery scheduling and vehicle routing problem with time windows and evaluation coefficient of road surface evenness for perishable FFV is formulated as an integer nonlinear programming model.In Section 4, an improved genetic algorithm is proposed.Numerical results are presented in Section 5 through analyzing the total costs obtained from the proposed model and comparing it with three other traditional methods.Section 6 contains concluding remarks.

Literature Review
Most of the literature regarding VRPTW is in the fields of production scheduling, inventory control, and distribution of goods and mainly focuses on industrial products.Papers that comprehensively discuss distribution routes of FFV and the rate of deterioration and bruising due to vibration and shock are relatively rare.The following discussion reviews VRPTW in detail.
VRPTW is an extension of the vehicle routing problem (VRP) and includes the vehicle routing problem with hard time windows (VRPHTW) and the vehicle routing problem with soft time windows (VRPSTW).In VRPHTW, delivering goods outside the time window is not allowed at all, while in VRPSTW, the lower and upper bounds of the time window can be violated at a penalty.Comprehensive reviews of these problems were completed by Ahumada and Villalobos [1], Cordeau et al. [5], and El-Sherbeny [6].As proposed by Calvete et al. [7], all these combinatorial optimization problems have been proven to be NP-hard, and only relatively small problems can be solved to optimality due to their huge computational requirements.For larger problems, scholars usually focus on heuristic and metaheuristic methods, such as genetic algorithms, tabu search, and simulated annealing to derive approximate solutions of acceptable quality in reasonable computational time [8][9][10][11].Figliozzi [12] proposed an iterative route construction and improvement algorithm to solve vehicle routing problems with soft time windows.Tas ¸et al. [13] studied a vehicle routing problem with timedependent and stochastic travel times.
As previously mentioned, these mathematical models are mostly applied to products that are not perishable.Hsu et al. [14] considered the randomness of the perishable food delivery process and constructed a stochastic VRPTW model to minimize the fixed costs for dispatching vehicles; the costs for transportation, inventory, and energy; and the penalty costs for violating time windows.Osvald and Stirn [15] presented a model in which the impact of the perishability as part of the overall distribution cost was considered and used a heuristic approach based on the tabu search to solve the problem for the distribution of fresh vegetables.Chen et al. [3] proposed a nonlinear mathematical model that considered production scheduling and vehicle routing with time windows for perishable food products with the goal of maximizing the supplier's expected total profit.Ahumada and Villalobos [1] reviewed the main contributions in the field of production and distribution planning for agrifoods based on agricultural crops.Amorim and Almada-Lobo [16] proposed a novel multiobjective model that decouples the minimization of the distribution costs from the maximization of the freshness state of the delivered perishable food products to examine the relationship between distribution scenarios and the cost-freshness trade-off.
Some literature focuses on different distribution problems related to perishable food products but does not explicitly consider the vibration and shock during transportation due to road irregularities.Compared with other industrial goods, the significant characteristics of FFV include short shelf life and fast rate of perishability.These characteristics cause great difficulties in delivery logistics.Meanwhile, FFVs are prone to easy bruising, influenced by outside vibration and shock during transportation.Thus, FFVs often quickly suffer from damage.A model based on an improved genetic algorithm was developed to solve these issues.

Model Formulation
In this section, we propose a mathematical model of VRPSTW with a road class evaluation coefficient and different classes of toll roads, in which a supplier has to decide how many products to deliver to retailers, when to deliver them, and the kind of road class.The objective of the supplier is to maximize the expected total profit.Assume that the distribution center has  identical delivery vehicles, it is distributing goods to  geographically dispersed customers, and the capacity and travel distance for a vehicle are  and , respectively.The mathematical models based on the total lowest cost for optimizing target  are formulated as follows: with   = {1, vehicle  travel from  to ; 0, otherwise}, where  0 is fixed cost per vehicle,  1 is running unit cost per vehicle, and  2 (  ) is unit penalty cost if beyond the time windows: where   is demand of customer ,   is evaluation coefficient of road surface evenness between customer  and customer , In ( 1), the first item is total fixed cost for all  vehicles, the second item is total running cost, and the third is penalty cost.Constraint conditions are stated as follows: Constraint ( 4) makes sure all vehicles leave the distribution center and return after the work is completed.Constraint (5) limits each vehicle from being overweight.Constraint (6) guarantees each customer will be served by each vehicle.Constraint (7) ensures that the distance traveled per vehicle cannot be greater than the maximum allowed travel distance.Constraint (8) is a time window that makes sure vehicles arrive at proper times.Constraint (9) ensures that the customer  can be delivered by the vehicle  within the time window.

Improved Genetic Algorithm
This section describes how to solve the VRPSTW for fruits and vegetables distribution problems by using the proposed improved genetic algorithm (IGA) approach.The steps are detailed in the following sections.
4.1.Genetic Algorithm.Genetic algorithms (GA) were first developed by Professor Holland [19].Genetic algorithms are adaptive heuristic search algorithms that are based on the mechanics of natural selection and genetics [20,21].Compared with traditional algorithms, GA has a wider coverage and is better for choosing the optimal solution.The parallelism of GA enables it to process several objects at the same time.It also reduces the risk of a local optimal solution.In terms of VRP, GA has been widely applied, and it has been demonstrated to be a promising search capability and optimization technique.

Improved Genetic Algorithm
4.2.1.Chromosome Structure Coding.Assume that there are  vehicles serving  customers.The length of the chromosome is  +  + 1, and the chromosome structure coding is (0,  1 ,  2 , . . .,   , 0,  1 , . . .,   , 0), where "0" denotes distribution center.Its significance is explained as follows.The first vehicle leaves the distribution center, travels to several customers, and finally arrives back at the distribution center.The second vehicle leaves and comes back after serving customers ( 1 , . . .,   ).Following this pattern, all of the  routes are generated when the th vehicle leaves and comes back at the same time.The order of service can be shown by this structure.
For example, in Figure 1(a), a number 0 indicates the distribution center (Depot), and the number written on each line corresponds to the distance between depot and customers and between customers.The numbers 1, 2, 3, 4, 5, 6, and 7 correspond to customers.Moreover, the portion of the visited route is called a subroute: for example, route (0, 1, 2, 0) in Figure 1(b) is a subroute of all the feasible routes.Besides, the numbers in brackets correspond to the quantities required by each customer.
Consider that we have the following solution:

Generation of Initial Population.
We utilize the sweep algorithm [22] to divide the customers into  different groups and ensure each group meets all of the constraint conditions.We then add "0" into each group's head and tail, which forms a chromosome encoding.For instance, if we divide nine customers into three groups (i.e., [1][2][3][4][5][6][7][8][9]), the chromosome is 0261089705340.

Fitness Function.
Considering the possibility of an infeasible solution, we introduce a penalty strategy to define fitness function : where  is the optimizing target of the proposed mathematical model as shown in (1);  1 is a penalty factor for being overweight;  2 is the penalty factor for being over the maximum travel distance; and the other symbols are the same as shown in (1).

Termination Condition.
The termination condition of the optimization algorithm is the biggest genetic algebraic system setting.First, we set a maximum algebra , and if the current algebra   is larger than the maximum algebra , the algorithm ends.Then the evolution is stopped, and the chromosome that performs best corresponding to the path setout as a question of optimal solution is selected.

Natural Selection.
The natural selection method used in this paper is a combination of elitist selection and fitness proportion selection [23].We first choose the most optimal of all  chromosomes to pass on directly; then we use roulette wheel selection to produce the next generation from the remaining  − 1 chromosomes.

Crossover and Recombination. Lang and Hu and Ding
and Li [24,25] proposed a new crossover operator whose main characteristic is crossing according to the order of the group.Based on this theory, an improved multiple population crossover method is developed in this paper.First, we randomly choose the parent chromosomes  and  to cross.From that, we can get a core gene sequence, which guarantees that genes can be passed to the next generation with fixed relative location that will help avoid over-distance.Finally, we can get the new chromosome   by using greedy heuristics [26] to insert the remaining genes into locations that are close to the nearest gene in order.As for the new chromosome   , we insert remaining genes similar to the generation of   but with a reverse order.
For example, two paternal chromosomes are  1 = {(0, 1, 3, 7, 8), (0, 2, 6, 4, 5)};  2 = {(0, 1, 2, 3, 6), (0, 4, 5, 7, 8)}.Clearly, the common part of the two chromosomes is  = {(0, 1, 3), (0, 4, 5)}, and the pending elements are 2, 6, 7, and 8. First, we insert these four pending elements with an order of 2 → 6 → 7 → 8 into  to obtain the new   .We suppose that 1 is the closet element for 2 in the first part of chromosome , and the distance is five units.In the second part of chromosome , 4 is the nearest element with a distance of eight units.Then we put 2 into the first part just following element 1.After that, we will check to ensure that this arrangement can conform to all constraint conditions, and other elements will be inserted with the same method.It is noted, however, that if the addition of any element cannot meet all constraint conditions, we should arrange it into the other part of the chromosome.As for   , it is inserted following the order of 8 → 7 → 6 → 2.
Although this method ensures that the relative location for the core part of the chromosome remains the same and that the population is diverse, it will destroy the former chromosomes.The O-X type cross pattern is able to reserve the mating zone entirely [27]; thus, we combine this method with the traditional O-X type cross pattern.In the process of crossover and recombination, we can divide chromosomes into two groups.One group adopts the method proposed in this paper and the other utilizes the O-X type cross pattern.After several generations, we exchange the method used in the two groups.

Mutation.
The mutation method used in this paper is a combination of inversion mutation and exchange mutation [28].The two methods are used generationally and alternated during the evolution.Inversion mutation is a process to reverse a chromosome.For example, 0630189025740 will vary to 0630981025740 by reversing "189."Crossover is the exchange of positions of two elements.For example, 0630189025740 becomes 0230189065740 by exchanging "6" and "2." 4.3.The Basic Procedure of Improved Genetic Algorithm.The flowchart of improved genetic algorithm is as shown in Figure 3.

Example
We conducted computational experiments to evaluate the proposed algorithm.The algorithm was coded in MATLAB and run on a PC (Intel Pentium 4, 2.8 GHz, 2 GB memory).There is a batch of bananas from southern China that will be distributed to 12 cities through the Nanjing distribution center in Jiangsu Province (Nanjing is the capital of Jiangsu Province), and their locations are distributed in the square [0, 100] 2 in the plane, as shown in Figure 4.The distances between customers are measured by Euclidean distance (in double precision) as shown in Table 2.The road class between different cities is shown in Table 3, and the traveling times are the same as the corresponding distances.Each customer  has one time window [  ,   ], the amount required   , and a service time   , as shown in Table 4.The number of vehicles is 5, and all vehicles have an identical capacity  ( = 15 tons).Both time window and capacity constraints are considered hard indicators.The maximum travel distance  of each vehicle is 500 km.Penalty factors of time are  and , in which  = 2000 and  = 3000.The penalty factor for being overweight is  1 = 5000.The over-distance penalty factor is  2 = 2000.In the simulation process, we used MATLAB to realize the proposed algorithm, in which the variable dimension is 40, the crossover rate is 0.9, the maximum generation is 200, and the mutation rate is 0.1.Meanwhile, a comparison between the total costs obtained from the proposed algorithm and the total costs from the traditional O-X type cross pattern, the Group-based pattern, and the CW pattern was carried out.The corresponding results are shown in Figures 5, 6, and 7.
Figures 5, 6, and 7 show that the proposed algorithm achieves convergence within 20 generations, but the other three methods need more generations to achieve convergence.In addition, compared to the other three methods, less computing time is required for achieving convergence in the proposed algorithm.Therefore, the proposed algorithm demonstrated higher efficiency in obtaining the optimum solution.
In order to further illustrate the performance of the proposed algorithm, the maximum generation was considered to be 200.As a result, we learned that once the proposed method achieves convergence, it will not change much with increasing generations.In contrast, the other three methods were relatively unstable after convergence.This phenomenon further shows that the performance of the proposed algorithm is superior to the conventional methods.
Finally, according to repeated experiments in MATLAB, we get the final optimal scheme, which is 0  shown in Table 5, which lists the root mean square error (RMSE) and absolute error ( abs ) of the total cost for distribution.Among them, the RMSE and  abs can be calculated by the following formulae:  where  is the total number of distribution for each month, which is not the same in different months due to seasons and demands,  pred is calculated by four algorithms, and  true is total cost obtained from the actual distribution for each month.
Table 5 shows that the performance of the improved genetic algorithm is better than the other three algorithms for the distribution of twelve months, and both the models Group-based pattern and CW pattern are superior to the O-X type cross pattern.It is observed that the more monthly distribution times, the more accurate predicted total cost.

Conclusions
The VRPSTW problem for FFV is a large combinatorial problem whose optimal solution is difficult to find.Therefore, a nonlinear mathematical model based on an improved genetic algorithm was developed to solve this problem.In this paper, we considered not only the vehicle routing problem with time windows, but also the effect of road irregularities on fruit and vegetable bruising to reduce logistics and distribution costs.In addition, the feasibility, high efficiency, and rationality of the proposed algorithm were verified by numerical simulations.The comparison between four models to predict the total cost and actual total cost in distribution showed that the improved genetic algorithm is superior to the Group-based pattern, CW pattern, and O-X type cross pattern.

GenerationFigure 5 :
Figure 5: Population mean change contrasts of O-X type cross pattern.

Figure 6 :
Figure 6: Population mean change contrasts of Group-based pattern.

Figure 7 :
Figure 7: Population mean change contrasts of CW pattern.

Table 1 :
Road class and evaluation coefficient.

Table 1 [
17,18],   is distance between customer  and customer , [  ,   ] is time windows of receiving of customer , and   is travel time between customer  and customer :

Table 2 :
Distance between different cities.

Table 4 :
Demand for cities and time window request.
and the total cost is 45,412.To further demonstrate the performance of the proposed algorithm, a comparison is made between actual total cost from randomly distribution during twelve months and total cost from the above four algorithms.The comparison is N Figure 4: Geographical distribution for distributed cities and distribution center in Jiangsu Province.

Table 5 :
Prediction errors of total cost between actual distribution values and predicted values derived from four models during five months.