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.
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 aswhere m is the weighting factor, N is the number of samples, c is the number of cluster centers, is the jth cluster center, which is the same as the sample’s characteristics of dimension, is the ith sample, and is the membership of the sample to the cluster center .
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 factor M 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 center .
Step 2. Update the Membership matrix .The membership matrix is the matrix of NC, 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 or when the FCM algorithm program started.
Step 3. Compare and ; ifthen stop the iteration; otherwise, , steering to Step 1.
Step 4. If the effective value function reaches the minimum, the clustering process is supposed to end; otherwise, and steering to Step 1. In other words, we take number that the effective value function as the minimum point value with the increase of C. The effective value function is defined by [25]The flow chart of the improved FCM algorithms is shown in Figure 1.

2.2. Construction of the Initial Solution
The initial solution to the traditional genetic algorithm is generated randomly. Therefore, the C– 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– algorithm are as follows:
Step 5. Assuming that each car serves only one customer, it generates N 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 aswhere is the saving value of distance and is the distance between customer i and customer j. and represent the distance from customer i and customer j to the distribution center, respectively.
The highest saving value that counterparts customer i and customer j is found out and then combine them into one route. The sketch map is shown in Figure 2.

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 Step 5 and Step 6, and mix the route until all customers are distributed when delivery.
The flow path of constructing initial solutions by algorithm is shown in Figure 2, in which n is the position where the largest distance saving value, Q is the total vehicle capacity, is whether customer point i be served by car k. 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 using 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 iswhere is the maximum value of crossover probability. is the fitness value of individual i. is the average fitness value of all individuals in the population. N is population capacity. 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 iswhere is the minimum mutation probability. 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: using algorithm, and recording the several groups of better initial solutions which are produced by 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 aswhere is the nodes of distribution center. is the customer collection. is the vehicle collection. Q is the total vehicle capacity. is the requirement of customer i. is the cost of the route from customer i to customer j. means car k whether from customer point i to customer point j. 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 Figure 3. At the same time, the flow chart of the improved algorithm is shown in Figure 4.


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:where BS is the optimal solution obtained by algorithm optimization. BSK is the known optimal solution.
4.2. Experimental Parameter and Analysis
Table 1 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.


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

5. Conclusion
In this paper, FCM and 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.
Data Availability
The data that support the findings of this study are available from the corresponding author upon reasonable request.
Conflicts of Interest
The authors declare no conflicts of interest.
Authors’ Contributions
All the authors agreed to publish the article.