# Solving Capacitated Vehicle Routing Problem by an Improved Genetic Algorithm with Fuzzy C-Means Clustering

Authors: Ji Zhu
Journal: Scientific Programming
 (2022)

---

## Abstract

Aiming at solving the vehicle routing problem, an improved genetic algorithm based on fuzzy C-means clustering (FCM) is proposed to solve the vehicle routing problem with capacity constraints. On the basis of genetic algorithm, the FCM algorithm is used to decompose the large-scale vehicle routing optimization problem into small-scale subproblems, which can effectively improve the efficiency of the algorithm. At the same time, a generation method of the initial solution to CVRP problem is designed. The improved algorithm has good robustness and can also reduce the possibility of falling into local optimization in the search process. Finally, a simulation example is provided to verify the efficiency and superiority of the proposed algorithm.


---

## Body

## 1. Introduction

Capacitated vehicle routing problem (CVRP) [1], which is well known and has high research value in the logistics field, was proposed first time by Dantzig in 1956. Due to the exact solution of the algorithm based on strict mathematical description that cannot satisfy the performance requirement, in the past few decades, scholars from home and abroad have carried out extensive and profound research for this problem, and some heuristic algorithms were proposed to solve CVRP problem [2–6]. In [7], the authors analyzed and compared the performance of multiple heuristic algorithms under the CVRP conditions, according to the genetic algorithm characteristics of simple and high scalability, which can search information based on the objective function, can provide better solutions.With the development of sensors and communication technologies, rich results have been achieved. In [8], the genetic algorithm was applied for the research of VRP for the first time in 1996. Since then, the genetic algorithm was used widely in CVRP. The optimizations of the traditional genetic algorithm can be separated into two types. The first one is improving the specific problems in the genetic algorithm in order to realize better performance. A double population genetic algorithm was designed for population schemes [9]. In [10], with an aim to improve the quality of population, a Jaccard coefficient that produces primary population was proposed. In [11], the two-step coding scheme was used for improvement was proposed by the coding scheme. In [12], the genetic algorithm solution by binary coding was designed for the coding proposal. In [13], a fixed-length real encoding was provided to solve the problem that the traditional genetic algorithm convergence rate is slow. In [14], an operator based on task redistribution was designed to improve the genetic algorithm. In [13], a new strategy was used to improve the selection strategy of the genetic algorithm. According to the individual adapting value, they mixed the individuations with the better adapting value and worse adapting value. In [15], a policy that detects mutation operation to improve the local optimization ability of the algorithm was studied. In addition, in [15], a method that uses a gene rearrangement operator for the chromosome recombination was provided. In [16], the impact of the location of the city on the path optimization was taken into consideration. Undoubtedly, these improvements can get better optimization.The second one is that introducing the other intelligent optimization algorithms to mix into the traditional genetic algorithms and get the hybrid genetic algorithms, which is able to provide new ideas of genetic algorithms to solve CVRP problems. In [17], a hybrid optimization algorithm based on the genetic algorithm and sparrow search algorithm was proposed. Based on the particle swarm optimization, genetic algorithm, and nonlinear programming theory, a hybrid optimization algorithm of particle swarm and genetic was proposed [18]. In [19], a solution algorithm based on genetic simulated annealing was designed, which owns the strong global search capability of the genetic algorithm, as well as the high rate of convergence of the simulated annealing optimization. In [20], the hybrid firefly genetic algorithm which combines the advantages from the firefly algorithm and other mathematical optimization algorithms was proposed, which effectively improved the effectiveness of the algorithm.Inspired by the above two methods, in this paper, an improved genetic algorithm based on fuzzy C-means algorithm (FCM) is used to solve CVRP problems. First, the algorithm reduces the solution scale by FCM for generating population problems randomly by the traditional genetic algorithm. Then, a quantity of optimal initial solutions forming the initial population by referring to the thought of CW algorithm is constructed, which improves the efficiency of the algorithm effectively. Finally, the experiment by using benchmark examples is introduced, and the experiment demonstrates that this algorithm can solve CVRP problems with better precision and effectiveness.


## 2. Methodologies

### 2.1. Fuzzy Clustering

Clustering analysis is one of the multivariate statistical analyses [21, 22]. According to certain rules, it can divide the uncategorized samples into subsets and group the similar samples together. K-means [23] and K-medoid [24] are two common clustering methods. Hard clustering divides every unidentified objective into certain collections strictly, and the objectives of it have the either-or characteristics. While the fuzzy clustering established the uncertain description of collection from samples, it can reflect the objective world objectively; therefore, it has become the mainstream of clustering analysis.In many fuzzy clustering algorithms, FCM is the most widely used algorithm. It can get the membership of all of the cluster centers by optimizing the objective function and get the aim of classifying the data automatically by determining the category of sample points. A membership function belonging from each cluster to each sample is assigned and sorted by the sample by comparing the value of membership.There are three key parameters of fuzzy C-means clustering: fixed number of clusters, the center of each mass cluster, and each data point’s cluster which closest to the corresponding center of mass.Fuzzy C-means clustering can get the cluster center by minimizing the objective functions. The objective function is essentially the sum of Euclidean distances of each point to each cluster. The process of clustering is the process of minimizing the objective function. By iterative arithmetic, the error value of the objective function can be decreased step by step. When the objective function is convergent, we can get the final result of the cluster. The objective function can be expressed as(1)Jm=∑i=1N∑j=1Cuijmxi−vi2,where m is the weighting factor, N is the number of samples, c is the number of cluster centers, vi is the jth cluster center, which is the same as the sample’s characteristics of dimension, xi is the ith sample, and uij is the membership of the sample xi to the cluster center cj.The traditional FCM algorithm needs to give the cluster number of the data set in advance. If the cluster number is not selected properly, it will lead to classification failure. The determination of cluster number belongs to the research category of cluster effectiveness. The proposed method is modified based on the traditional FCM algorithm, so that the cluster number C can be determined adaptively according to the data set.Pal and Bezdek have pointed out that the reasonable value range of weight factorM is [1.5, 2.5], so this paper takes its middle value. In all, in the beginning, we set the weighting factor as 2, the number of cluster centers is 2, and the number of iteration l is 0. The steps of improved FCM algorithm are as follows.Step 1.
Calculate cluster centerV=vil.(2)vil=∑k=1nuiklmxk∑k=1nuiklm.Step 2.
Update the Membership matrixUl.(3)uikl+1=1∑k=1cxk−vil/xk−vjl2/m−1.
The membership matrix is the matrix of N∗C, which means each sample point belongs to extent of each cluster. For the single sample, the sum of the membership degree of each cluster is 1. Closer to 1 means a higher membership degree, and vice versa. Each sample point in which class the membership degree is the highest belongs to which class.
According to (2) and (3), the membership degree matrix and cluster center are connected with each other, and they constitute the positive feedback under the objective function. Therefore, it is only needed to iterate the membership degree matrix and cluster center until the objective function converges to a better solution. It should be pointed out that it is needed to assign a value that meets the conditions to uik0 or vi0 when the FCM algorithm program started.Step 3.
CompareUl and Ul+1; if(4)Ul−Ul+1≤ε,then stop the iteration; otherwise, l=l+1, steering to Step 1.Step 4.
If the effective value functionPFmU,c reaches the minimum, the clustering process is supposed to end; otherwise, c=c+1 and steering to Step 1. In other words, we take number that the effective value function PFmU,c as the minimum point value with the increase of C. The effective value function PFmU,c is defined by [25](5)PFmU,c=1n∑i=1c∑j=1nuij−uij0.5.
The flow chart of the improved FCM algorithms is shown in Figure1.Figure 1
The flow chart of the improved FCM algorithms.


### 2.2. Construction of the Initial Solution

The initial solution to the traditional genetic algorithm is generated randomly. Therefore, the C–W algorithm mentioned by Clark and Wright in 1964 was considered, which aims to generate a better initial solution to expedite the speed of the program.The number of customers as N is set, every vehicle capacity is 200, and 0 means distribution center. The steps of C–W algorithm are as follows:Step 5.
Assuming that each car serves only one customer, it generatesN independent loops. Then, the saving value of distance by combining customer i and customer j into one route is calculated. The distance of reduction can be expressed as(6)Sij=doi+doj−dij,where Sij is the saving value of distance and dij is the distance between customer i and customer j. doi and pm=pmmin+∑i=1Nfi−favg2/N⋅pma represent the distance from customer i and customer j to the distribution center, respectively.
The highest saving value that counterparts customeri and customer j is found out and then combine them into one route. The sketch map is shown in Figure 2.Figure 2
The sketch map of the CW algorithm.Step 6.
When two customers are on the same route (customer 1 and customer 2) and then by mixing customer 3 to this route, there are 3 different ways to mix (0123, 0312, and 0132). Lastly, the saving value is calculated by these three situations.Step 7.
When the requirement value of all customers is beyond the total capacity of vehicles, we need a new route, then calculate the saving value again that follows Step5 and Step 6, and mix the route until all customers are distributed when delivery.
The flow path of constructing initial solutions byCW algorithm is shown in Figure 2, in which n is the position where the largest distance saving value, Q is the total vehicle capacity, pm=pmmin+∑i=1Nfi−favg2/N⋅pma is whether customer point i be served by car k. qi means the requirement of customer i.


### 2.3. Solutions of Genetic Algorithms

GA is one of the methods which used widely to search optimal solutions. It simulates the mechanism of life evolution. It is unnecessary to make model and complex calculation. Only need to use the three operators of GA, we can get the optimal solutions.The GA algorithm sets the objective function as research information directly. It is simple to use and has high expansibility, but the algorithm’s efficiency usually lower than the other traditional optimal methods. In addition, in the traditional GA algorithm, the production of the initial cluster is randomly generated, so that one of the better initial solutions can increase the probability of catching the optimal solution from the program and speed the program searching the optimal solution up. In order to overcome the disadvantage of the GA algorithm, this article makes improvements on the production of the initial solution method in the traditional GA algorithm.First, based on some rules, this paper uses the FCM algorithm to divide all of the customer points into several subclusters.Second, this paper constructs some better initial solution by usingCW algorithm and codes the initial population which is made up of chromosomes, respectively. It can increase the probability of catching the adjacent territory solution that has high quality, which increases the efficiency of the traditional GA algorithm to solve the CVRP problem considerably.Third, traditional genetic algorithms are prone to fall into local optimum. On the other hand, in the late stage of evolution, the fitness values of individuals in the population are relatively stable, and the diversity between them is greatly reduced, resulting in slow convergence of the algorithm. To solve this problem, this paper modifies the crossover and mutation operations in the traditional genetic algorithm, so that the crossover and mutation probability can be set dynamically. In the early stage of evolution, the fitness of individuals in the population is poor, and there is little difference between individuals. By increasing the crossover probability, the improved genetic algorithm can make the excellent individuals show up as soon as possible and reduce the search range of the optimal solution. In the late stage of evolution, the fitness of individuals in the population is generally good, but there is little difference between them. By increasing the mutation probability, the local search ability of the population is enhanced, which makes it quickly find the best solution and speed up the convergence of the algorithm.


#### 2.3.1. Improvement of Crossover Probability

First, the minimum crossover probability is set, and then, with the increase of iterations, the standard deviation of the fitness value is used to control the change of crossover probability, so that the crossover probability is larger at the beginning of evolution and smaller at the end of evolution. That is, the crossover probability is(7)pc=pcmax−∑i=1Nfi−favg2N⋅pca,where pcmax is the maximum value of crossover probability. fi is the fitness value of individual i. favg is the average fitness value of all individuals in the population. N is population capacity. pca is the cross probability adjustment parameter.


#### 2.3.2. Improvement of Mutation Probability

First, the minimum mutation probability is set, and then with the increase of iterations, the standard deviation of the fitness value is used to control the mutation probability, making the mutation probability smaller at the beginning of evolution and larger at the end of evolution. The mutation probability is(8)pm=pmmin+∑i=1Nfi−favg2N⋅pma,where pmmin is the minimum mutation probability. pma is the adjusting parameter for mutation probability.There are 4 main steps for the improved algorithm as follows:Step 1: using FCM algorithm to divide the received data into several subcluster.Step 2: usingCW algorithm, and recording the several groups of better initial solutions which are produced by CW algorithm. Coding them as several chromosomes, and set them as a part of the initial population.Step 3: under the limited of the number of iterations, using genetic algorithm to iterate constantly. Produce the optimal solutions by choosing, overlap, and aberrance.Step 4: obtaining the optimal individual after iteration, outputting the optimal route.


## 2.1. Fuzzy Clustering

Clustering analysis is one of the multivariate statistical analyses [21, 22]. According to certain rules, it can divide the uncategorized samples into subsets and group the similar samples together. K-means [23] and K-medoid [24] are two common clustering methods. Hard clustering divides every unidentified objective into certain collections strictly, and the objectives of it have the either-or characteristics. While the fuzzy clustering established the uncertain description of collection from samples, it can reflect the objective world objectively; therefore, it has become the mainstream of clustering analysis.In many fuzzy clustering algorithms, FCM is the most widely used algorithm. It can get the membership of all of the cluster centers by optimizing the objective function and get the aim of classifying the data automatically by determining the category of sample points. A membership function belonging from each cluster to each sample is assigned and sorted by the sample by comparing the value of membership.There are three key parameters of fuzzy C-means clustering: fixed number of clusters, the center of each mass cluster, and each data point’s cluster which closest to the corresponding center of mass.Fuzzy C-means clustering can get the cluster center by minimizing the objective functions. The objective function is essentially the sum of Euclidean distances of each point to each cluster. The process of clustering is the process of minimizing the objective function. By iterative arithmetic, the error value of the objective function can be decreased step by step. When the objective function is convergent, we can get the final result of the cluster. The objective function can be expressed as(1)Jm=∑i=1N∑j=1Cuijmxi−vi2,where m is the weighting factor, N is the number of samples, c is the number of cluster centers, vi is the jth cluster center, which is the same as the sample’s characteristics of dimension, xi is the ith sample, and uij is the membership of the sample xi to the cluster center cj.The traditional FCM algorithm needs to give the cluster number of the data set in advance. If the cluster number is not selected properly, it will lead to classification failure. The determination of cluster number belongs to the research category of cluster effectiveness. The proposed method is modified based on the traditional FCM algorithm, so that the cluster number C can be determined adaptively according to the data set.Pal and Bezdek have pointed out that the reasonable value range of weight factorM is [1.5, 2.5], so this paper takes its middle value. In all, in the beginning, we set the weighting factor as 2, the number of cluster centers is 2, and the number of iteration l is 0. The steps of improved FCM algorithm are as follows.Step 1.
Calculate cluster centerV=vil.(2)vil=∑k=1nuiklmxk∑k=1nuiklm.Step 2.
Update the Membership matrixUl.(3)uikl+1=1∑k=1cxk−vil/xk−vjl2/m−1.
The membership matrix is the matrix of N∗C, which means each sample point belongs to extent of each cluster. For the single sample, the sum of the membership degree of each cluster is 1. Closer to 1 means a higher membership degree, and vice versa. Each sample point in which class the membership degree is the highest belongs to which class.
According to (2) and (3), the membership degree matrix and cluster center are connected with each other, and they constitute the positive feedback under the objective function. Therefore, it is only needed to iterate the membership degree matrix and cluster center until the objective function converges to a better solution. It should be pointed out that it is needed to assign a value that meets the conditions to uik0 or vi0 when the FCM algorithm program started.Step 3.
CompareUl and Ul+1; if(4)Ul−Ul+1≤ε,then stop the iteration; otherwise, l=l+1, steering to Step 1.Step 4.
If the effective value functionPFmU,c reaches the minimum, the clustering process is supposed to end; otherwise, c=c+1 and steering to Step 1. In other words, we take number that the effective value function PFmU,c as the minimum point value with the increase of C. The effective value function PFmU,c is defined by [25](5)PFmU,c=1n∑i=1c∑j=1nuij−uij0.5.
The flow chart of the improved FCM algorithms is shown in Figure1.Figure 1
The flow chart of the improved FCM algorithms.


## 2.2. Construction of the Initial Solution

The initial solution to the traditional genetic algorithm is generated randomly. Therefore, the C–W algorithm mentioned by Clark and Wright in 1964 was considered, which aims to generate a better initial solution to expedite the speed of the program.The number of customers as N is set, every vehicle capacity is 200, and 0 means distribution center. The steps of C–W algorithm are as follows:Step 5.
Assuming that each car serves only one customer, it generatesN independent loops. Then, the saving value of distance by combining customer i and customer j into one route is calculated. The distance of reduction can be expressed as(6)Sij=doi+doj−dij,where Sij is the saving value of distance and dij is the distance between customer i and customer j. doi and pm=pmmin+∑i=1Nfi−favg2/N⋅pma represent the distance from customer i and customer j to the distribution center, respectively.
The highest saving value that counterparts customeri and customer j is found out and then combine them into one route. The sketch map is shown in Figure 2.Figure 2
The sketch map of the CW algorithm.Step 6.
When two customers are on the same route (customer 1 and customer 2) and then by mixing customer 3 to this route, there are 3 different ways to mix (0123, 0312, and 0132). Lastly, the saving value is calculated by these three situations.Step 7.
When the requirement value of all customers is beyond the total capacity of vehicles, we need a new route, then calculate the saving value again that follows Step5 and Step 6, and mix the route until all customers are distributed when delivery.
The flow path of constructing initial solutions byCW algorithm is shown in Figure 2, in which n is the position where the largest distance saving value, Q is the total vehicle capacity, pm=pmmin+∑i=1Nfi−favg2/N⋅pma is whether customer point i be served by car k. qi means the requirement of customer i.


## 2.3. Solutions of Genetic Algorithms

GA is one of the methods which used widely to search optimal solutions. It simulates the mechanism of life evolution. It is unnecessary to make model and complex calculation. Only need to use the three operators of GA, we can get the optimal solutions.The GA algorithm sets the objective function as research information directly. It is simple to use and has high expansibility, but the algorithm’s efficiency usually lower than the other traditional optimal methods. In addition, in the traditional GA algorithm, the production of the initial cluster is randomly generated, so that one of the better initial solutions can increase the probability of catching the optimal solution from the program and speed the program searching the optimal solution up. In order to overcome the disadvantage of the GA algorithm, this article makes improvements on the production of the initial solution method in the traditional GA algorithm.First, based on some rules, this paper uses the FCM algorithm to divide all of the customer points into several subclusters.Second, this paper constructs some better initial solution by usingCW algorithm and codes the initial population which is made up of chromosomes, respectively. It can increase the probability of catching the adjacent territory solution that has high quality, which increases the efficiency of the traditional GA algorithm to solve the CVRP problem considerably.Third, traditional genetic algorithms are prone to fall into local optimum. On the other hand, in the late stage of evolution, the fitness values of individuals in the population are relatively stable, and the diversity between them is greatly reduced, resulting in slow convergence of the algorithm. To solve this problem, this paper modifies the crossover and mutation operations in the traditional genetic algorithm, so that the crossover and mutation probability can be set dynamically. In the early stage of evolution, the fitness of individuals in the population is poor, and there is little difference between individuals. By increasing the crossover probability, the improved genetic algorithm can make the excellent individuals show up as soon as possible and reduce the search range of the optimal solution. In the late stage of evolution, the fitness of individuals in the population is generally good, but there is little difference between them. By increasing the mutation probability, the local search ability of the population is enhanced, which makes it quickly find the best solution and speed up the convergence of the algorithm.


### 2.3.1. Improvement of Crossover Probability

First, the minimum crossover probability is set, and then, with the increase of iterations, the standard deviation of the fitness value is used to control the change of crossover probability, so that the crossover probability is larger at the beginning of evolution and smaller at the end of evolution. That is, the crossover probability is(7)pc=pcmax−∑i=1Nfi−favg2N⋅pca,where pcmax is the maximum value of crossover probability. fi is the fitness value of individual i. favg is the average fitness value of all individuals in the population. N is population capacity. pca is the cross probability adjustment parameter.


### 2.3.2. Improvement of Mutation Probability

First, the minimum mutation probability is set, and then with the increase of iterations, the standard deviation of the fitness value is used to control the mutation probability, making the mutation probability smaller at the beginning of evolution and larger at the end of evolution. The mutation probability is(8)pm=pmmin+∑i=1Nfi−favg2N⋅pma,where pmmin is the minimum mutation probability. pma is the adjusting parameter for mutation probability.There are 4 main steps for the improved algorithm as follows:Step 1: using FCM algorithm to divide the received data into several subcluster.Step 2: usingCW algorithm, and recording the several groups of better initial solutions which are produced by CW algorithm. Coding them as several chromosomes, and set them as a part of the initial population.Step 3: under the limited of the number of iterations, using genetic algorithm to iterate constantly. Produce the optimal solutions by choosing, overlap, and aberrance.Step 4: obtaining the optimal individual after iteration, outputting the optimal route.


## 2.3.1. Improvement of Crossover Probability

First, the minimum crossover probability is set, and then, with the increase of iterations, the standard deviation of the fitness value is used to control the change of crossover probability, so that the crossover probability is larger at the beginning of evolution and smaller at the end of evolution. That is, the crossover probability is(7)pc=pcmax−∑i=1Nfi−favg2N⋅pca,where pcmax is the maximum value of crossover probability. fi is the fitness value of individual i. favg is the average fitness value of all individuals in the population. N is population capacity. pca is the cross probability adjustment parameter.


## 2.3.2. Improvement of Mutation Probability

First, the minimum mutation probability is set, and then with the increase of iterations, the standard deviation of the fitness value is used to control the mutation probability, making the mutation probability smaller at the beginning of evolution and larger at the end of evolution. The mutation probability is(8)pm=pmmin+∑i=1Nfi−favg2N⋅pma,where pmmin is the minimum mutation probability. pma is the adjusting parameter for mutation probability.There are 4 main steps for the improved algorithm as follows:Step 1: using FCM algorithm to divide the received data into several subcluster.Step 2: usingCW algorithm, and recording the several groups of better initial solutions which are produced by CW algorithm. Coding them as several chromosomes, and set them as a part of the initial population.Step 3: under the limited of the number of iterations, using genetic algorithm to iterate constantly. Produce the optimal solutions by choosing, overlap, and aberrance.Step 4: obtaining the optimal individual after iteration, outputting the optimal route.


## 3. Problem Description and Modeling

### 3.1. Problem Description

Vehicle routing problem is described as organizing the appropriate route for a series of loading and unloading points to make vehicles through them orderly. In the conditions of the quantity demanded (such as transmission quantity, time of delivery, vehicle capacity limitation, driving range, and time limitation), the aims are achieved (such as shortest distance, least cost, least time, and least vehicles).There are many basic types of VRP problems. CVRP is the most basic type from them. CVRP has several constraints: 1. the vehicles have the same capacities of freight, 2. each customer only can be served by one car, and customer requirements cannot be separated, 3. vehicles depart from a single distribution center and need to get back, 4. all customers have to be served.


### 3.2. Problem Modeling

Based on the description of CVRP, the related parameters and variables of the CVRP model are defined. The CVRP model can be described as(9)minf=∑i∈N∑j∈N∑k∈Kdijxijk,(10)∑i∈Nxijk=yjk,(11)∑i∈Nxijk=yjk,(12)∑i∈Nxijk=yjk,(13)∑j∈Nxijk=yik,(14)∑j∈Nx0jk=1,(15)∑j∈Nxi0k=1,where N0 is the nodes of distribution center. c=1,…,n is the customer collection. K=1,…,k is the vehicle collection. Q is the total vehicle capacity. qi is the requirement of customer i. dij is the cost of the route from customer i to customer j. xijk means car k whether from customer point i to customer point j. yik means whether customer point i be served by car k.In the above formula, (6) means to minimize the length of vehicle distribution path, (7) means the need of meeting the limitation of vehicle load when delivery, (8) means each customer only can be served by one car. When equations (12) and (13) are established at the same time, it can ensure that customers who are on the same line are served by the same distribution vehicle. Equations (14) and (15), respectively, mean that each distribution vehicle must start from distribution center 0 and each distribution vehicle must finally return to distribution center 0.The aim of clustering analysis to solve CVRP is to separate this problem into several subproblems and use the optimization algorithm to solve these subproblems. Then, based on the optimal solutions of these subproblems, we can get the optimal solution of the main problem.Based on the above algorithm and model, an improved genetic algorithm was proposed to solve the CVRP problem. The flow chart of the CM algorithm is shown in Figure3. At the same time, the flow chart of the improved algorithm is shown in Figure 4.Figure 3
The flow chart of the CW algorithm.Figure 4
The flow chart of the proposed algorithm.


## 3.1. Problem Description

Vehicle routing problem is described as organizing the appropriate route for a series of loading and unloading points to make vehicles through them orderly. In the conditions of the quantity demanded (such as transmission quantity, time of delivery, vehicle capacity limitation, driving range, and time limitation), the aims are achieved (such as shortest distance, least cost, least time, and least vehicles).There are many basic types of VRP problems. CVRP is the most basic type from them. CVRP has several constraints: 1. the vehicles have the same capacities of freight, 2. each customer only can be served by one car, and customer requirements cannot be separated, 3. vehicles depart from a single distribution center and need to get back, 4. all customers have to be served.


## 3.2. Problem Modeling

Based on the description of CVRP, the related parameters and variables of the CVRP model are defined. The CVRP model can be described as(9)minf=∑i∈N∑j∈N∑k∈Kdijxijk,(10)∑i∈Nxijk=yjk,(11)∑i∈Nxijk=yjk,(12)∑i∈Nxijk=yjk,(13)∑j∈Nxijk=yik,(14)∑j∈Nx0jk=1,(15)∑j∈Nxi0k=1,where N0 is the nodes of distribution center. c=1,…,n is the customer collection. K=1,…,k is the vehicle collection. Q is the total vehicle capacity. qi is the requirement of customer i. dij is the cost of the route from customer i to customer j. xijk means car k whether from customer point i to customer point j. yik means whether customer point i be served by car k.In the above formula, (6) means to minimize the length of vehicle distribution path, (7) means the need of meeting the limitation of vehicle load when delivery, (8) means each customer only can be served by one car. When equations (12) and (13) are established at the same time, it can ensure that customers who are on the same line are served by the same distribution vehicle. Equations (14) and (15), respectively, mean that each distribution vehicle must start from distribution center 0 and each distribution vehicle must finally return to distribution center 0.The aim of clustering analysis to solve CVRP is to separate this problem into several subproblems and use the optimization algorithm to solve these subproblems. Then, based on the optimal solutions of these subproblems, we can get the optimal solution of the main problem.Based on the above algorithm and model, an improved genetic algorithm was proposed to solve the CVRP problem. The flow chart of the CM algorithm is shown in Figure3. At the same time, the flow chart of the improved algorithm is shown in Figure 4.Figure 3
The flow chart of the CW algorithm.Figure 4
The flow chart of the proposed algorithm.


## 4. Case Studies

### 4.1. Introduction of Case

In order to verify the performance of the improved genetic algorithm, this paper uses data from 25 CVRP standard examples to take tests. The simulations are based on MATLAB R2020b environment with Win10 OS. CPU is AMD R7 5800H. Graphics card is Nvidia 3060 laptop. The gap in the experiment can be expressed as follows:(16)gap=BS−BSKBSK%,where BS is the optimal solution obtained by algorithm optimization. BSK is the known optimal solution.


### 4.2. Experimental Parameter and Analysis

Table1 shows the arithmetic partial parameter settings. Each benchmark example runs independently for 20 times to obtain the experimental results, as shown in Table 2. Cost is the value of the objective function (i.e., the total distance of the journey), AVS is the average optimal solution of the algorithm, and AVT is the average time-consuming of the algorithm. It can be seen from Table 2 that the algorithm proposed in this paper has good solution accuracy and fast solution speed for CVRP. In terms of solution accuracy, the algorithm proposed in this paper can obtain the optimal solution for 25 benchmark examples. In addition to the optimal solution, the error of the optimal solution of the algorithm optimization is not more than 1.0%, the average error of the optimal solution is not more than 5.85%, and the average error of the optimal solution is 0.11%. Among the 25 groups of standard examples, 18 groups have found the optimal solution, the number of vehicles has reached the optimal, and 9 groups of 18 groups of test examples can stably solve and obtain the optimal solution. In terms of solution speed, all examples are optimized in milliseconds, and none of them is more than 400 ms. Figures 5 and 6 are the FCM clustering results of some benchmark examples, and the optimal solution is obtained by the improved genetic algorithm. The optimal distribution path calculated by the improved genetic algorithm is 661, and three vehicles are needed to complete the distribution task.Table 1
Arithmetic partial parameter settings.
Parameter nameParameter settingPopulation sizeNIND = 50Number of iterationsMAXGEN = 200Intersect probabilityPcmax = 0.9Aberrance probabilityPmmin = 0.05Generation gapGGAP = 0.9Initial cluster center2Table 2
Simulation results of the proposed algorithm.
InstanceBSKBSAVSAVT/sCostCostGap (%)CostGap (%)A-n33-k56616610.0666.250.790.24A-n33-k67427430.13749.10.960.15A-n36-k57997990.0800.050.130.14A-n37-k69499550.63986.753.980.3A-n38-k57307300.0747.052.340.16A-n39-k58228220.0848.03.160.26A-n39-k68318550.48864.54.030.19A-n44-k79379370.0984.25.040.33B-n31-k56726720.0683.11.650.15B-n34-k57887880.0798.351.310.19B-n35-k59559550.0974.32.020.17B-n38-k68058050.0822.12.120.24B-n41-k68298320.36853.52.960.24B-n43-k67427420.0785.552.230.26B-n45-k57517550.53768.852.380.36B-n52-k77477440.0766.22.570.42P-n16-k84504500.0450.00.00.1P-n19-k22122120.0212.00.00.02P-n20-k22162160.0216.00.00.03P-n21-k22112110.0211.00.00.04P-n22-k22162160.0216.00.00.04P-n22-k85905900.0590.00.00.05P-n23-k85295290.4531.10.40.16P-n45-k55105155.85539.855.850.29P-n55-k85885905.48620.255.480.55Figure 5
FCM clustering results.Figure 6
Diagram of optimal solution obtained by improved genetic algorithm.


### 4.3. Modeling Simulation Comparison and Analysis

Comparison results among the improved genetic algorithm, artificial fish school algorithm (AFSA), and traditional genetic algorithm are performed in this paper. Twenty-five CVRP benchmark examples are selected for testing. Table3 is the average optimal value by tested 20 times, the known error rate of the optimal solutions, and the average time. The convergence of the three algorithms is shown in Figure 7.Table 3
Comparison of results of each algorithm for solving the CVRP problem.
AlgorithmAverage optimal valueError rate (%)Average time (s)Improved genetic algorithm based on FCM676.2391.46202.12AFSA688.4595.12280.77Traditional genetic algorithm690.2497.56291.47Figure 7
Iterative procedure.


## 4.1. Introduction of Case

In order to verify the performance of the improved genetic algorithm, this paper uses data from 25 CVRP standard examples to take tests. The simulations are based on MATLAB R2020b environment with Win10 OS. CPU is AMD R7 5800H. Graphics card is Nvidia 3060 laptop. The gap in the experiment can be expressed as follows:(16)gap=BS−BSKBSK%,where BS is the optimal solution obtained by algorithm optimization. BSK is the known optimal solution.


## 4.2. Experimental Parameter and Analysis

Table1 shows the arithmetic partial parameter settings. Each benchmark example runs independently for 20 times to obtain the experimental results, as shown in Table 2. Cost is the value of the objective function (i.e., the total distance of the journey), AVS is the average optimal solution of the algorithm, and AVT is the average time-consuming of the algorithm. It can be seen from Table 2 that the algorithm proposed in this paper has good solution accuracy and fast solution speed for CVRP. In terms of solution accuracy, the algorithm proposed in this paper can obtain the optimal solution for 25 benchmark examples. In addition to the optimal solution, the error of the optimal solution of the algorithm optimization is not more than 1.0%, the average error of the optimal solution is not more than 5.85%, and the average error of the optimal solution is 0.11%. Among the 25 groups of standard examples, 18 groups have found the optimal solution, the number of vehicles has reached the optimal, and 9 groups of 18 groups of test examples can stably solve and obtain the optimal solution. In terms of solution speed, all examples are optimized in milliseconds, and none of them is more than 400 ms. Figures 5 and 6 are the FCM clustering results of some benchmark examples, and the optimal solution is obtained by the improved genetic algorithm. The optimal distribution path calculated by the improved genetic algorithm is 661, and three vehicles are needed to complete the distribution task.Table 1
Arithmetic partial parameter settings.
Parameter nameParameter settingPopulation sizeNIND = 50Number of iterationsMAXGEN = 200Intersect probabilityPcmax = 0.9Aberrance probabilityPmmin = 0.05Generation gapGGAP = 0.9Initial cluster center2Table 2
Simulation results of the proposed algorithm.
InstanceBSKBSAVSAVT/sCostCostGap (%)CostGap (%)A-n33-k56616610.0666.250.790.24A-n33-k67427430.13749.10.960.15A-n36-k57997990.0800.050.130.14A-n37-k69499550.63986.753.980.3A-n38-k57307300.0747.052.340.16A-n39-k58228220.0848.03.160.26A-n39-k68318550.48864.54.030.19A-n44-k79379370.0984.25.040.33B-n31-k56726720.0683.11.650.15B-n34-k57887880.0798.351.310.19B-n35-k59559550.0974.32.020.17B-n38-k68058050.0822.12.120.24B-n41-k68298320.36853.52.960.24B-n43-k67427420.0785.552.230.26B-n45-k57517550.53768.852.380.36B-n52-k77477440.0766.22.570.42P-n16-k84504500.0450.00.00.1P-n19-k22122120.0212.00.00.02P-n20-k22162160.0216.00.00.03P-n21-k22112110.0211.00.00.04P-n22-k22162160.0216.00.00.04P-n22-k85905900.0590.00.00.05P-n23-k85295290.4531.10.40.16P-n45-k55105155.85539.855.850.29P-n55-k85885905.48620.255.480.55Figure 5
FCM clustering results.Figure 6
Diagram of optimal solution obtained by improved genetic algorithm.


## 4.3. Modeling Simulation Comparison and Analysis

Comparison results among the improved genetic algorithm, artificial fish school algorithm (AFSA), and traditional genetic algorithm are performed in this paper. Twenty-five CVRP benchmark examples are selected for testing. Table3 is the average optimal value by tested 20 times, the known error rate of the optimal solutions, and the average time. The convergence of the three algorithms is shown in Figure 7.Table 3
Comparison of results of each algorithm for solving the CVRP problem.
AlgorithmAverage optimal valueError rate (%)Average time (s)Improved genetic algorithm based on FCM676.2391.46202.12AFSA688.4595.12280.77Traditional genetic algorithm690.2497.56291.47Figure 7
Iterative procedure.


## 5. Conclusion

In this paper, FCM andCW algorithm are used to reduce the range of data group and construct a better initial population, separately. The proposed approach can increase the searching quality and efficiency effectively. Based on that, an improved genetic algorithm is proposed to solve the CVRP problem. Compared with the experimental results by using several algorithms, it can achieve a better result by using an improved algorithm to solve the CVRP problem. It is necessary to make further work in the future. In addition, it can also try to apply this algorithm to solve more complex combinatorial optimization problems, such as practical logistics transportation scheduling problems.



---

*Source: 8514660-2022-02-18.xml*