Sine Cosine Algorithm with Multigroup and Multistrategy for Solving CVRP

Sine Cosine Algorithm (SCA) has been proved to be superior to some existing traditional optimization algorithms owing to its unique optimization principle. However, there are still disadvantages such as low solution accuracy and poor global search ability. Aiming at the shortcomings of the sine cosine algorithm, a multigroupmultistrategy SCA algorithm (MMSCA) is proposed in this paper. ,e algorithm executes multiple populations in parallel, and each population executes a different optimization strategy. Information is exchanged among populations through intergenerational communication. Using 19 different types of test functions, the optimization performance of the algorithm is tested. Numerical experimental results show that the performance of the MMSCA algorithm is better than that of the original SCA algorithm, and it also has some advantages over other intelligent algorithms. At last, it is applied to solving the capacitated vehicle routing problem (CVRP) in transportation. ,e algorithm can get better results, and the practicability and feasibility of the algorithm are also proved.


Introduction
With the rapid development of human society and the continuous improvement of computer technology, people are facing more and more optimization problems in scientific research and engineering practice. e optimization problems can be understood as choosing a most suitable solution among many options for solving a complex problem without changing the constraints. However, with the increasing scale of the problem, the computing time also shows an exponential growth trend. When solving large-scale optimization problems, traditional algorithms seem powerless. For quite some time, people have been working hard to find new ways to better solve optimization problems. With the robustness, parallelism, and intelligence of its methods, computational intelligence (CI) can well solve many optimization problems, which has attracted the attention of many scholars. Also, computational intelligence (CI) plays an important role in scientific research and production practice.
Computational intelligence is a general term for a class of algorithms that are inspired by natural and human wisdom. Computational intelligence includes three basic areas: fuzzy computing [1][2][3], neural networks [4,5], and evolutionary computing [6]. Evolutionary computing is one of the important research fields of intelligent computing. Up to now, scholars have put forward many excellent intelligent optimization algorithms. Typical examples are as follows: genetic algorithm (GA) by simulating the genetic evolution of the biological world [7]; particle swarm optimization (PSO) by simulating bird swarm predation [8][9][10]; and ant colony algorithm (ACO) by simulating ant colony foraging behavior [11,12].
At present, there are so many optimization algorithms, which can solve some complex optimization problems well. Why do we need so many optimization algorithms? As demonstrated by the No Free Lunch (NFL) [38] proposed by Wolpert and Macready, no single optimization algorithm is applicable to all problems. Inspired by this, a new intelligent optimization algorithm was proposed by Australian scholar Mirjalili in 2016, which is called Sine Cosine Algorithm (SCA) [39]. e SCA algorithm iterates through the properties of the sine and cosine functions to achieve optimization. It has fewer parameter settings, is easy to implement, and has a strong optimization ability. It has been proved that it is better than PSO algorithm, genetic algorithm (GA), and firefly algorithm (FA) in convergence with accuracy and speed [39].
With the rapid development of software and hardware, parallel computing has become a form of high-performance computing. In evolutionary computing, parallelism often represents the iterative updating of multiple populations at the same time. e advantage of this method is to ensure population diversity, to further improve the search ability and performance of the algorithm. Especially when solving complex optimization problems, parallelizing the algorithm is an effective way to improve the efficiency and accuracy of the algorithm. At present, many existing algorithms have successfully applied the parallel mechanism, such as parallel PSO [40], parallel ACO [41], and parallel QUATRE [42]. Inspired by this, this paper introduces the multigroup and multistrategy optimization mechanism to further improve the SCA algorithm. It is called MMSCA. When the algorithm is solved, multiple populations execute in parallel, and each population adopts different updating strategies. By comparing the results of test functions, MMSCA is better than SCA in solving accuracy and convergence ability and has certain advantages over other intelligent optimization algorithms.
At present, transportation is gradually moving towards intelligent transportation. One of the important components of an intelligent transportation system is wireless sensor network technology (WSN). With the help of wireless sensor network technology [43][44][45][46][47][48], the safety, unblocking, and environmental protection problems that plague modern transportation can be fundamentally alleviated. However, there are still many transportation problems to be solved. e capacitated vehicle routing problem (CVRP) in transportation problems is taken as the application object of MMSCA in this paper. On the one hand, the practicability of the algorithm is further confirmed. On the other hand, it brings a new solution to CVRP problem. e remaining chapters of the article are arranged as follows: the original SCA algorithm and related improvements around it are reviewed in Section 2. Section 3 describes the MMSCA design process in detail. e results of numerical experiments are presented and discussed in Section 4. How to apply MMSCA to CVRP is covered in Section 5. At last, Section 6 is a summary of the article and an outlook for future work.

Original Sine Cosine Algorithm.
In the SCA algorithm, a population X is initialized first, where the population X contains m individuals, and each individual has n dimensions. e fitness function is used to evaluate each individual, and the best individual position P b � (P b1 , P b2 , . . . , P bn ) T among all the current individuals is selected. en, the algorithm iterates according to the set number of iterations. During the iteration, the position of the individual is updated. e update formula is as follows: where X t i represents the position of the ith (i � 1, 2, . . ., m) individual in the tth iteration; r 2 ∈ [0, 2π], r 3 ∈ [0, 2], and r 4 ∈ [0, 1] are three random numbers. P t b represents the best individual position after t iterations. r 1 is the control parameter, which balances the exploration and exploitation stages of the algorithm. e updated formula is as follows: where a is a constant, t is the number of current iterations, and T is the maximum number of iterations. Since equation (1) uses sine and cosine functions, the algorithm is named Sine Cosine Algorithm (SCA). Four important parameters play different roles in the process of iterative optimization of the algorithm: the parameter r 1 is used as a control parameter to determine the moving direction of the individual position in the next iteration; the parameter r 2 determines how far to move in the next iteration; as a random weight, parameter r 3 affects the role of the optimal individual in the next iteration; the parameter r 4 enables the algorithm to iteratively update the individual positions in the sine and cosine parts with equal probability. Like other intelligent optimization algorithms, there need to be two phases: local exploitation and global exploration. In SCA algorithm, when r 1 sin(r 2 ) or r 1 cos(r 2 ) function value is between −1 and 1, the algorithm performs local exploitation; when r 1 sin(r 2 ) or r 1 cos(r 2 ) function value is less than −1 or greater than 1, the algorithm performs global exploration.

Related
Improvements to the SCA Algorithm. With its unique optimization principles and theoretical advantages, the SCA algorithm has been proved to be superior to PSO, genetic algorithm (GA), and other existing algorithms in the most of the examples and has been applied in many practical problems. However, there are still some disadvantages such as low solution accuracy and poor global search ability. is is because when the SCA algorithm updates the individual location, the next generation location of the individual is only expanded around the current optimal individual location. In particular, with the decrease of the diversity of the population in the later period of the algorithm, the global search ability becomes worse, which easily leads to the algorithm falling into the local optimal trap.
In view of the shortcomings of the SCA algorithm, scholars at home and abroad have made some improvements. Some scholars introduced search strategies of other algorithms or improved the setting of the parameters of the SCA algorithm itself: Long et al. [49] introduced nonlinear weight factor and inertial weight based on Gaussian distribution, respectively, to improve the ability to avoid falling into the trap of local optimization and convergence speed; Qu et al. [50] proposed an improved SCA algorithm based on neighborhood search and Greedy Levy Mutation to better balance the phases of local exploitation and global exploration of the algorithm. Some scholars have also integrated the SCA algorithm with other algorithms to further improve the optimization ability of the algorithm: Chegini et al. [51] proposed to mix the SCA algorithm with the PSO algorithm to improve the global search capability of the algorithm and the calculation accuracy; Nenavath and Jatoth [52] mixed the SCA algorithm and the DE algorithm to further improve the convergence speed of the algorithm and the ability to avoid local optimization.
ere are many improvements to the SCA algorithm, and the improvement methods can be summarized into the abovementioned two categories. Aiming at the shortcomings of the SCA algorithm, this paper adopts a multigroup and multistrategy optimization mechanism to further improve the accuracy of the solution and the global search ability of the algorithm. e next section will detail how to improve the SCA algorithm.

Sine Cosine Algorithm with Multigroup and Multistrategy (MMSCA)
is section describes in detail how to apply the multigroup and multistrategy mechanism to improve the Sine Cosine Algorithm (SCA).

Algorithm Idea.
e use of a single population in basic SCA algorithm inevitably leads to the problem of falling into the local optimal trap. At the same time, when the algorithm updates individual location in each iteration, the location of candidate individuals is only expanded around the global optimal location, which results in the strong local search capability of the basic SCA algorithm and the weak global search capability. Based on the shortcomings of the abovementioned basic SCA algorithm, the concept of multigroup and multistrategy is introduced to enhance the optimization ability of SCA algorithm. In the multigroup multistrategy SCA algorithm (MMSCA), each population has the same number of individuals and uses a different update strategy. Before a certain number of generations, each population is optimized according to its own strategy, and the population does not interfere with each other. After reaching a certain number of generations, the populations communicate with each other and perform the optimal individual migration between the populations. e worst individual in each population will be replaced by the optimal individual in the other populations. Repeat the abovementioned steps until the algorithm iterates to the maximum number of iterations or the optimal solution is found.
In this article, the update strategies are divided into two types: rand strategy and best strategy. In the rand strategy, the roulette wheel selection scheme in the genetic algorithm (GA) is borrowed, and the optimal individual in the group is no longer selected as the solution target of other individuals. Instead, the algorithm uses multiple roulette methods to choose the next generation of solving goals to increase the diversity of population solutions. In this way, the ability of global optimization can be enhanced and the possibility of local optimal trap will be increased. In the best strategy, the best individual in all populations is still the solution target. e purpose of doing this is to maintain the strong local optimization ability of the original algorithm and avoid the instability of the algorithm caused by the introduction of the rand strategy. e update formula is as follows: where X t i,j represents the position of the jth individual in the ith population in the tth iteration and P t b represents the selected target individual after multiple generations of roulette wheel selection in the rand strategy executing population. Also, in the population that executes the best strategy, it represents the globally optimal individual.

Algorithm
Steps. Based on the abovementioned description, the specific steps of the MMSCA algorithm are given below: Step 1: randomly generate N (N is an even number) populations of size m, each population having n dimensions. Initialize the maximum number of iterations, independent evolution algebra, iteration counter etc.
Step 2: evaluate each population and calculate the fitness value of each individual in each population. e population with odd group numbers executes the rand strategy, and the target individual is selected using the roulette wheel selection scheme; the population with even group numbers executes the best strategy, sorts and selects the best individual.
Step 3: use formula (3) to update the individual positions in the population.
Step 4: if the communication conditions are met, interpopulation communication is conducted. e worst individual in a population is replaced by the best individual in another population. If the communication condition is not met, return to step 2.
Step 5: if the algorithm iterates to the maximum number of iterations or the optimal individual is found Mathematical Problems in Engineering to meet the convergence conditions, the algorithm is terminated; otherwise return to step 2. e algorithm flow chart is shown in Figure 1.  In the proposed algorithm, the independent evolutionary algebra is set to 50 and the number of groups is two. For each test function, each algorithm is run independently for 30 times and the average value is calculated. Table 1 records the experimental results, with the best optimization results in bold. All simulation experiments are implemented on the same computer, and the programming tool is Matlab2018a.

Results and Discussion
As shown in the abovementioned table, in the test functions f 1 − f 15 , except f 8 , the MMSCA algorithm has better solution accuracy than the original SCA algorithm. For function f 16 − f 19 , both algorithms show the same optimization performance, and the results are close to or reach the expected minimum. In general, the optimization ability of the SCA algorithm has been improved to some extent after the introduction of the multigroup and multistrategy mechanism. Figure 2 shows the convergence curves of the two algorithms on the unimodal functions f 2 and f 3 , the multimodal functions f 9 and f 11 , and the composite function f 14 . As can be seen from the figure, MMSCA algorithm has also significantly improved the convergence speed compared with SCA algorithm.

Comparison with Other Intelligent Optimization
Algorithms. To further verify the effectiveness of the MMSCA algorithm, this article also compares it with other three intelligent optimization algorithms: the PSO algorithm, the parallel PSO algorithm, and the DE algorithm. e population size is set to 30. 1000 is the maximum number of iterations. For each test function, each algorithm is tested 30 times and the average value is obtained. e other parameters of other algorithms are shown in Table 2.
e test results of MMSCA and other three intelligent optimization algorithms on 19 test functions are shown in Table 3. e bold type in the table indicates the best results of all comparison algorithms.
As shown in Table 3, compared with the PSO algorithm, PPSO algorithm, and DE algorithm, the MMSCA algorithm has obtained better results on 11 test functions. e MMSCA algorithm has the same test results on the test functions f 6 and f 18 − f 19 as the other three algorithms, and they all obtain the expected minimum. However, the test results on the test functions f 6 and f 13 are significantly worse than those of the other three optimization algorithms; the MMSCA algorithm obtains better results on the test function f 11 , and obtains a minimum value of 0.
Based on the comparison results of the two subsections, compared with the original SCA algorithm, the optimization performance of the algorithm is improved after the introduction of multigroup and multistrategy mechanism; compared with other intelligent optimization algorithms, it also shows strong competitiveness. So as to further study the feasibility and practicability of the MMSCA algorithm in processing practical problems, this paper selects the capacitated vehicle routing problem (CVRP) in transportation as the application object. e next section will describe in detail how to apply the MMSCA algorithm and solve it.

Applying MMSCA to Solve CVRP
VRP (Vehicle Routing Problem) has always been the focus of research in the field of transportation. At the same time, there are many applications in real life, including express delivery, air transportation, bus route planning, and so on. VRP was first proposed by scholars Dantzing and Ramser [53] in the late 1950s. Since it was proposed, it has received extensive attention from scholars at home and abroad, and scholars have also carried out a lot of fruitful work on it. After years of research and development, more models of VRP have been derived, and the solving algorithms have become more diverse. Solution algorithms can be divided into two categories: the first type is accurate algorithm and the second is approximate algorithm or heuristic algorithm. Since the VRP problem has been proved to be an NP-Hard problem, the second kind of solution algorithm is the main method to solve it [54]. e GA algorithm, the ACO algorithm, the SA (simulated annealing) algorithm, the PSO algorithm, and other algorithms have been successfully applied to solve VRP problems and achieved good results. In this paper, CVRP (Capacitated Vehicle Routing Problem) is selected as the application object of MMSCA algorithm to further verify the practicability of the algorithm.

CVRP Problem Description and Model.
Problem description: a central warehouse has k distribution vehicles, and the maximum load capacity of each distribution vehicle is Q. Now, we need to transport and distribute materials to n customers (nodes), how to arrange a certain number of vehicles to meet the needs of these customers, and make the total driving distance of vehicles shortest. e following constraints must also be met: (1) All delivery vehicles start from the central warehouse and eventually return to the central warehouse (2) Each delivery vehicle is not allowed to exceed the maximum load capacity Q (3) Each customer can only be served once, and each vehicle can only take one route For the convenience of description, the following symbols are defined: x ijv � y jv , j � 1, 2, . . . , n; v � 1, 2, . . . , k, n j�0 x ijv � y jv , i � 1, 2, . . . , n; v � 1, 2, . . . , k, n i�0 g i y iv ≤ Q, v � 1, 2, . . . , k, k v�1 y iv � 1, i � 1, 2, . . . , n.
Among them, equations (6) and (7) are traffic flow constraints, requiring a car to leave a customer node after it   Mathematical Problems in Engineering has completed service; formula (8) represents the vehicle capacity constraint and indicates that the total customer demand on the route served by vehicle v cannot exceed the vehicle loading capacity Q; formula (9) ensures that each customer can only be served by one vehicle.

MMSCA Algorithm for CVRP.
e MMSCA algorithm is a continuous space algorithm, but the CVRP problem is an integer programming problem, so it needs to be modified in the implementation process.
(1) Encoding and decoding Encoding: using natural number coding, each individual in the population corresponds to a unique arrangement from 1 to n, and each individual corresponds to a distribution scheme. Decoding: arrange the vehicles according to the sequence of customers in the distribution scheme and the constraint of maximum loading capacity. at is, it is sequentially included in the path of the first car according to the customer's coding order, and the second car's path is arranged until the maximum load of the first car is exceeded.
(2) Evaluation criteria e total length of the vehicle path is used to evaluate all individuals and the merits of each distribution scheme.
(3) Implementation process According to the abovementioned coding method, each population is generated. Each individual (distribution scheme) is evaluated according to the evaluation criteria. Update each individual with formula (3) to generate a new distribution scheme. According to the constraint conditions, the actual vehicle path is generated and evaluated. In the process of updating with formula (3), integer    [55] and the GA algorithm. Table 4 shows the experimental results. In the experiment, the population number of MMSCA algorithm is divided two groups, the number of individuals in each group is 50, the solution is thirty times, and the number of iterations is 10,000. During the solution process, the best solution result is recorded.
Where the Best column represents the known optimal results, the Dev column indicates the deviation between the optimal solutions obtained by the algorithm and the best known results. As can be seen from the abovementioned table, the MMSCA algorithm has achieved better results and has certain advantages compared with the PSO algorithm and the genetic algorithm. But, there is still a certain gap with the currently known optimal solutions, indicating that the algorithm still has room for improvement. Figure 3 shows the convergence curve when the MMSCA algorithm solves the CVRP instance A-n60-k9.

Conclusion
Firstly, in view of the problems existing in the SCA algorithm update process, this paper proposes multigroup multistrategy SCA algorithm (MMSCA). e algorithm contains multiple populations with the same number of individuals, and each population performs a different update strategy. Multiple strategies include rand strategy and best strategy. e rand strategy can improve the global optimization ability of the algorithm, and the algorithm can still be disturbed at the later stage to avoid algorithm stagnation. e best strategy is responsible for keeping the algorithm stable and speeds up the convergence speed of the algorithm.
rough numerical experiments on the test function, the MMSCA algorithm has a certain improvement in the accuracy and convergence speed of the original SCA algorithm. Finally, this paper successfully applies the MMSCA algorithm to solve CVRP (Capacitated Vehicle Routing Problem) and obtains better results, which further confirms the practicability and effectiveness of the algorithm. e next research direction will continue to improve the algorithm and apply it to more practical engineering problems.

Data Availability
All data are included within the tables of this article.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.