# Solving the Traveling Salesman Problem: A Modified Metaheuristic Algorithm

Authors: Majid Yousefikhoshbakht
Journal: Complexity
 (2021)

---

## Abstract

The traveling salesman problem (TSP) is one of the most important issues in combinatorial optimization problems that are used in many engineering sciences and has attracted the attention of many scientists and researchers. In this issue, a salesman starts to move from a desired node called warehouse and returns to the starting place after meetingn customers provided that each customer is only met once. The aim of this issue is to determine a cycle with a minimum cost for this salesman. One of the major weaknesses of the PSO algorithm in the classical version is that it gets stuck in local optimizations. Therefore, in the proposed algorithm, called MPSO, the best solution in the current iteration is also used in the movement step. In addition, a variety of local search algorithms are provided that are used when better answers are generated than before. Also, a new method for moving the particle towards the best particle is presented, which, in addition to probably increasing the quality of the new answer, prevents the premature convergence of the algorithm due to consideration of the concept of random. The results evaluated with the results of several metaheuristic algorithms in the literature show the efficiency of the MPSO algorithm because it has been able to achieve excellent solutions in most of these instances.


---

## Body

## 1. Introduction

The aim of optimization is to find the best acceptable answer, considering the limitations and needs of the problem. For a problem, there may be different answers that are defined as the objective function to compare them and select the optimal solution. The choice of this function depends on the nature of the problem. For example, travel time or cost is one of the common goals of optimization of the transportation network. However, choosing the appropriate objective function is one of the most important optimization steps. Sometimes, in optimization of multiple objectives simultaneously, such optimization problems, which involve multiple objective functions, are called multiobjective problems. The easiest way to deal with these problems is to form a new objective function in the form of a line composition of the main objective functions, in which the effect of each function is determined by the weight assigned to it. Each optimization problem has a number of independent variables that are called design variables that are represented by the vectorx with size n. The purpose of optimization is to determine the design variables in such a way that the objective function is quantitative or optimal. Different optimization problems are divided into two categories:(a)
Optimization problems without constraints: in these problems, the goal is to make the objective function the most or least without any limitations on the design variables(b)
Optimization problems with constraints: optimization, in most applied problems, is carried out according to limitations, and regarding the behavior and performance of a system, behavioral limitations and limitations in the physics and geometry of the problem are called geometric or lateral limitationsEquations representing limitations may be equal or unequal, which in each case, the optimization method is different. However, the limitations define an acceptable area in the design. Traveling salesman problem (TSP) is highly considered due to its different applications in testing the efficiency of new algorithms and conversion of other problems to this algorithm. In this seemingly simple issue, a salesman moves from the warehouse and must return to the warehouse after meeting all customers once. The objective is to reduce the mileage as much as possible. The TSP issue can be examined from different perspectives. For example, this problem is investigated to measure the efficiency of new algorithms because although this problem has a hard structure in complexity theory, most algorithms are easily used on it, and thus, the efficiency of algorithms can be investigated compared to other algorithms. Also, other issues can be turned into problems and solved. Thus, the steps to solve some problems can be shortened by this procedure, and using highly efficient algorithms to solve the TSP problem, the main problem can be solved with more quality. For example, these issues include vehicle routing problem [1], aircraft crew timing [2], hybrid Chinese postman issue [3], workshop arrangement [4], mission design for autonomous mobile robots [5], and computer connectivity [6]. However, the applications of this issue are not limited to those mentioned and can be referred to [7] for full information.The methods for solving this problem like other operation research can be classified as exact and heuristic algorithms. One of the obvious and exact methods for solving this problem is finding all the permutations of the nodes and their associated tours and considering the best result in all instances as the optimum solution. To achieve this goal, we needn−1!/2 operations for undirected graphs and n−1! operations for the directed graph. Therefore, if the number of problem data increases in these problems and the size of the problem becomes larger, then the efficiency of these algorithms for solving such problems decreases so much that after a certain amount of data, the algorithm cannot achieve the optimal solution. In other words, these algorithms need unacceptable times to solve these problems, and because the solution of these practical problems must be done in an acceptable time, the use of these algorithms in these problems is not recommended.Due to the weaknesses in exact, heuristic, and metaheuristic algorithms, in this paper, a modified PSO algorithm for TSP, called PPSO, is presented. In addition, since the combination of heuristic and metaheuristic algorithms in literature has had good results, the proposed algorithm is combined with several local search algorithms. On the contrary, several standard examples of the problem have been considered to test the efficiency of the algorithm, and for each example, the algorithm has been tested ten times, and the worst, average, and best solutions have been presented. Also, the quality of the best solutions obtained by this method has been compared with other metaheuristic algorithms for a suitable range of examples. The results show that the algorithm has a very good efficiency for solving problems and can obtain near-optimal solutions at the acceptable time.In the next sections of this article, firstly, the related works and the classic PSO are presented in Section2. In Section 3, the proposed method is described and explains how the use of modifications in this algorithm and some local search methods are effective in increasing the efficiency of the algorithm. Then, in Section 4, the results of the proposed algorithm are compared with other metaheuristic algorithms, and finally, the conclusions and future works are described in Section 5.


## 2. The Related Work and the Classic PSO

Like most combinatorial optimization problems, TSP solution methods are divided into two categories: exact and heuristic algorithms. In exact algorithms such as Lagrangian relaxation [8], branch and bound [9], and pseudoallocation [10], which are mostly used for almost small size problems, the optimal solution to the problem is obtained, despite the fact that a lot of time has to be spent to get this answer. In this issue, the number of solutions possible for n customers, regardless of the warehouse or starting place, is equal to the number of permutations of 1 to n. In other words, the objective of the problem is to find a Hamiltonian cycle with the lowest cost because the number of solutions to this issue is equal to n!. By increasing the customers of the problem, the number of solutions can grow sharply, and it is no longer possible to easily, at an acceptable time, compare all the solutions and achieve the optimal solution. But if the dynamic programming method is used to solve this problem, then the time order will be algorithmic, which is an exponential order. It should be noted that despite the fact that the exponential order is a very bad time, it is still much better than the factorial order. For this reason, several decades ago, heuristic algorithms were proposed for TSP which can reach the solutions in a short time.These algorithms were able to solve the unacceptable CPU time of exact algorithms because today’s time solving is the most important factor for solving a routing problem. In the application of these problems in daily life used for the delivery of goods, it is better that, in some issues, especially in perishable goods, they reach at a specified time, and the cost of routing can be withered. The use of these algorithms in those years was much higher, but over time the results of these algorithms showed that despite the very good time of solving these algorithms, the quality of these algorithms is not of acceptable quality, especially when the size of the problem grows, which occurs in most real problems [11–15]. In other words, the quality of the obtained solution in these algorithms is the victim of time, and as such, these algorithms are trapped in local optimizations and cannot get a better solution due to lack of time and proper solution [16]. So over the last three decades, scientists and researchers have tried to come up with methods that have an efficient solution to find high-quality solutions; however, it needs much more time to be solved. These efforts led to the use of the concept of random in methods, which, for example, is known in the simulated annealing algorithm compared to the classical local search algorithm because in this algorithm, a worse solution is accepted than the best solution obtained by the probable. This solution was used in other new algorithms called metaheuristic and caused the quality of the obtained solutions in these methods to increase compared to heuristic algorithms. So, these algorithms, despite taking more time to solve, are needed to produce better solutions than heuristic algorithms with appropriate solutions and make proper use of the concept of accident. Of course, it should be noted that the very good property of metaheuristic algorithms is that the time of implementation of the algorithm is user-dependent, and based on the acceptable time in each problem, the algorithm is implemented [17–20]. Therefore, there is a direct relationship in these algorithms for the run time and the quality of the obtained solutions, which can change according to the user’s diagnosis.A modified elite genetic algorithm (GA), called SWAP_GATSP, is proposed for efficiently solving the TSP issue [21]. In this algorithm, novel deterministic operation injected in the typical structure of elitist GA, called knowledge-based multiple inversion are used. This kind of variation helps in exploring the search space efficiently and prevents the GA from getting stuck in the local optima. Note that this is an upgraded version of simple inversion mutation. But, it cannot be called the mutation operator, as it is a decisive process not a random one. Also, modified order crossover and knowledge-based neighborhood swapping are used for increasing quality of GA. If k, m, and n are the number of generations, number of the population size, and the number of customers in the considered instance, the time complexity of the algorithm is O (k•m•n).In paper [22], a modified PSO algorithm called C3DPSO was presented to efficiently solve the TSP problem, which achieved better results on standard examples than the previous three modifications of the PSO algorithm. This algorithm changed the formula for updating particles using the mutation coefficient called c3 so that causing this algorithm could create a perfect balance between intensification and diversification mechanisms. Also, the modifications made in the algorithm had an effective impact on both the run time and the quality of the answers. Also, they cause the algorithm not to have premature convergence and to adequately search for the problem space. On the contrary, the parameters of this algorithm were not adjusted by any method, and in addition to the three improved PSO algorithms, the algorithm was compared with an ant colony optimization. The results showed the efficiency of the proposed algorithm on the examples taken from the TSPLIB library.For the first time, a bee optimization algorithm based on their foraging food for the TSP problem was presented in the paper [23], and the results were compared with previous versions of the bee optimization algorithm. It should be noted that this algorithm had some differences compared to previous versions of the bee method. For example, the bee hive in the problem had the same distances as all customers, and no local search algorithm was used, and the bees did not have the memory to store the number of bees seen in each edge, and to build the answer, the bees used the arc fitness and the distance between the nodes. These modifications led to a good efficiency algorithm for solving 12 standard problems from 48 nodes to 200 nodes. In addition, in comparison with other metaheuristic algorithms, excellent solutions were obtained by this algorithm.The study in [24] uses a multiagent reinforcement learning method to solve the TSP problem as one of the most important routing issues. This multiagents’ algorithm works on the basis of learning enhancement so that despite the independency of each factor and memory, it causes optimization problems to be solved. It should be noted that the lack of communication of factors does not reduce the quality of the answers, but ultimately their hidden communication leads to the final solution of the problem. Due to the inefficiency of this algorithm in the intensification mechanism, an iterated local search algorithm is used to further improve the answers in this algorithm in order to investigate more neighbors in susceptible areas. The use of several TSP problems from the TSPLIB library shows the efficiency of the proposed algorithm compared to other algorithms.In [25], an elite hybrid algorithm of ACO is presented, that uses an innovative process with an external memory structure. This memory is composed of a variety of high-quality answers, causing a balance between intensification and diversification mechanisms. These modifications increase the efficiency of the algorithm in order to escape from local optimal points and achieve high-quality solutions. To test the efficiency of this new algorithm, an NP-hard problem, such as TSP, which has a simple concept, is considered to determine the compatibility and efficiency of the algorithm along with its effectiveness. Due to the multifactor structure of this algorithm and the weakness in the local search of the answers, a repetitive local search algorithm is used to intensify the search around high-quality answers in order to obtain better answers. Finally, as a case study, two problems of finding the best tour in Jordan are considered, and the results showed that the algorithm has high quality of performance, for example, for these methods, memetic algorithm [26], discrete tree-seed algorithm [27], simulated annealing [28], ant colony optimization [29], and genetic algorithm [30]. Although the stochastic search of metaheuristic algorithms causes the problem to be investigated in different directions and in case of falling in the local optimal, the algorithm can escape from the local optimal by using these structures, but on the contrary, this structure causes the time of these algorithms to increase compared to heuristic methods. It should be added that, in metaheuristic algorithms, the accuracy of the obtained solutions and the speed of reaching have an inverse relationship with each other.As it is known from this form, the speed of accuracy of the solutions at the beginning of the algorithm is very good, and in a short time, the quality of the solutions is very desirable, but whatever passes from the beginning of the algorithm, this desirability decreases and causes the quality of the solutions to remain almost constant. Therefore, due to the high volume of calculations, variables, and parameters, the number of algorithm repetitions increases sharply, and the algorithm cannot improve the quality of the solutions at the right speed.In hybrid algorithms composed of metaheuristic and heuristic algorithms, it has been tried to use the advantages of each algorithm appropriately. For example, metaheuristic algorithms have a good ability to search globally and can search for the problem space at an acceptable time and identify susceptible areas. Therefore, in hybrid algorithms, these methods can be used to search globally and find good solutions. On the contrary, heuristic methods have good local search efficiency and can properly examine the neighborhoods of a solution. Therefore, in some hybrid algorithms, these methods can be used when the algorithm has been able to identify high-quality solutions, but it requires the local search to find the better solution in the neighborhoods of these solutions. As an example of these methods, which have attracted a lot of attention today, we can refer to the hybrid algorithms’ sweep, genetic algorithm (GA) and the nearest neighborhood [31], ant system algorithm and scattered search [32], and particle swarm optimization (PSO) and local search [33].The particle swarm optimization (PSO) algorithm is a population-based random optimization method developed by Kennedy and Eberhart in 1995 [34], inspired by the social behavior of bird overcrowding and fish farming. Of course, this was just the beginning, and extensive research was conducted to improve this method, which led to stronger versions of this method provided by many authors [35–37] that the reader could see a summary of the development, improvement, and applications of this algorithm in [38]. To get a proper understanding of this method, consider a group of birds looking for food in an environment. It is notable that none of them know the place of food, but at each stage, they know their distance to the place of food. Accordingly, the best approach to finding food is to follow the nearest bird to food. PSO tries to use this behavior to solve optimization problems [39] and offers a reliable way to solve these problems. In general, the PSO algorithm has simple concepts and is rooted in artificial life and computational intelligence. Also, this algorithm is similar to evolutionary computational techniques such as the genetic algorithm (GA), but compared to GA, it does not have intersection and mutation operators [40]. Because the PSO method has few parameters, its implementation is simple and effective and applicable to solve various problems. Finally, its main application is for solving unconstraint problems, but it can also be used for constraint problems using the fines’ method.As mentioned earlier, the PSO algorithm simulates bird swarm behaviors. Imagine the following scenario: a group of birds are accidentally exposed to food in one area. There is only one piece of food in the search area. Not all birds know where the food is, but they know how much food per iteration. So, what is the best strategy for finding food? The solution is to follow a bird that is closer to food. PSO designers adapted this scenario and used it to solve optimization problems. In PSO, each solution is a “particle” in the search space. All particles have proportional values that are evaluated by the proportionality function for optimization and have speeds that drive particle flight. Particles flow through the problem space with optimal particles.The PSO algorithm begins with a group of random particles (solutions) and then searches by updating generations. In each iteration, each particle is updated with two “best” values: the first is the best solution (objective function) that has been achieved so far (the value of the objective is also stored). This value is calledpbest. Another is the “best” value ever achieved by every particle in the population. This is the best global value of the best and is called gbest. In other words, gbest can be considered the best pbest in the whole group. This process continues until the algorithm stops (Figure 1). It should be noted that the condition of stopping in this algorithm is to rate birds to zero or reach the number of repetitions considered. Now, the speed and position are updated with the equation as follows:(1)vt+1=vt+c1∗rand1t∗pbestt−presentt+c2∗rand2t∗gbestt−presentt,(2)presentt+1=presentt+vt+1,where c1 and c2 are the constant learning parameters that determine the effect of gbest and pbest in the next position, rand1 and rand2 are random numbers in the range [0, 1], present is the present position of each bird, and v[t] is the movement speed of each bird in stage t.Figure 1
The steps of the classic version of PSO.In Figure2, the movement of the particle, in the possible space, is shown.Figure 2
Moving particle in the PSO algorithm.


## 3. The Proposed PSO

Although metaheuristic algorithms, such as PSO, have excellent performance than heuristic algorithms, they fall in premature convergence when used for complex problems in daily life. In other words, this concept causes particles, which show the role of feasible solutions to the problem, to be stuck in local optimal points, and spend a long time without improvement. Therefore, the quality of the obtained answers cannot grow continuously and achieve quality solutions. For this reason and to overcome premature convergence, several modifications are presented to improve the PSO algorithm in the literature [41–45]. In the PSO algorithm, pbest and gbest are considered, while in the proposed algorithm, called MPSO, the best current answer is also considered as gcbest. The method is that the solutions gbest and gcbest have two coefficients of a1 and a2, respectively, in which the sum of these two variables is equal to 100%. The values of these two coefficients change over time as the algorithm runs, as described in the following. Finally, three local search algorithms are considered for intensification to further improve the answers if gbest or pbest is updated. The steps of the proposed algorithm are described as follows.


### 3.1. Initialization

In the TSP problem, each particle has a possible solution and indicates a permutation of the TSP customers. At first, the algorithm starts withm random solutions. Then, according to the objective function, the objective value is calculated for each particle based on the sum of all arcs traveled by the salesman. Besides, the m + 2 variables are considered with the objective function’s values of infinite positive, whose m is considered to be the best known locations for particles. Also, the other two variables are gbest and gcbest in each iteration.


### 3.2. Diversification and Intensification Mechanisms

Although the PSO algorithm had better performance than heuristic and some metaheuristic algorithms at the time it is presented, with the expansion of urbanization and creating more problematic problems in industry and services, this classic version of the algorithm was unable to solve these problems optimally. Therefore, it is necessary to make modifications to the algorithm to increase the efficiency. For example, one of the weaknesses is the premature convergence, which causes the algorithm to be limited to a range in the problem space without paying attention to the global search and so-called falling in the local optimum point [46, 47]. In other words, in the classical mode, there is no proper balance between a global search of the problem space and a suitable local search when finding susceptible areas. On the contrary, the factors that have caused the metaheuristic algorithms to be highly considered nowadays are as follows: the large size of everyday problems that managers face today, the high importance of solving problems that customers or users pay attention to using these algorithms, and the stability of the answers obtained for various problems considered for both managers and customers. Therefore, the aim is to provide sustainable algorithms that can achieve large-sized problems in industry and services at a reasonable time. In other words, the answers obtained by different performances do not have much tolerance and can be solved with a maximum error.For balancing between global and local search mechanisms in the proposed algorithm, the best current solution at each iteration, calledgcbest is also considered. This algorithm works by considering two variables 0 <= a1 and a2 ≤ 1 for gbest and gcbest, respectively, so that %alpha <= a1 ≤ %beta and a2 = 1 − a1. At the beginning of the algorithm, which requires the algorithm to pay more attention to the global search, a1 = %alpha is considered, resulting in a2 = %beta. Now, during the algorithm and based on the number of implementations of the main body of the algorithm, the value a1 gradually reaches from %alpha to %beta. Therefore, a random number between 0 and 1 is generated, and if this value is smaller or equal to a1, gbest will be considered, and otherwise, gcbest will be selected. Now, pbest and one of these two particles are considered, and the corresponding particle moves as a linear combination of them. The method presented in this paper is described by using an example. Suppose that the random number will be created so that gcbest is selected, pbest = 0 3 2 1 5 6 8 7 4 8 0, gcbest = 0 4 5 2 1 3 6 8 7 0, and particle = 0 3 1 4 5 8 7 2 6 0. Then, two pbest and gcbest answers are searched so that the customers in a joint burst are found between them and transferred to the new particle answer. In this example, the values of “2 1” and “6 8 7” are common between the two pbest and gcbest solutions. As a result, the particle response is modified using the insert algorithm in which customers can be created. So, particle = 0 3 2 1 4 5 6 8 7 2 0 is generated. The reason for using this method is that because two pbest and gcbest answers are among the best answers in the population, so during the algorithm, pathways are created that may not be the best, but the same routes of a few customers are most likely the best routes between those customers, and it is better to create in the particle as well.


### 3.3. Updatinggbest and pbest

After all the particles have moved using the previous step,pbest of each particle and gbest may be changed. In other words, for each particle, if the new answer has a better value than the corresponding pbest, this value is updated. In addition, after changing all pbests, if a value is found in them that has a better value than gbest, this value will also be updated. It should be noted that, at the end of the algorithm, the value of gbest and its objective function are presented as the best answer and value of the problem.


### 3.4. Local Search Algorithms

In this step, four iterated local search algorithms are described, as shown in Figure3. These methods are used when pbest or gbest is updated. It is important to note that the reason for using these algorithms at this stage is that when a better solution is found, there may likely be better solutions around it, which the algorithm can achieve them [14, 48]. In the inset move, a specific customer moves to another location on the same path, and in the exchange move, two customers are selected and change their positions. Besides, the 2-Opt move works by removing two edges from the cycle and re-connecting the two arcs in another way. Finally, in 3-inverse move, three customers are selected, and their order is reversed in the desired answer. It is necessary to note that each movement is accepted by the algorithm when it leads to a better solution to the relevant method.Figure 3
The insert, exchange, 2-Opt, and 3-inverse moves.


### 3.5. The Stop Condition

Like other metaheuristic algorithms, the stop criterion for the end of the algorithm is investigated in this step. If this condition has been achieved,gbest and its objective function will be considered as the best solution and value of the problem. Otherwise, the algorithm process will be repeated again until the stop condition of the algorithm is established. The pseudocode of the algorithm is shown in Figure 4.Figure 4
Steps of the proposed algorithm.


### 3.6. Computational Complexity of PPSO

In order to obtain the computational complexity of the proposed algorithm, it should be assumed that the number of iterations of the main body of the algorithm isn, and the initial population of particles is equal to m. Now, it is enough to consider the part of the code where most of the operations are performed, which is why the rest of the code can be ignored. This part is the using local search algorithms. The complexity of the main loop is O (n). Also, all particles must be checked to find out which particle’s pbest has changed, so there is O (m) in this section. Now, the 3-inverse algorithm is more complex than other local search algorithms, and because it has to choose 3 customers from m, the complexity of this part is O (m3). As a result, the complexity order of the proposed algorithm is of O (nm4).


## 3.1. Initialization

In the TSP problem, each particle has a possible solution and indicates a permutation of the TSP customers. At first, the algorithm starts withm random solutions. Then, according to the objective function, the objective value is calculated for each particle based on the sum of all arcs traveled by the salesman. Besides, the m + 2 variables are considered with the objective function’s values of infinite positive, whose m is considered to be the best known locations for particles. Also, the other two variables are gbest and gcbest in each iteration.


## 3.2. Diversification and Intensification Mechanisms

Although the PSO algorithm had better performance than heuristic and some metaheuristic algorithms at the time it is presented, with the expansion of urbanization and creating more problematic problems in industry and services, this classic version of the algorithm was unable to solve these problems optimally. Therefore, it is necessary to make modifications to the algorithm to increase the efficiency. For example, one of the weaknesses is the premature convergence, which causes the algorithm to be limited to a range in the problem space without paying attention to the global search and so-called falling in the local optimum point [46, 47]. In other words, in the classical mode, there is no proper balance between a global search of the problem space and a suitable local search when finding susceptible areas. On the contrary, the factors that have caused the metaheuristic algorithms to be highly considered nowadays are as follows: the large size of everyday problems that managers face today, the high importance of solving problems that customers or users pay attention to using these algorithms, and the stability of the answers obtained for various problems considered for both managers and customers. Therefore, the aim is to provide sustainable algorithms that can achieve large-sized problems in industry and services at a reasonable time. In other words, the answers obtained by different performances do not have much tolerance and can be solved with a maximum error.For balancing between global and local search mechanisms in the proposed algorithm, the best current solution at each iteration, calledgcbest is also considered. This algorithm works by considering two variables 0 <= a1 and a2 ≤ 1 for gbest and gcbest, respectively, so that %alpha <= a1 ≤ %beta and a2 = 1 − a1. At the beginning of the algorithm, which requires the algorithm to pay more attention to the global search, a1 = %alpha is considered, resulting in a2 = %beta. Now, during the algorithm and based on the number of implementations of the main body of the algorithm, the value a1 gradually reaches from %alpha to %beta. Therefore, a random number between 0 and 1 is generated, and if this value is smaller or equal to a1, gbest will be considered, and otherwise, gcbest will be selected. Now, pbest and one of these two particles are considered, and the corresponding particle moves as a linear combination of them. The method presented in this paper is described by using an example. Suppose that the random number will be created so that gcbest is selected, pbest = 0 3 2 1 5 6 8 7 4 8 0, gcbest = 0 4 5 2 1 3 6 8 7 0, and particle = 0 3 1 4 5 8 7 2 6 0. Then, two pbest and gcbest answers are searched so that the customers in a joint burst are found between them and transferred to the new particle answer. In this example, the values of “2 1” and “6 8 7” are common between the two pbest and gcbest solutions. As a result, the particle response is modified using the insert algorithm in which customers can be created. So, particle = 0 3 2 1 4 5 6 8 7 2 0 is generated. The reason for using this method is that because two pbest and gcbest answers are among the best answers in the population, so during the algorithm, pathways are created that may not be the best, but the same routes of a few customers are most likely the best routes between those customers, and it is better to create in the particle as well.


## 3.3. Updatinggbest and pbest

After all the particles have moved using the previous step,pbest of each particle and gbest may be changed. In other words, for each particle, if the new answer has a better value than the corresponding pbest, this value is updated. In addition, after changing all pbests, if a value is found in them that has a better value than gbest, this value will also be updated. It should be noted that, at the end of the algorithm, the value of gbest and its objective function are presented as the best answer and value of the problem.


## 3.4. Local Search Algorithms

In this step, four iterated local search algorithms are described, as shown in Figure3. These methods are used when pbest or gbest is updated. It is important to note that the reason for using these algorithms at this stage is that when a better solution is found, there may likely be better solutions around it, which the algorithm can achieve them [14, 48]. In the inset move, a specific customer moves to another location on the same path, and in the exchange move, two customers are selected and change their positions. Besides, the 2-Opt move works by removing two edges from the cycle and re-connecting the two arcs in another way. Finally, in 3-inverse move, three customers are selected, and their order is reversed in the desired answer. It is necessary to note that each movement is accepted by the algorithm when it leads to a better solution to the relevant method.Figure 3
The insert, exchange, 2-Opt, and 3-inverse moves.


## 3.5. The Stop Condition

Like other metaheuristic algorithms, the stop criterion for the end of the algorithm is investigated in this step. If this condition has been achieved,gbest and its objective function will be considered as the best solution and value of the problem. Otherwise, the algorithm process will be repeated again until the stop condition of the algorithm is established. The pseudocode of the algorithm is shown in Figure 4.Figure 4
Steps of the proposed algorithm.


## 3.6. Computational Complexity of PPSO

In order to obtain the computational complexity of the proposed algorithm, it should be assumed that the number of iterations of the main body of the algorithm isn, and the initial population of particles is equal to m. Now, it is enough to consider the part of the code where most of the operations are performed, which is why the rest of the code can be ignored. This part is the using local search algorithms. The complexity of the main loop is O (n). Also, all particles must be checked to find out which particle’s pbest has changed, so there is O (m) in this section. Now, the 3-inverse algorithm is more complex than other local search algorithms, and because it has to choose 3 customers from m, the complexity of this part is O (m3). As a result, the complexity order of the proposed algorithm is of O (nm4).


## 4. Computational Results

In this section, the results of the proposed algorithm are presented for two categories of examples. Also, the results obtained by the proposed algorithm are compared with some of the most famous results of metaheuristic algorithms in the second set of instances. It should be added that all the code of the proposed algorithm is written in Matlab 7, and the computer on which these programs have been implemented is a laptop with Intel(R) Core(TM) i3 CPU 2.53 GHz and 4 GB of memory. In this section, the parameter settings are discussed, and then, our results are presented.


### 4.1. Parameter Settings

The solutions produced by the MPSO, like every metaheuristic algorithm, were dependent on the seed used to generate the sequence of pseudorandom numbers and on the different values of the parameters of the algorithm. Only four parameters exist in our proposed algorithm, and the values of these directly or indirectly affect the quality of the final solution. A parameter setting procedure is necessary to reach the best balance between the quality of the solutions obtained and the required computational attempt. We should mention that there is no way of defining the most effective values of the parameters. Therefore, in this paper, similar to many others, they are selected after thorough testing; we understand that the most influential experimental parameters in MPSO that directly affect the quality of the final solution are the number of populations and the stop condition.Thus, all of the parameters’ values have been determined on the Ch150 instance. To find the best values of the parameters in the proposed algorithm, 15 combinations of parameters are selected, and for each test, the Ch150 example is tested ten times, and the average of the answers is considered. Now, considering the answers to these examples and using the Taguchi method, the best answers for the parameters are obtained. The results on the next section confirm that our parameter setting worked well. The parameters of the MPSO and their values in different configurations are congregated in Table1.Table 1
Parameter settings for the MPSO method.
ParameterDescriptionCandidate valueValuemThe number of population[n/2], n, [3n/2], 2n, [5n/2], and 3n2nAlpha (percent)The at least value of usinggcbest0-5-10-15-20–2510Beta (percent)The at most value of usinggcbest75-80-85–90–95–10090SCThe number repetition ofgbest as the stop conditionn/10, n/9, n/8, n/7, n/6, n/5, n/4, and n/3n/4


### 4.2. Our Results

Table2 shows 40 standard instances for comparing the classical PSO algorithm with the proposed MPSO method, which has a suitable range of customers from 29 to 575. In this table, n represents the number of clients in each instance in column 2, and the best results obtained by all algorithms (BKS) in the literature are given in the last column. In addition, the best solution (BS), worst solution (WS), and the average solution (AS) for both algorithms are shown in other columns for 10 times the execution of each instance. Also, for each algorithm, the value of the objective function (cost) and the relative difference to BKS (Gap) for each example are given. These instances are available at the URL http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/.If the best solution found by one of the two algorithms is shown withcs∗, Gap compared to BKS is obtained from formula (3). It should be noted that the zero value in this formula means that the algorithm has been able to achieve the BKS answer in the literature:(3)100×cs∗−BKS/BKS.It should be noted that the a Gap value can be a negative, zero, or positive number so that obtaining a negative Gap number for an example shows that the algorithm was able to produce high quality answers and increase the quality value of BKS. In addition, a value of zero indicates that the algorithm was able to obtain an answer similar to the best algorithms for that example, and a positive value indicates a worse response than BKS, which occurs in most algorithms.Table 2
The results of the proposed algorithm for the TSP instances.
InstancenWS (PSO)AS (PSO)BS (PSO)WS (MPSO)AS (MPSO)BS (MPSO)BKSCostGapCostGapCostGapCostGapCostGapCostGap1Burma141433230.0033230.0033230.0033230.0033230.0033230.0033232Gr171720850.0020850.0020850.0020850.0020850.0020850.0020853Gr212127070.0027070.0027070.0027070.0027070.0027070.0027074Gr242412720.0012720.0012720.0012720.0012720.0012720.0012725Fri26269370.009370.009370.009370.009370.009370.009376Bayg292916100.0016100.0016100.0016100.0016100.0016100.0016107Bays292920200.0020200.0020200.0020200.0020200.0020200.0020208Arr4848109833.34106990.67106280.00106280.00106280.00106280.00106289Eil51514546.574290.704260.004260.004260.004260.0042610Pr76761135454.981150036.331098701.581081590.001081590.001081590.0010815911Rat9999139715.36137313.3812946.8512110.0012110.0012110.00121112KroA100100233429.68218432.64212820.00213520.33212920.05212820.002128213KroB100100234245.79229643.72225341.77221410.00221410.00221410.002214114Rd10010086018.7482854.7480471.7381352.8480541.8279100.00791015Eil10110169911.136574.456432.236290.006290.006290.0062916Lin1051051589710.56151425.31149103.69143790.00143790.00143790.001437917Pr1071074893310.45467615.55456022.93443030.00443030.00443030.004430318Pr1241246591111.66636607.84618014.69595550.89591130.14590300.005903019Bier12712713011010.001293799.381278308.071182820.001182820.001182820.0011828220Ch130130677910.9564545.6362993.0962552.3761761.0861100.00611021Pr1361361058399.371021835.59995752.90979721.24975430.80967720.009677222Pr1441446486910.82621296.14602933.00589720.74586120.13585370.005853723Ch150150732512.2169746.8367243.0066592.0165790.7865280.00652824KroA1501502948811.17283286.80277204.51269521.61267110.71265240.002652425Pr1521528137810.44773504.98754922.46741620.65739150.32736820.007368226Rat195195268615.6324987.5323832.5824013.3623511.2123230.00232327D1981981782812.98168496.77166535.53162222.80160241.55157800.001578028KroA2002003279911.68312956.56302493.00310525.73298181.53295330.562936829Ts2252251389299.701332105.191294422.211291571.991283851.381266430.0012664330Pr2262268920711.00856496.57827612.98812791.13809900.77805450.228036931Pr2642645614014.26532898.45502052.18509453.68501782.12493250.394913532A280280288311.7928149.1126583.0627958.3826322.0625980.74257933Pr2992995301610.01514046.67495822.89491051.90485890.83483320.294819134Lin3183185021519.484717212.24453117.81458129.00453918.00437104.004202935Linhp3183184920119.004635612.12446538.00450669.00446538.00413450.004134536Rd4004001808418.341721512.66165038.00166569.00165038.00158924.001528137Pr43943912758819.0012008312.001157948.001169679.091159948.191118754.3410721738Si5355355725618.185526414.06523268.00528119.00523268.00503884.004845039U5745744391719.004113411.46398578.00402969.19397577.73369050.003690540Rat575575806019.00758612.0072156.5373839.0173558.5970143.566773Computational results on 40 examples of Table2 show that the classic PSO algorithm has been able to achieve BKS in WS, AS, and BS modes in only 7 small instances, but when the number of nodes increases, it cannot achieve BKS solutions with the same quality and loses its efficiency. Also, in the three examples Arr48, Eil51, and KroA100, although the algorithm in the BS mode has been able to achieve the BKS solutions, the BKS solutions have not been obtained in WS and AS modes. On the contrary, in the remaining 30 examples, which have a customer number of 76 and above, the algorithm in the WS mode has minimum and maximum errors from 3.34 to 19 percent. Besides, for BS and AS modes, it has better solutions so that, for the first criterion, it has minimum and maximum errors of 1.56 to 8 percent, and for the second criterion, it has errors between 0.67 and 14.06 percent. Therefore, it can be concluded that the algorithm in the classical mode is not of good quality and does not have the necessary stability to use routing problems. Also, the results of the proposed MPSO algorithm show that the algorithm has a very excellent performance, and in 16 examples, the last of which was Bier127, it has been able to have a very good stability and achieve BKS solutions in all three criteria. In other words, BKS answers in 14 other examples have been obtained by this algorithm for the BS mode, and in this case, in only 10 of the 40 examples, it has not been able to achieves to the BKS solutions that for a metaheuristic algorithm compared to other algorithms, and as you will see in the next table, it is a very high-quality solution. In this case, the Gaps change between 0.22 and 4.34, while for average AS answers, its values change between 0.13 and 8.59. Also, in the WS mode, the algorithm has the minimum and maximum Gaps from 0.33 to 9.19.To compare the answers obtained in Table2, Figures 5 and 6 have been used so that in Figure 5, the average of Gaps is shown for 40 instances, while in Figure 7, the average of the results obtained by the two algorithms for the AS mode is presented to compare their stabilities. It should be noted that, in Figure 5, the average Gaps for BS, AS, and WS are ascending, but usually because the best solutions of metaheuristic algorithms are compared in the BS mode, it can be seen that the average for PSO and MPSO algorithms is 3.28 and 0.55, respectively, which shows that the modifications of the classic version have increased the quality of the algorithm and obtained excellent answers. On the contrary, Figure 6 shows that only the stability of the solutions for the first four examples is the same for the two algorithms, both of which were able to achieve the best answers, but for the next 36 examples, the MPSO algorithm achieved the better solutions.Figure 5
The mean Gaps of the PSO and MPSO algorithms.Figure 6
Comparing the mean Gaps in the AS mode for PSO and MPSO.Figure 7
The mean Gaps of the algorithms.In Table3, 18 examples are intended to compare between the MPSO and the following seven algorithms, which have 24 to 200 nodes. In this table, the names of examples are shown in the second column and the best results obtained (BKS) in the last column. Also, the best results obtained by the mentioned algorithms are mentioned in other columns. It should be noted that since there are many TSP examples in literature, it is hard to find examples where all the algorithms have been implemented, so these 18 examples are considered in this table. In addition, the results of GA, BSO, and ACO + SEE algorithms are presented for four, five, and five instances, respectively, while the rest of the algorithms have been tested in a larger number of examples.The genetic algorithm (GA) [16]The particle swarm optimization (PSO) [17]The bee colony optimization (BCO) [18]The improved ACO with pheromone correction strategy (ACO + SEE) [19]The multi-agent reinforcement learning algorithm (MARL-2-opt) [20]The hybrid elitist-ant system (HEAS) [21]Table 3
Comparing the proposed PSO algorithm with other algorithms.
InstancenGAPSOBCOACO + SEEMARL-2-optHEASMPSOBKS1GR24241272—————127212722GR48485046—————504650463ATT4848——10661——1062810628106284Eil5151—4274284274274264264265Berlin5252—7542—754275427542754275426ST7070685——6756766756756757Eil7676—5405395465445385385388KroA10010021504212962176321282212822128221282212829KroB100100——22637—22237—221412214110KroC100100——20853———207492074911KroD100100——21643———212942129412KroE100100——22450———220682206813Eil101101——635—633—62962914Lin105105——15288—14412—143791437915KroA150150——27858—26862—265242652416KroB150150——26535—2646426185262542613017KroA200200—2956329961—2953829420295332936818KroB200200——30350———2950129437By comparing the results obtained in this table, it can be concluded that the proposed algorithm has been able to achieve more quality solutions than GA so that in two examples, St70 and KroA100 have increased the quality of the answers. On the contrary, in GR24 and GR48, the proposed algorithm has obtained the same solutions. Therefore, it can be concluded that although the GA algorithm has perfect performance for examples with small-size customer’s numbers, when the number of customers increases, the GA algorithm, unlike the MPSO algorithm, cannot maintain its performance and achieves lower quality solutions.The second algorithm that the results are compared with the proposed method is the PSO algorithm. This algorithm has been stable in the five examples that have been tested and has been able to obtain the solutions with less than one percent error. Although this algorithm has achieved the best solution so far in Berlin52 example, it has failed to respond with this accuracy in the remaining four examples. Also, in these four examples, the proposed algorithm has been able to obtain better solutions than this algorithm. Therefore, it can be concluded that the MPSO algorithm is more powerful than the PSO algorithm and has been able to escape from local optimal points. Comparing the proposed algorithm with the BCO algorithm, it can be seen that the BCO algorithm has only been able to obtain close solutions to the MPSO algorithm in Eil51 and Eil76 examples, and in the remaining 17 examples, the proposed algorithm has obtained much better solutions than this algorithm. It should be noted that the BCO algorithm in general is not efficient compared to other algorithms presented in this table, and in none of the examples, it has been able to achieve the BKS solutions.The proposed algorithm is completely superior to the ACO-SEE algorithm because compared to the five problems which the solutions of this algorithm are presented, the solutions of the two algorithms have the same only in two examples. Also, in three other examples, the proposed MPSO algorithm has been able to improve the quality of the solutions of this algorithm and achieve better solutions. Also, Marl-2-opt’s solutions are presented in 11 examples, which compared to the proposed algorithm solutions, have been able to achieve the same solutions in two examples. However, in nine other instances, this algorithm has not been able to achieve the quality of the MPSO solutions and has obtained worse solutions. The last algorithm in this table is compared to MPSO results is the HEAS algorithm, which has very good solutions compared to other metaheuristic algorithms. By comparing the results of this algorithm with the MPSO algorithm, it can be seen that this algorithm has been able to achieve a better solution than the proposed algorithm, although in another example, it has obtained a worse solution. Besides, these two algorithms have found the same solutions to the MPSO algorithm in six other examples.In Figure7, the average Gap for the results of the seven algorithms presented in Table 3 is shown in which the horizontal axis presents the names of the algorithms, and the average Gaps are shown in the vertical axis. In this figure, the weakest method is BCO, which has the average of 2.02 and has poor-quality solutions compared to the results of GA and MARL-2-opt algorithms because the average Gaps for these two algorithms are 0.63 and 0.54, respectively. On the contrary, the two algorithms PSO and ACO + SEE have very close answers and have an average of 0.33 and 0.34, respectively, which have obtained better answers than the previous three algorithms. Finally, HEAS and MPSO algorithms have the best solutions compared to the previous five algorithms that were able to achieve values of 0.05 and 0.07, which are outstanding results. It should be noted that the HEAS algorithm is presented in only eight examples in this table, and compared to the proposed algorithm, its results are not presented in ten examples. Therefore, it is not possible to provide a more accurate comparison between these two algorithms, and it can only be concluded that these two algorithms have found the best results between the seven algorithms in 18 examples of Table 3.In addition, the six solutions of the proposed algorithm are shown in Figure8. In these solutions, the algorithm has been able to achieve the best-known solutions.Figure 8
Some solutions obtained by MPSO.
(a)(b)


## 4.1. Parameter Settings

The solutions produced by the MPSO, like every metaheuristic algorithm, were dependent on the seed used to generate the sequence of pseudorandom numbers and on the different values of the parameters of the algorithm. Only four parameters exist in our proposed algorithm, and the values of these directly or indirectly affect the quality of the final solution. A parameter setting procedure is necessary to reach the best balance between the quality of the solutions obtained and the required computational attempt. We should mention that there is no way of defining the most effective values of the parameters. Therefore, in this paper, similar to many others, they are selected after thorough testing; we understand that the most influential experimental parameters in MPSO that directly affect the quality of the final solution are the number of populations and the stop condition.Thus, all of the parameters’ values have been determined on the Ch150 instance. To find the best values of the parameters in the proposed algorithm, 15 combinations of parameters are selected, and for each test, the Ch150 example is tested ten times, and the average of the answers is considered. Now, considering the answers to these examples and using the Taguchi method, the best answers for the parameters are obtained. The results on the next section confirm that our parameter setting worked well. The parameters of the MPSO and their values in different configurations are congregated in Table1.Table 1
Parameter settings for the MPSO method.
ParameterDescriptionCandidate valueValuemThe number of population[n/2], n, [3n/2], 2n, [5n/2], and 3n2nAlpha (percent)The at least value of usinggcbest0-5-10-15-20–2510Beta (percent)The at most value of usinggcbest75-80-85–90–95–10090SCThe number repetition ofgbest as the stop conditionn/10, n/9, n/8, n/7, n/6, n/5, n/4, and n/3n/4


## 4.2. Our Results

Table2 shows 40 standard instances for comparing the classical PSO algorithm with the proposed MPSO method, which has a suitable range of customers from 29 to 575. In this table, n represents the number of clients in each instance in column 2, and the best results obtained by all algorithms (BKS) in the literature are given in the last column. In addition, the best solution (BS), worst solution (WS), and the average solution (AS) for both algorithms are shown in other columns for 10 times the execution of each instance. Also, for each algorithm, the value of the objective function (cost) and the relative difference to BKS (Gap) for each example are given. These instances are available at the URL http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/.If the best solution found by one of the two algorithms is shown withcs∗, Gap compared to BKS is obtained from formula (3). It should be noted that the zero value in this formula means that the algorithm has been able to achieve the BKS answer in the literature:(3)100×cs∗−BKS/BKS.It should be noted that the a Gap value can be a negative, zero, or positive number so that obtaining a negative Gap number for an example shows that the algorithm was able to produce high quality answers and increase the quality value of BKS. In addition, a value of zero indicates that the algorithm was able to obtain an answer similar to the best algorithms for that example, and a positive value indicates a worse response than BKS, which occurs in most algorithms.Table 2
The results of the proposed algorithm for the TSP instances.
InstancenWS (PSO)AS (PSO)BS (PSO)WS (MPSO)AS (MPSO)BS (MPSO)BKSCostGapCostGapCostGapCostGapCostGapCostGap1Burma141433230.0033230.0033230.0033230.0033230.0033230.0033232Gr171720850.0020850.0020850.0020850.0020850.0020850.0020853Gr212127070.0027070.0027070.0027070.0027070.0027070.0027074Gr242412720.0012720.0012720.0012720.0012720.0012720.0012725Fri26269370.009370.009370.009370.009370.009370.009376Bayg292916100.0016100.0016100.0016100.0016100.0016100.0016107Bays292920200.0020200.0020200.0020200.0020200.0020200.0020208Arr4848109833.34106990.67106280.00106280.00106280.00106280.00106289Eil51514546.574290.704260.004260.004260.004260.0042610Pr76761135454.981150036.331098701.581081590.001081590.001081590.0010815911Rat9999139715.36137313.3812946.8512110.0012110.0012110.00121112KroA100100233429.68218432.64212820.00213520.33212920.05212820.002128213KroB100100234245.79229643.72225341.77221410.00221410.00221410.002214114Rd10010086018.7482854.7480471.7381352.8480541.8279100.00791015Eil10110169911.136574.456432.236290.006290.006290.0062916Lin1051051589710.56151425.31149103.69143790.00143790.00143790.001437917Pr1071074893310.45467615.55456022.93443030.00443030.00443030.004430318Pr1241246591111.66636607.84618014.69595550.89591130.14590300.005903019Bier12712713011010.001293799.381278308.071182820.001182820.001182820.0011828220Ch130130677910.9564545.6362993.0962552.3761761.0861100.00611021Pr1361361058399.371021835.59995752.90979721.24975430.80967720.009677222Pr1441446486910.82621296.14602933.00589720.74586120.13585370.005853723Ch150150732512.2169746.8367243.0066592.0165790.7865280.00652824KroA1501502948811.17283286.80277204.51269521.61267110.71265240.002652425Pr1521528137810.44773504.98754922.46741620.65739150.32736820.007368226Rat195195268615.6324987.5323832.5824013.3623511.2123230.00232327D1981981782812.98168496.77166535.53162222.80160241.55157800.001578028KroA2002003279911.68312956.56302493.00310525.73298181.53295330.562936829Ts2252251389299.701332105.191294422.211291571.991283851.381266430.0012664330Pr2262268920711.00856496.57827612.98812791.13809900.77805450.228036931Pr2642645614014.26532898.45502052.18509453.68501782.12493250.394913532A280280288311.7928149.1126583.0627958.3826322.0625980.74257933Pr2992995301610.01514046.67495822.89491051.90485890.83483320.294819134Lin3183185021519.484717212.24453117.81458129.00453918.00437104.004202935Linhp3183184920119.004635612.12446538.00450669.00446538.00413450.004134536Rd4004001808418.341721512.66165038.00166569.00165038.00158924.001528137Pr43943912758819.0012008312.001157948.001169679.091159948.191118754.3410721738Si5355355725618.185526414.06523268.00528119.00523268.00503884.004845039U5745744391719.004113411.46398578.00402969.19397577.73369050.003690540Rat575575806019.00758612.0072156.5373839.0173558.5970143.566773Computational results on 40 examples of Table2 show that the classic PSO algorithm has been able to achieve BKS in WS, AS, and BS modes in only 7 small instances, but when the number of nodes increases, it cannot achieve BKS solutions with the same quality and loses its efficiency. Also, in the three examples Arr48, Eil51, and KroA100, although the algorithm in the BS mode has been able to achieve the BKS solutions, the BKS solutions have not been obtained in WS and AS modes. On the contrary, in the remaining 30 examples, which have a customer number of 76 and above, the algorithm in the WS mode has minimum and maximum errors from 3.34 to 19 percent. Besides, for BS and AS modes, it has better solutions so that, for the first criterion, it has minimum and maximum errors of 1.56 to 8 percent, and for the second criterion, it has errors between 0.67 and 14.06 percent. Therefore, it can be concluded that the algorithm in the classical mode is not of good quality and does not have the necessary stability to use routing problems. Also, the results of the proposed MPSO algorithm show that the algorithm has a very excellent performance, and in 16 examples, the last of which was Bier127, it has been able to have a very good stability and achieve BKS solutions in all three criteria. In other words, BKS answers in 14 other examples have been obtained by this algorithm for the BS mode, and in this case, in only 10 of the 40 examples, it has not been able to achieves to the BKS solutions that for a metaheuristic algorithm compared to other algorithms, and as you will see in the next table, it is a very high-quality solution. In this case, the Gaps change between 0.22 and 4.34, while for average AS answers, its values change between 0.13 and 8.59. Also, in the WS mode, the algorithm has the minimum and maximum Gaps from 0.33 to 9.19.To compare the answers obtained in Table2, Figures 5 and 6 have been used so that in Figure 5, the average of Gaps is shown for 40 instances, while in Figure 7, the average of the results obtained by the two algorithms for the AS mode is presented to compare their stabilities. It should be noted that, in Figure 5, the average Gaps for BS, AS, and WS are ascending, but usually because the best solutions of metaheuristic algorithms are compared in the BS mode, it can be seen that the average for PSO and MPSO algorithms is 3.28 and 0.55, respectively, which shows that the modifications of the classic version have increased the quality of the algorithm and obtained excellent answers. On the contrary, Figure 6 shows that only the stability of the solutions for the first four examples is the same for the two algorithms, both of which were able to achieve the best answers, but for the next 36 examples, the MPSO algorithm achieved the better solutions.Figure 5
The mean Gaps of the PSO and MPSO algorithms.Figure 6
Comparing the mean Gaps in the AS mode for PSO and MPSO.Figure 7
The mean Gaps of the algorithms.In Table3, 18 examples are intended to compare between the MPSO and the following seven algorithms, which have 24 to 200 nodes. In this table, the names of examples are shown in the second column and the best results obtained (BKS) in the last column. Also, the best results obtained by the mentioned algorithms are mentioned in other columns. It should be noted that since there are many TSP examples in literature, it is hard to find examples where all the algorithms have been implemented, so these 18 examples are considered in this table. In addition, the results of GA, BSO, and ACO + SEE algorithms are presented for four, five, and five instances, respectively, while the rest of the algorithms have been tested in a larger number of examples.The genetic algorithm (GA) [16]The particle swarm optimization (PSO) [17]The bee colony optimization (BCO) [18]The improved ACO with pheromone correction strategy (ACO + SEE) [19]The multi-agent reinforcement learning algorithm (MARL-2-opt) [20]The hybrid elitist-ant system (HEAS) [21]Table 3
Comparing the proposed PSO algorithm with other algorithms.
InstancenGAPSOBCOACO + SEEMARL-2-optHEASMPSOBKS1GR24241272—————127212722GR48485046—————504650463ATT4848——10661——1062810628106284Eil5151—4274284274274264264265Berlin5252—7542—754275427542754275426ST7070685——6756766756756757Eil7676—5405395465445385385388KroA10010021504212962176321282212822128221282212829KroB100100——22637—22237—221412214110KroC100100——20853———207492074911KroD100100——21643———212942129412KroE100100——22450———220682206813Eil101101——635—633—62962914Lin105105——15288—14412—143791437915KroA150150——27858—26862—265242652416KroB150150——26535—2646426185262542613017KroA200200—2956329961—2953829420295332936818KroB200200——30350———2950129437By comparing the results obtained in this table, it can be concluded that the proposed algorithm has been able to achieve more quality solutions than GA so that in two examples, St70 and KroA100 have increased the quality of the answers. On the contrary, in GR24 and GR48, the proposed algorithm has obtained the same solutions. Therefore, it can be concluded that although the GA algorithm has perfect performance for examples with small-size customer’s numbers, when the number of customers increases, the GA algorithm, unlike the MPSO algorithm, cannot maintain its performance and achieves lower quality solutions.The second algorithm that the results are compared with the proposed method is the PSO algorithm. This algorithm has been stable in the five examples that have been tested and has been able to obtain the solutions with less than one percent error. Although this algorithm has achieved the best solution so far in Berlin52 example, it has failed to respond with this accuracy in the remaining four examples. Also, in these four examples, the proposed algorithm has been able to obtain better solutions than this algorithm. Therefore, it can be concluded that the MPSO algorithm is more powerful than the PSO algorithm and has been able to escape from local optimal points. Comparing the proposed algorithm with the BCO algorithm, it can be seen that the BCO algorithm has only been able to obtain close solutions to the MPSO algorithm in Eil51 and Eil76 examples, and in the remaining 17 examples, the proposed algorithm has obtained much better solutions than this algorithm. It should be noted that the BCO algorithm in general is not efficient compared to other algorithms presented in this table, and in none of the examples, it has been able to achieve the BKS solutions.The proposed algorithm is completely superior to the ACO-SEE algorithm because compared to the five problems which the solutions of this algorithm are presented, the solutions of the two algorithms have the same only in two examples. Also, in three other examples, the proposed MPSO algorithm has been able to improve the quality of the solutions of this algorithm and achieve better solutions. Also, Marl-2-opt’s solutions are presented in 11 examples, which compared to the proposed algorithm solutions, have been able to achieve the same solutions in two examples. However, in nine other instances, this algorithm has not been able to achieve the quality of the MPSO solutions and has obtained worse solutions. The last algorithm in this table is compared to MPSO results is the HEAS algorithm, which has very good solutions compared to other metaheuristic algorithms. By comparing the results of this algorithm with the MPSO algorithm, it can be seen that this algorithm has been able to achieve a better solution than the proposed algorithm, although in another example, it has obtained a worse solution. Besides, these two algorithms have found the same solutions to the MPSO algorithm in six other examples.In Figure7, the average Gap for the results of the seven algorithms presented in Table 3 is shown in which the horizontal axis presents the names of the algorithms, and the average Gaps are shown in the vertical axis. In this figure, the weakest method is BCO, which has the average of 2.02 and has poor-quality solutions compared to the results of GA and MARL-2-opt algorithms because the average Gaps for these two algorithms are 0.63 and 0.54, respectively. On the contrary, the two algorithms PSO and ACO + SEE have very close answers and have an average of 0.33 and 0.34, respectively, which have obtained better answers than the previous three algorithms. Finally, HEAS and MPSO algorithms have the best solutions compared to the previous five algorithms that were able to achieve values of 0.05 and 0.07, which are outstanding results. It should be noted that the HEAS algorithm is presented in only eight examples in this table, and compared to the proposed algorithm, its results are not presented in ten examples. Therefore, it is not possible to provide a more accurate comparison between these two algorithms, and it can only be concluded that these two algorithms have found the best results between the seven algorithms in 18 examples of Table 3.In addition, the six solutions of the proposed algorithm are shown in Figure8. In these solutions, the algorithm has been able to achieve the best-known solutions.Figure 8
Some solutions obtained by MPSO.
(a)(b)


## 5. Conclusion and Future Works

A modified PSO algorithm called MPSO was used for solving the TSP problem in this paper. Also, to test the stability of the method, the worst, average, and best solutions are compared to the classic PSO in the number of standard problems which have a good range of customers. Since multiagent algorithms usually do not have a good performance in the intensification mechanism, the insert, exchange, 2-Opt, and inverse moves were used. Besides, some modifications were made to the PSO algorithm to better search the problem space and escape local optimum points. The results show the efficiency of the algorithm compared to other methods presented for the standard problems. For future tasks, this algorithm can be used to the vehicle routing and allocation problems because the efficiency of the algorithm grows when the number of customers of examples is increased, and the algorithm cannot be stable. Therefore, it is better to use the tabu search algorithm to increase the efficiency of the intensification mechanism. Also, finding a more efficient state for moving particles towardsgbest and pbest causes to increase the global search of the problem space. Finally, some of the most representative computational intelligence algorithms can be used to solve the TSP problem, like monarch butterfly optimization, earthworm optimization algorithm, elephant herding optimization, moth search algorithm, slime mould algorithm, and harris hawks optimization. The application of these ideas is postponed to other articles.



---

*Source: 6668345-2021-02-19.xml*