Optimal Path Determination Method for Traveling Salesman Problem Based on Hybrid Meta-Heuristic Algorithm
By applying a hybrid metaheuristic algorithm in the travel merchant problem, combining the random greed strategy, local search algorithm and a random exchange algorithm based on Hamming distance, the shortcomings of the gray wolf optimization algorithm in the discrete optimization problem are solved, and the accuracy and efficiency of the travel merchant's optimal path are significantly improved.
Patent Information
- Application Number
- CN202210121552.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-09
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-02-09
AI Technical Summary
In the prior art, the Gray Wolf Optimization Algorithm (GWO) is mainly used for continuous optimization problems, but it is not effective when solving discrete optimization problems, especially in the traveler problem (TSP).
A method for determining the optimal path of travel merchandise based on a hybrid meta heuristic algorithm is proposed. By constructing the travel merchandise problem, setting the number of wolves in the initial wolf pack, constructing the initial loop using a random greed strategy, calculating the path cost and selecting the optimal solution, combining the local search algorithm and a random exchange algorithm based on Hamming distance for iterative optimization, and finally obtaining the optimal path of the travel merchandise problem.
It significantly improves the acquisition accuracy of the travel provider's optimal path and the quality of the initial solution, and can obtain close to the optimal solution in a short time, improving the resolution efficiency of TSP problems.
Smart Images

Figure CN114611755B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of traveling salesman, and particularly relates to a method, a system, an electronic device and a storage medium for determining the optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm. Background Technique
[0002] The Traveling Salesman Problem (TSP) is a classic problem in the field of combinatorial optimization, and its core is to seek the minimum path cost for traversing all path planning demand points. The traveling salesman problem belongs to the category of NP-Complete. Currently, heuristic algorithms are often used for large-scale cases. Heuristic algorithms can obtain the optimal solution within a reasonable time and have the advantage of strong self-adaptability. A large number of classical heuristic algorithms have been proposed in recent years, such as Cuckoo Search (CS), Tabu Search (TS), Simulated Annealing (SA), Genetic Algorithm (GA), Ant Colony Optimization (ACO), Particle Swarm Optimization (PSO), Firefly Algorithm (FA), etc. By mixing the above basic algorithms with other algorithms, the optimal solution can be achieved within a limited time.
[0003] Among the existing heuristic algorithms, the Grey Wolf Optimizer (GWO) is a nature-inspired swarm intelligence algorithm. This algorithm was proposed by Mirjalili in 2014. Since its proposal, this algorithm has received extensive attention and has been applied to various fields. The Grey Wolf Optimizer simulates the social behavior of grey wolves catching prey. Grey wolves maintain their social hierarchy. The leader of the first leadership gradient is called wolf a; the leader of the second leadership gradient is called wolf b; the leader of the third leadership gradient is called wolf d; the remaining wolves are ordinary wolves without leadership, collectively called wolf w. During the hunting process, the wolves (a, b, d) in the first three leadership gradients guide the ordinary wolves (w) to update their positions.
[0004] GWO is well-known for solving continuous optimization problems in a short time, but it is not common to directly use GWO to solve discrete optimization problems. Therefore, there is little related work to improve GWO to make it an effective method for solving discrete optimization problems. As a very famous discrete optimization problem, the TSP problem, the present invention provides a new solution idea and solution for the TSP problem by improving GWO. Summary of the Invention
[0005] The present invention provides a method, system, electronic device and storage medium for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm to overcome at least one technical problem existing in the prior art.
[0006] To achieve the above object, the present invention provides a method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm, the method comprising:
[0007] Construct a traveling salesman problem and set the number N of wolves in the initial wolf pack;
[0008] Construct N initial circuits in the initial wolf pack through a random greedy strategy, and the N initial circuits are a combination of N initial solutions of N wolves;
[0009] Calculate the path cost of each initial solution, and select the combination of wolves corresponding to the initial solutions with the top three smallest path costs as the original optimal solution; wherein, the original optimal solution includes 3 alpha wolves, and the wolves other than the alpha wolves are ordinary wolves;
[0010] Iteratively update the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 alpha wolves;
[0011] Use the optimal solutions in the current round to perform iterative calculations on the wolf pack in the next round until the set number of iterations is reached, and obtain the top 3 optimal solutions in the last iteration, that is, 3 alpha wolves;
[0012] Obtain the solution represented by the first alpha wolf among the top 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem.
[0013] Further, preferably, before iteratively updating the wolf pack containing the original optimal solution through a local search algorithm, it further includes the step of optimizing the wolf pack containing the original optimal solution through a random exchange algorithm based on the Hamming distance; the optimization method includes:
[0014] Perform random exchange algorithm updates based on the Hamming distance between each ordinary wolf and the 3 alpha wolves respectively to obtain three update results corresponding to the current ordinary wolf;
[0015] Select the optimal solution of the current ordinary wolf among the three update results.
[0016] Further, preferably, perform a random exchange algorithm update based on the Hamming distance between each ordinary wolf X and an alpha wolf L to obtain an update result corresponding to the current ordinary wolf X; it includes:
[0017] Obtain the nodes where the traveling salesman sequences of the ordinary wolf X and the alpha wolf L are different as the nodes to be exchanged; and use the number of nodes to be exchanged as the Hamming distance;
[0018] Perform node swapping based on a random swapping mechanism on the switching nodes according to a preset number of times to obtain an updated result corresponding to the ordinary wolf X; wherein, the preset number of times is less than the Hamming distance.
[0019] Further, preferably, perform iterative update on the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, including:
[0020] Optimize the current ordinary wolf through the 2-opt local search algorithm;
[0021] Optimize the wolf pack through the 3-opt local search algorithm, and select the top 3 optimal solutions in the current round of iteration as 3 alpha wolves.
[0022] Further, preferably, optimize the wolf pack through the 3-opt local search algorithm to obtain 3 alpha wolves as the optimal solutions in the current round. The 3-opt local search algorithm is a fast 3-opt local search algorithm, including:
[0023] Perform local search on both the alpha wolves and the ordinary wolves;
[0024] If the length of three edges in the new solution is less than the length of three edges in the initial solution, then replace the initial solution with the new solution;
[0025] Obtain 3 alpha wolves in the new solution as the optimal solutions in the current round.
[0026] Further, preferably, construct N initial circuits of the traveling salesman in the initial wolf pack through a random greedy strategy, including:
[0027] Randomly select a city as the starting city of the traveling salesman problem, add the city to the solution of the traveling salesman problem, and mark the city as visited;
[0028] Among the unvisited cities, sort them in ascending order of the distance from the current city, and select the first RCL_size cities with the smallest distance to construct an RCL list; where RCL_size is a set parameter;
[0029] Randomly select a city in the RCL list, add the city to the solution of the traveling salesman problem, and mark the city as the visited city and the starting city;
[0030] Based on the starting city, update the RCL list and select the next city until all cities are visited to obtain a set of initial solutions;
[0031] Iterate the above steps N times to obtain N sets of initial solutions;
[0032] Take the N initial solutions as N wolves in the initial wolf pack to generate N initial circuits.
[0033] To solve the above problems, the present invention also provides a traveling salesman optimal path determination system based on a hybrid meta-heuristic algorithm, including:
[0034] A construction unit for constructing the traveling salesman problem and setting the number N of wolves in the initial wolf pack;
[0035] A calculation unit for constructing N initial circuits in the initial wolf pack through a random greedy strategy, where the N initial circuits are a combination of N initial solutions of N wolves; calculating the path cost of each initial solution, and selecting the combination of wolves corresponding to the initial solutions with the top three smallest path costs as the original optimal solution; wherein, the original optimal solution includes 3 alpha wolves, and the wolves other than the alpha wolves are ordinary wolves;
[0036] An iteration unit for iteratively updating the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 alpha wolves;
[0037] Performing wolf pack iterative calculation for the next round using the optimal solutions in the current round until the set number of iterations is reached, and obtaining the top 3 optimal solutions in the last iteration, that is, 3 alpha wolves;
[0038] An acquisition unit for acquiring the solution represented by the first alpha wolf among the top 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem.
[0039] Further, preferably, it further includes an optimization unit for respectively performing an update of a random exchange algorithm based on the Hamming distance between each ordinary wolf and the 3 alpha wolves to obtain three update results corresponding to the current ordinary wolf; and selecting the optimal solution of the current ordinary wolf from the three update results.
[0040] To solve the above problems, the present invention also provides an electronic device, which includes:
[0041] A memory storing at least one instruction; and
[0042] A processor for executing the instructions stored in the memory to implement the steps in the above-mentioned traveling salesman optimal path determination method based on a hybrid meta-heuristic algorithm.
[0043] To solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the above-mentioned traveling salesman optimal path determination method based on a hybrid meta-heuristic algorithm.
[0044] A method, system, electronic device, and storage medium for determining the optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm. By constructing the traveling salesman problem, the number of wolves N in the initial wolf pack is set; N initial circuits are constructed in the initial wolf pack through a random greedy strategy, and the N initial circuits are a combination of N initial solutions of N wolves; calculate the path cost of each initial solution, and select the combination of wolves corresponding to the three initial solutions with the smallest path costs as the original optimal solution; among them, the original optimal solution is three alpha wolves; perform iterative update on the wolf pack containing the original optimal solution through a local search algorithm to obtain the three optimal solutions in the current round, that is, three alpha wolves; use the optimal solutions in the current round to perform iterative calculation of the wolf pack in the next round until the set number of iterations is reached, and obtain the first three optimal solutions in the last iteration, that is, three alpha wolves; obtain the solution represented by the first alpha wolf among the first three optimal solutions in the last iteration as the optimal path of the traveling salesman problem. It has the technical effects of improving the quality of the initial solution and the accuracy of obtaining the optimal path of the traveling salesman. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0046] Figure 1 It is a flowchart of a method for determining the optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm provided by an embodiment of the present invention;
[0047] Figure 2 It is a schematic diagram of the principle of a method for determining the optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm provided by an embodiment of the present invention;
[0048] Figure 3 It is a schematic diagram of the principle of a random swap algorithm based on Hamming distance for implementing a method for determining the optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm provided by an embodiment of the present invention;
[0049] Figure 4 It is a schematic diagram of a traditional 3-opt local search method;
[0050] Figure 5 It is a comparison chart of PdBest and PdAvg of different algorithms in 9 examples of the present invention;
[0051] Figure 6 It is a comparison chart of Best and Average of different algorithms in 9 examples of the present invention;
[0052] Figure 7Schematic diagram of the logical structure of the traveling salesman optimal path determination system based on the hybrid meta-heuristic algorithm provided by an embodiment of the present invention;
[0053] Figure 8 Internal structure schematic diagram of an electronic device for implementing the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm provided by an embodiment of the present invention;
[0054] The implementation, functional characteristics and advantages of the present invention will be further described in conjunction with embodiments with reference to the accompanying drawings. Specific embodiments
[0055] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0056] Refer to Figure 1 As shown, it is a flowchart of the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm provided by an embodiment of the present invention. This method can be executed by a system, and the system can be implemented by software and / or hardware.
[0057] In this embodiment, the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm includes steps S110 to S150.
[0058] As Figure 1 shown, S110: Construct the traveling salesman problem and set the number N of wolves in the initial wolf pack; construct N initial circuits in the initial wolf pack through a random greedy strategy, and the N initial circuits are a combination of N initial solutions of N wolves. S120: Calculate the path cost of each initial solution, and select the wolf combination corresponding to the three initial solutions with the smallest path costs as the original optimal solution; among them, the original optimal solution includes 3 leading wolves, and the wolves other than the leading wolves are ordinary wolves. S130: Iteratively update the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 leading wolves. S140: Use the optimal solutions in the current round to perform the next round of wolf pack iterative calculation until the set number of iterations is reached, and obtain the top 3 optimal solutions in the last iteration, that is, 3 leading wolves. S150: Obtain the solution represented by the first leading wolf among the top 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem.
[0059] Figure 2 Schematic diagram of the principle of the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm provided by an embodiment of the present invention.
[0060] As Figure 2 shown, the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm mainly includes three links: the initial solution generation stage, the iterative update stage, and the solution acquisition stage.
[0061] In the initial solution generation stage, the traveling salesman problem is constructed, and the number of wolves N in the initial wolf pack is set; N initial circuits are constructed in the initial wolf pack through a random greedy strategy, and the N initial circuits are a combination of N initial solutions of N wolves; the path cost of each initial solution is calculated, and the combination of wolves corresponding to the first three smallest path costs among the initial solutions is selected as the original optimal solution; among them, the original optimal solution includes 3 alpha wolves, and the wolves other than the alpha wolves are ordinary wolves; the 3 alpha wolves are wolf a, wolf b, and wolf d.
[0062] In the iterative update stage, the wolf pack containing the original optimal solution is iteratively updated through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 alpha wolves; before the update, the HDRS method is designed and combined with the classical GWO algorithm to continuously optimize the accuracy of the obtained results; then, the local search algorithm is used to perform the iterative calculation of the optimal solution in the current round for the next round; and it is determined whether the set number of iterations is reached. If the set number of iterations is not reached, the iteration continues; if the set number of iterations is reached, the top 3 optimal solutions in the last iteration are obtained, that is, 3 alpha wolves. Among them, combined with the 2-opt local search algorithm, a set of high-quality initial solutions suitable for the TSP problem is calculated, laying a solid foundation for the subsequent optimization process; then the high-quality initial solutions are further optimized through the 3-opt local search algorithm. In the specific implementation process, in order to improve the optimization efficiency, the 3-opt local search algorithm can be improved into a fast 3-opt algorithm.
[0063] In the solution acquisition stage, the solution represented by the first alpha wolf among the top 3 optimal solutions in the last iteration is obtained as the optimal path of the traveling salesman problem.
[0064] In summary, the algorithm framework of the method for determining the optimal path of the traveling salesman based on the hybrid meta-heuristic algorithm includes the improved Greedy Randomized Adaptive Search Procedure (GRASP), the Hamming Distance with Randomized Swap (HDRS), the 2-opt local search algorithm, the fast 3-opt local search algorithm, and the GWO algorithm. A set of initial solutions is generated through the improved GRASP algorithm, and the solution is continuously optimized during the GWO hunting process through the HDRS method; then the initial solution is continuously optimized in combination with the 2-opt local search algorithm; finally, the solution is further optimized through the improved fast 3-opt method, and the design of the fast 3-opt algorithm can speed up the local search process compared with the traditional 3-opt algorithm.
[0065] The following specifically describes steps S110 to S150 of the method for determining the optimal path of the traveling salesman based on the hybrid meta-heuristic algorithm.
[0066] S110. Construct the traveling salesman problem and set the number N of wolves in the initial wolf pack; construct N initial circuits in the initial wolf pack through a random greedy strategy. The N initial circuits are a combination of N initial solutions of N wolves.
[0067] That is to say, under the constraint conditions, a predetermined number of initial solutions are constructed through the random greedy algorithm and added to the population corresponding to the information model. In the present invention, the population corresponding to the information model is the initial wolf pack. And the initial solution is the initial scheme of the path allocation of cities in the traveling salesman problem, that is, the route of the city sequence obtained through path allocation. An initial solution is a wolf in the GWO algorithm. Through the improved GRASP algorithm, N solutions can be assigned to N wolves to complete the initialization process of the wolf pack.
[0068] In order to improve the traditional random greedy adaptive search algorithm and apply it to obtain the traveling salesman problem. N initial circuits of the traveling salesman are constructed in the initial wolf pack through a random greedy strategy, including steps S111 to S116: S111. Randomly select a city as the departure city of the traveling salesman problem, add the city to the solution of the traveling salesman problem, and mark the city as visited; S112. Among the unvisited cities, sort them in ascending order of the distance from the current city, and select the first RCL_size cities with the smallest distance to construct the RCL list; where RCL_size is a set parameter; S113. Randomly select a city in the RCL list, add the city to the solution of the traveling salesman problem, and mark the city as the visited city and the departure city; S114. Update the RCL list and select the next city based on the departure city until all cities are visited to obtain a set of initial solutions; S115. Iterate the above steps N times to obtain N sets of initial solutions; S116. Use the N initial solutions as N wolves in the initial wolf pack to generate N initial circuits. That is to say, construct an initial circuit. This stage can be described as step-by-step, adding one element (city) to the partial solution at a time until the solution is complete.
[0069] It should be noted that the RCL list is used to store the best candidates during the path optimization process; the size of the RCL is restricted by a specified quantity parameter, that is, the RCL consists of RCL_size (where RCL_size is the size of the RCL) elements with the optimal cost. The RCL is constructed by selecting the first RCL_size cities that are the closest to the current city (reflecting the greediness of the algorithm) and have not been visited. Subsequently, a city is randomly selected from the RCL (reflecting the randomness of the algorithm), added to the solution, marked as visited, and marked as the current departure city. Subsequently, based on the current departure city, the above steps are repeated iteratively for subsequent RCL list updates and the selection process of the next city until all cities have been visited. In each iteration of the construction phase of the random greedy adaptive search algorithm, the relational structure among all elements also changes continuously and is continuously optimized. In this iterative manner, the quality of the feasible solution obtained will be better.
[0070] S120. Calculate the path cost of each initial solution, and select the wolf combination corresponding to the initial solution with the top three smallest path costs as the original optimal solution; among them, the original optimal solution includes 3 leading wolves, and the wolves other than the leading wolves are ordinary wolves.
[0071] The Grey Wolf Optimizer (GWO) is a nature-inspired swarm intelligence algorithm. The Grey Wolf Optimizer simulates the social behavior of grey wolves capturing prey. Grey wolves maintain their social hierarchy. The leader of the first leadership gradient is called wolf a; the leader of the second leadership gradient is called wolf b; the leader of the third leadership gradient is called wolf d; the remaining wolves are ordinary wolves without leadership, collectively referred to as wolf w. During the hunting process, the wolves in the first three leadership gradients (a, b, d) guide the ordinary wolves (w) to update their positions.
[0072] Before iteratively updating the wolf pack containing the original optimal solution through the local search algorithm, it also includes the step of optimizing the wolf pack containing the original optimal solution through the random exchange algorithm based on the Hamming distance; the optimization method includes steps S121 - S122: S121. Perform the update of the random exchange algorithm based on the Hamming distance between each ordinary wolf and the 3 leading wolves respectively to obtain three update results corresponding to the current ordinary wolf; S122. Select the optimal solution of the current ordinary wolf from the three update results.
[0073] Figure 3 Schematic diagram of the principle of the random exchange algorithm based on the Hamming distance for implementing the method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm provided in an embodiment of the present invention.
[0074] Specifically, each ordinary wolf X is updated with a head wolf L using the Hamming Distance with Randomized Swap (HDRS) algorithm to obtain an updated result corresponding to the current ordinary wolf X. The process includes: obtaining the nodes where the traveling salesman sequence of the ordinary wolf X is different from that of the head wolf L as the nodes to be swapped; and taking the number of nodes to be swapped as the Hamming Distance (HD). The nodes to be swapped are swapped based on a randomized swap mechanism for a preset number of times to obtain an updated result corresponding to the ordinary wolf X. Here, the preset number is less than the Hamming distance. That is to say, the Hamming Distance with Randomized Swap algorithm is designed and applied in the solution process of the Grey Wolf Optimization algorithm.
[0075] In the wolf pack optimization algorithm based on the Hamming distance, the moving distance that the ordinary wolf X is attracted by the head wolf L (including wolf a, wolf b, and wolf d) can be defined as Random[1, HD(X, L)], that is, a random number between 1 and the Hamming distance between the two. When the value is large, the moving pace of the population is fast, and vice versa.
[0076] Taking the TSP problem of 7 cities as an example, if there are two feasible solutions X1 = [2, 1, 3, 5, 6, 4, 7] and X2 = [2, 5, 4, 3, 6, 1, 7], then the Hamming distance between the two solutions is 4. If the two solutions are regarded as two wolf packs, one wolf pack needs to move 4 units of Hamming distance to reach the other wolf pack, that is, the Hamming distance is 4, denoted as HD(X1, X2) = 4. Using the Randomized Swap (RS) mechanism, the values of two nodes in the TSP sequence are randomly swapped. For example, the original sequence is [2, 3, 1, 4], and 1 and 2 in the sequence are randomly swapped, and the swapped sequence is [1, 3, 2, 4]. The HDRS method designed in the present invention combines the HD and RS mechanisms to iteratively update the ordinary wolf pack in the GWO, that is, to optimize the TSP solution. For example, the ordinary wolf X1 = [2, 1, 3, 5, 6, 4, 7] is attracted by the head wolf X2 = [2, 5, 4, 3, 6, 1, 7], and the moving step size is 2, that is, the subsequent swap operations are randomly performed twice, and this moving step size can be calculated by Random[1, HD(X1, X2)] in the above steps.
[0077] The specific swapping process is as Figure 3As shown, first, a position is randomly selected, where X1 and X2 have different values. At this time, a second position is selected. The value of X1 at the second position is 1, and the value of X2 at the second position is 5. Subsequently, the 1 and 5 in X1 are obtained for calculation, and the first exchange is completed at this time. Subsequently, based on the same principle, the third position is also adjusted. At this time, X1 = [2, 5, 4, 1, 6, 3, 7].
[0078] In summary, the process of solving the traveling salesman problem is divided into two stages. In the first stage, an initial circuit is constructed through a random greedy strategy. This stage can be described as step-by-step, adding one element to the partial solution one by one until the solution is complete. In the second stage, first, the initial solution is updated a preset number of times using a random exchange algorithm based on the Hamming distance, and then, as in step S130, a local search algorithm is used to further iteratively adjust and optimize the updated initial solution to find a better solution.
[0079] S130. Iteratively update the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 leading wolves.
[0080] The local search algorithm can select a 2-opt local search algorithm or a 3-opt local search algorithm according to actual needs. Through local search, the iterative local search main framework continuously fills the optimal solutions into the path pool during iteration.
[0081] In a specific embodiment, iteratively updating the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round includes steps S131 to S132: S131. Optimize the current ordinary wolf through a 2-opt local search algorithm; S132. Optimize the wolf pack through a 3-opt local search algorithm, and select the top 3 optimal solutions in the current round of iteration as 3 leading wolves. That is, optimize the ordinary wolves in the current initial solution through a 2-opt local search algorithm; then, optimize the optimized ordinary wolves and leading wolves using the traditional 3-opt local search algorithm.
[0082] The traditional 3-opt algorithm is similar to the 2-opt algorithm. The core idea of the 3-opt algorithm is to delete three edges in the route and reconnect the route with three other shorter edges, so that the length of the new TSP route obtained is shorter than that of the TSP route before modification. Until all points have been modified, the generated route is the solution of the algorithm.
[0083] Optimize the wolf pack through the 3-opt local search algorithm to obtain 3 alpha wolves as the optimal solution for the current round. To further improve the optimization efficiency, the 3-opt local search algorithm is the fast 3-opt local search algorithm, which includes the following steps: S1321. Conduct local search on both alpha wolves and ordinary wolves; S1322. If the length of three edges in the new solution is less than the length of the three edges in the initial solution, replace the initial solution with the new solution; S1323. Obtain 3 alpha wolves in the new solution as the optimal solution for the current round.
[0084] Figure 4 It is a schematic diagram of the traditional 3-opt local search method. As Figure 4 shown, there are 7 possibilities for the 3-opt exchange algorithm. Among these 7 possibilities, it includes both the exchange of two edges (such as Figure 4 (b), (c), (d) in Figure 4 ) and the exchange of three edges ([[]] Figure 4 (e), (f), (g), (h) in Figure 4 ). Since the case of exchanging two edges in the 3-opt algorithm can be covered by 2-opt, in order to improve the computational efficiency of the 3-opt algorithm, this case of exchanging two edges is not considered in the algorithm design. That is to say, in the fast 3-opt local search method of the present invention, only the case of exchanging three edges is retained (such as Figure 4 (e), (f), (g), (h) in Figure 4 ); while the case of exchanging two edges is deleted (such as Figure 4 (b), (c), (d) in
[0085] Specifically, the fast 3-opt local search method is designed for three non-adjacent edges. If the length of the updated three edges is less than the original length, then exchange the three edges. For example, if the updated edge situation is as shown in Figure 4 (e) in
[0086] and dis(o1,p2)+dis(o2,d1)+dis(d2,p1)<dis(o1,d1) +dis(o2,d2)+dis(p1,p2), at this time, the fast 3-opt method obtains a better solution through neighborhood search, then update the original solution, and update the original TSP path [o1,o2,d1,d2,p1,p2] to [o1,d1,o2,p1,d2,p2].
[0086] S140. Use the optimal solution of the current round to perform the next round of wolf pack iterative calculation until the set number of iterations is reached, and obtain the first 3 optimal solutions of the last iteration, that is, 3 alpha wolves. During the iterative optimization process, it is necessary to determine whether the set number of iterations is reached. If the set number of iterations is not reached, continue the iteration; if the set number of iterations is reached, the current iteration is the last iteration, and obtain the first 3 optimal solutions of the last iteration, that is, 3 alpha wolves.
[0087] S150. Obtain the solution represented by the first alpha wolf among the top 3 optimal solutions of the last iteration as the optimal path of the traveling salesman problem. That is to say, the top 3 optimal solutions obtained in the last iteration still include three alpha wolves, and only the sequence of cities represented by the first alpha wolf is taken as the solution of the current traveling salesman problem.
[0088] That is to say, the method for determining the optimal path of the traveling salesman based on the hybrid meta-heuristic algorithm of the present invention is as follows: First, set the number N of wolves in the initial wolf pack, and the number of wolves is the number of solutions in the traveling salesman. By improving the GRASP algorithm, the initial solution of the TSP is calculated. An initial solution is a wolf in the GWO algorithm. Through the improved GRASP algorithm, the present invention can assign N solutions to N wolves to complete the initialization process of the wolf pack. Calculate the path cost of each solution, and select the solutions with the top three smallest path costs as the three alpha wolves, namely wolf a, wolf b, and wolf d. Perform 3 times of HDRS updates on each ordinary wolf w with the three alpha wolves (a, b, d) respectively by the HDRS method, that is, r1 = HDRS(a, w); r2 = HDRS(b, w); r3 = HDRS(d, w), and then select an optimal solution from the 3 results {r1, r2, r3} as the current ordinary wolf w; perform 2-opt local search optimization on the ordinary wolf w. Perform fast 3-opt local search optimization on the wolf pack (including alpha wolves). Select 3 optimal solutions as wolf a, wolf b, and wolf d after this update. Iteratively execute the above steps until the set number of iterations is reached. The solution represented by alpha wolf a in the last iteration is the optimal solution calculated by the hybrid meta-heuristic algorithm GRASP-HDRS-GWO.
[0089] In the specific implementation process, in order to illustrate the performance of the method for determining the optimal path of the traveling salesman based on the hybrid meta-heuristic algorithm of the present invention under different TSP scales, TSP instances with 100 to 439 nodes are selected from TSPLIB for calculation. The comparison results of the algorithm with 8 other heuristic algorithms on 9 TSP instances are shown in Table 1; among them, the 9 TSP instances are KroE100, Pr136, KroB100, Pr144, KroC100, Pr152, Pr124, Pr439, Pr107 respectively. These 8 algorithms are GA, IDGA, BA, IBA, ESA, DFA, DICA, DGWO; the article sources of the 8 heuristic algorithms are as follows:
[0090] GA algorithm: J. Grefenstette, R. Gopal, B. Rosmaita, D. Van Gucht, Genetic algorithms for the traveling salesman problem, in: Proceedings of the first International Conference on Genetic Algorithms and their Applications, Vol. 160, 1985, pp. 160–168;
[0091] IDGA algorithm: E. Alba, J. M. Troya, et al., A survey of parallel distributed genetic algorithms, Complexity 4(4)(1999)31–52;
[0092] BA algorithm, IBA algorithm: X.-S. Yang, A new metaheuristic bat-inspired algorithm, in: Nature inspired cooperative strategies for optimization (NICSO2010), 2010, pp. 65–74;
[0093] ESA algorithm: P. P. Yip, Y.-H. Pao, Combinatorial optimization with use of guided evolutionary simulated annealing, IEEE Transactions on neural networks 6(2)(1995)290–295.;
[0094] DFA algorithm: X.-S. Yang, Firefly algorithms for multimodal optimization, in: International symposium on stochastic algorithms, 2009, pp. 169–178;
[0095] DICA algorithm: E. Atashpaz - Gargari, C. Lucas, Imperialist competitive algorithm: an algorithm for optimization inspired by imperialistic competition, in: 2007 IEEE congress on evolutionary computation, 2007, pp. 4661–4667;
[0096] DGWO algorithm: K. Panwar, K. Deep, Discrete grey wolf optimizer for symmetric travelling salesman problem, Applied Soft Computing 105 (2021) 107298.
[0097] As shown in Table 1, 20 runs were provided for each instance. Through the results of the 20 runs, the Best and Average results were obtained. The Best result is to select the best one from 20 optimal results, and the Average result is the average of 20 times. The performance of the algorithm can be evaluated by PdBest(%) and PdAvg(%).
[0098] Table 1 Comparison table of the method for determining the optimal path of the traveling salesman based on the hybrid meta - heuristic algorithm of the present invention and 8 heuristic algorithms;
[0099]
[0100]
[0101] The explanations of the element names in the table are as follows:
[0102] Instance(Optimal): Represents the historically optimal result of a certain instance. For example, KroE100(22068) represents that the optimal value calculated by various algorithms in the history for the KroE100 case is 22068;
[0103] Method: Represents the algorithm used at this time. For example, GA represents that the GA algorithm is used for calculation at this time;
[0104] Best: Represents the optimal value calculated by the current algorithm;
[0105] Average: Represents the average value calculated by the current algorithm;
[0106] The formulas for PdBest(%) and PdAvg(%) are as follows:
[0107]
[0108]
[0109] As can be seen from Table 1, the optimal path determination method for the traveling salesman problem based on the hybrid meta-heuristic algorithm of the present invention has better Best results than other algorithms in all instances except for instance KroE100, and also has better Average results than other algorithms in all instances. The corresponding PdBest(%) and PdAvg(%) are calculated for each algorithm, and the algorithm performance can be evaluated by PdBest(%) and PdAvg(%).
[0110] The optimal path determination method for the traveling salesman problem based on the hybrid meta-heuristic algorithm of the present invention is compared with 8 existing heuristic algorithms, and the PdBest(%) and PdAvg(%) graphs of different algorithms for 9 instances are obtained. Figure 5 and Figure 6 The comparison results are described as a whole; among them, Figure 5 is the comparison graph of PdBest and PdAvg of different algorithms in 9 instances of the present invention; Figure 6 is the comparison graph of Best and Average of different algorithms in 9 instances of the present invention. As Figure 5 and Figure 6 shown, the performance of the optimal path determination method for the traveling salesman problem based on the hybrid meta-heuristic algorithm of the present invention is significantly better than other comparison algorithms.
[0111] In summary, for the optimal path determination method for the traveling salesman problem based on the hybrid meta-heuristic algorithm of the present invention, compared with other hybrid meta-heuristic algorithms, the present invention uses an improved GRASP algorithm to generate the initial solution, which improves the quality of the initial solution and lays a foundation for the subsequent optimization process. In addition, the 2-opt and 3-opt local optimization methods continuously optimize the solution of the TSP to find a better solution. To improve the optimization efficiency, the present invention designs a fast 3-opt optimization method. Finally, the present invention designs the HDRS method and applies this method to the GWO algorithm. The HDRS method plays an important role in improving the result accuracy of the TSP. The method proposed by the present invention can significantly improve the time efficiency and result accuracy of obtaining the TSP problem.
[0112] As Figure 7As shown in the figure, the present invention provides a traveling salesman optimal path determination system 700 based on a hybrid metaheuristic algorithm, and the present invention can be installed in an electronic device. According to the functions achieved, the traveling salesman optimal path determination system 700 based on the hybrid metaheuristic algorithm may include a construction unit 710, a calculation unit 720, an iteration unit 730, and an acquisition unit 740. The units of the present invention may also be referred to as modules, which refer to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, and are stored in the memory of the electronic device.
[0113] In this embodiment, the functions of each module / unit are as follows:
[0114] The construction unit 710 is used to construct the traveling salesman problem and set the number N of wolves in the initial wolf pack.
[0115] The calculation unit 720 is used to construct N initial circuits in the initial wolf pack by a random greedy strategy, where the N initial circuits are a combination of N initial solutions of N wolves; calculate the path cost of each initial solution, and select the combination of wolves corresponding to the initial solutions with the top three smallest path costs as the original optimal solution; wherein, the original optimal solution includes 3 alpha wolves, and the wolves other than the alpha wolves are ordinary wolves.
[0116] The iteration unit 730 is used to iteratively update the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 alpha wolves; use the optimal solutions in the current round to perform iterative calculations on the wolf pack in the next round until the set number of iterations is reached, and obtain the top 3 optimal solutions in the last iteration, that is, 3 alpha wolves.
[0117] The acquisition unit 740 is used to acquire the solution represented by the first alpha wolf among the top 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem.
[0118] As an improvement of this embodiment, it further includes an optimization unit (not shown in the figure), which is used to perform an update of the random exchange algorithm based on the Hamming distance between each ordinary wolf and the 3 alpha wolves respectively to obtain three update results corresponding to the current ordinary wolf; select the optimal solution of the current ordinary wolf from the three update results.
[0119] The traveling salesman optimal path determination system 700 based on the hybrid metaheuristic algorithm of the present invention uses an improved GRASP algorithm to generate initial solutions, improving the quality of the initial solutions and laying a foundation for subsequent optimization processes; uses the HDRS method to improve the accuracy of the TSP results, and continuously optimizes the solutions of the TSP through 2-opt and 3-opt local optimization methods to find better solutions. It achieves the technical effect of significantly improving the time efficiency and result accuracy of obtaining the TSP problem.
[0120] As shown Figure 8 in the figure, the present invention provides an electronic device 8 for a method of determining an optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm.
[0121] The electronic device 8 may include a processor 80, a memory 81, and a bus, and may also include a computer program stored in the memory 81 and executable on the processor 80, such as a program 82 for determining an optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm. The memory 81 may also include both an internal storage unit of the system for determining an optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm and an external storage device. The memory 81 can be used not only to store application software installed on the electronic device and various types of data, such as the code of the program for determining an optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm, but also to temporarily store data that has been output or will be output.
[0122] Among them, the memory 81 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disks, multimedia cards, card-type memories (such as SD or DX memories, etc.), magnetic memories, magnetic disks, optical disks, etc. The memory 81 may be an internal storage unit of the electronic device 8 in some embodiments, such as the mobile hard disk of the electronic device 8. The memory 81 may also be an external storage device of the electronic device 8 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the electronic device 8. The memory 81 can be used not only to store application software installed on the electronic device 8 and various types of data, such as the code of the program for determining an optimal path of a traveling salesman based on a hybrid meta-heuristic algorithm, but also to temporarily store data that has been output or will be output.
[0123] In some embodiments, the processor 80 may be composed of an integrated circuit. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple packaged integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 80 is the control core (Control Unit) of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. By running or executing programs or modules stored in the memory 81 (such as the traveling salesman optimal path determination program based on a hybrid meta-heuristic algorithm, etc.), and by calling the data stored in the memory 81, it performs various functions of the electronic device 8 and processes data. The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is set to enable connection and communication between the memory 81 and at least one processor 80, etc.
[0124] Figure 8 Only the electronic device with components is shown. Those skilled in the art can understand that Figure 8 The shown structure does not constitute a limitation on the electronic device 8. It may include fewer or more components than shown, or combine certain components, or have a different component arrangement.
[0125] For example, although not shown, the electronic device 8 may further include a power source (such as a battery) for powering each component. Preferably, the power source may be logically connected to the at least one processor 80 through a power management system, thereby implementing functions such as charge management, discharge management, and power consumption management through the power management system. The power source may also include any components such as one or more DC or AC power sources, a recharge system, a power failure detection circuit, a power converter or inverter, a power status indicator, etc. The electronic device 8 may also include various sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.
[0126] Furthermore, the electronic device 8 may further include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to establish a communication connection between the electronic device 8 and other electronic devices.
[0127] Optionally, the electronic device 8 may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an organic light-emitting diode (OLED), etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display the information processed in the electronic device 8 and to display a visual user interface.
[0128] It should be understood that the above embodiments are only for illustration purposes and are not limited by this structure in the scope of the patent application.
[0129] The traveling salesman optimal path determination program 82 based on the hybrid meta-heuristic algorithm stored in the memory 81 of the electronic device 8 is a combination of multiple instructions. When running in the processor 80, it can implement: constructing the traveling salesman problem and setting the number N of wolves in the initial wolf pack; constructing N initial circuits in the initial wolf pack through a random greedy strategy, where the N initial circuits are a combination of N initial solutions of N wolves; calculating the path cost of each initial solution, and selecting the combination of wolves corresponding to the first three smallest path costs as the original optimal solution; where the original optimal solution includes 3 lead wolves, and the wolves other than the lead wolves are ordinary wolves; iteratively updating the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 lead wolves; using the optimal solutions in the current round for the next round of wolf pack iterative calculation until the set number of iterations is reached, and obtaining the top 3 optimal solutions in the last iteration, that is, 3 lead wolves; obtaining the solution represented by the first lead wolf among the top 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem, that is, the solution of the traveling salesman problem.
[0130] Specifically, for the specific implementation method of the above instructions by the processor 80, reference may be made to Figure 1 the description of the relevant steps in the corresponding embodiments, which will not be elaborated here. It should be emphasized that to further ensure the privacy and security of the above traveling salesman optimal path determination program based on the hybrid meta-heuristic algorithm, the traveling salesman optimal path determination data based on the hybrid meta-heuristic algorithm is stored in the nodes of the blockchain where the server cluster is located.
[0131] Furthermore, if the modules / units integrated in the electronic device 8 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium may include: any entity or system that can carry the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disc, a computer memory, a read-only memory (ROM).
[0132] An embodiment of the present invention also provides a computer-readable storage medium. The storage medium may be non-volatile or volatile. The storage medium stores a computer program, and when the computer program is executed by a processor, it realizes: constructing a traveling salesman problem, and setting the number N of wolves in the initial wolf pack; constructing N initial circuits in the initial wolf pack through a random greedy strategy, and the N initial circuits are a combination of N initial solutions of N wolves; calculating the path cost of each initial solution, and selecting the combination of wolves corresponding to the first three smallest path costs as the original optimal solution; wherein the original optimal solution includes 3 leading wolves, and the wolves other than the leading wolves are ordinary wolves; iteratively updating the wolf pack containing the original optimal solution through a local search algorithm to obtain the first 3 optimal solutions in the current round, that is, 3 leading wolves; using the optimal solutions in the current round for the wolf pack iterative calculation in the next round until the set number of iterations is reached, and obtaining the first 3 optimal solutions in the last iteration, that is, 3 leading wolves; obtaining the solution represented by the first leading wolf among the first 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem.
[0133] Specifically, for the specific implementation method when the computer program is executed by the processor, reference may be made to the description of the relevant steps in the method for determining the optimal path of the traveling salesman based on the hybrid meta-heuristic algorithm in the embodiment, which will not be elaborated here.
[0134] In several embodiments provided by the present invention, it should be understood that the disclosed devices, systems and methods can be implemented in other ways. For example, the system embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0135] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, in each embodiment of the present invention, each functional module may be integrated into one processing unit, may exist physically as individual units, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware, or in the form of a combination of hardware and software functional modules.
[0137] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms.
[0138] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be construed as limiting the claims involved.
[0139] The blockchain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, etc.
[0140] In addition, obviously, the word "including" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or systems stated in the system claims may also be implemented by one unit or system through software or hardware. Words such as "second" are used to denote names and do not denote any particular order.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not restrictive. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm, characterized in that, it includes: Construct a traveling salesman problem and set the number N of wolves in the initial wolf pack; Construct N initial circuits in the initial wolf pack through a random greedy strategy, and the N initial circuits are a combination of N initial solutions of N wolves; Calculate the path cost of each initial solution, and select the combination of wolves corresponding to the initial solutions with the top three smallest path costs as the original optimal solution; among them, the original optimal solution includes 3 leading wolves, and the wolves other than the leading wolves are ordinary wolves; Iteratively update the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, that is, 3 leading wolves; Use the optimal solutions in the current round to perform iterative calculations on the wolf pack in the next round until the set number of iterations is reached, and obtain the top 3 optimal solutions in the last iteration, that is, 3 leading wolves; Obtain the solution represented by the first leading wolf among the top 3 optimal solutions in the last iteration as the optimal path of the traveling salesman problem; Before iteratively updating the wolf pack containing the original optimal solution through a local search algorithm, it also includes the step of optimizing the wolf pack containing the original optimal solution through a random exchange algorithm based on the Hamming distance; where the moving step size is the moving distance Random[1, HD(X, L)] obtained by the ordinary wolf X being attracted by the leading wolf L; Random[1, HD(X, L)] is a random number from 1 to the Hamming distance between the two.
2. The method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm according to claim 1, characterized in that, the optimization method includes: Perform random exchange algorithm updates based on the Hamming distance between each ordinary wolf and the 3 leading wolves respectively to obtain three update results corresponding to the current ordinary wolf; Select the optimal solution of the current ordinary wolf from the three update results.
3. The method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm according to claim 2, characterized in that, Perform random exchange algorithm updates based on the Hamming distance between each ordinary wolf X and a leading wolf L to obtain an update result corresponding to the current ordinary wolf X; including: Obtain the nodes where the traveling salesman sequence of the ordinary wolf X is different from the traveling salesman sequence of the leading wolf L as the nodes to be exchanged; and use the number of the nodes to be exchanged as the Hamming distance; Perform node exchanges based on a random exchange mechanism on the nodes to be exchanged according to a preset number of times to obtain an update result corresponding to the ordinary wolf X; where the preset number of times is less than the Hamming distance.
4. The method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm according to claim 1, characterized in that, Iteratively update the wolf pack containing the original optimal solution through a local search algorithm to obtain the top 3 optimal solutions in the current round, including: Optimize the current ordinary wolf through a 2-opt local search algorithm; Optimize the wolf pack through a 3-opt local search algorithm, and select the top 3 optimal solutions in the current round of iteration as 3 leading wolves.
5. The method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm according to claim 2, It is characterized in that the wolf pack is optimized by the 3-opt local search algorithm to obtain 3 leading wolves as the first 3 optimal solutions in the current round. The 3-opt local search algorithm is a fast 3-opt local search algorithm, including: performing local search on both the leading wolves and ordinary wolves; if the lengths of three edges in the new solution are less than those of the three edges in the initial solution, then replacing the initial solution with the new solution; obtaining 3 leading wolves in the new solution as the optimal solutions in the current round.
6. The method for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm according to claim 1, it is characterized in that constructing N initial circuits of the traveling salesman in the initial wolf pack by a random greedy strategy, including: randomly selecting a city as the starting city of the traveling salesman problem, adding the city to the solution of the traveling salesman problem, and marking the city as visited; in the unvisited cities, sorting them in ascending order of the distance from the current city, and selecting the first RCL_size cities with the smallest distances to construct an RCL list; where the RCL_size is a set parameter; randomly selecting a city in the RCL list, adding the city to the solution of the traveling salesman problem, and marking the city as the visited city and the starting city; updating the RCL list and selecting the next city based on the starting city until all cities are visited, obtaining a set of initial solutions; iterating the above steps N times to obtain N sets of initial solutions; taking the N initial solutions as N wolves in the initial wolf pack to generate N initial circuits.
7. A system for determining the optimal path of a traveling salesman based on a hybrid metaheuristic algorithm, it is characterized in that including: a construction unit for constructing the traveling salesman problem and setting the number N of wolves in the initial wolf pack; a calculation unit for constructing N initial circuits in the initial wolf pack by a random greedy strategy, where the N initial circuits are a combination of N initial solutions of N wolves; calculating the path cost of each initial solution, and selecting the combination of wolves corresponding to the first three initial solutions with the smallest path costs as the original optimal solution; where the original optimal solution includes 3 leading wolves, and the wolves other than the leading wolves are ordinary wolves; an iteration unit for iteratively updating the wolf pack containing the original optimal solution by a local search algorithm to obtain the first 3 optimal solutions in the current round, that is, 3 leading wolves; using the optimal solutions in the current round to perform iterative calculations on the wolf pack in the next round until the set number of iterations is reached, and obtaining the first 3 optimal solutions in the last iteration, that is, 3 leading wolves; an optimization unit for respectively updating each ordinary wolf and the 3 leading wolves by a random exchange algorithm based on the Hamming distance to obtain three update results corresponding to the current ordinary wolf; selecting the optimal solution of the current ordinary wolf from the three update results; where the moving step size is the moving distance Random[1,HD(X,L)] obtained by the ordinary wolf X being attracted by the leading wolf L; Random[1,HD(X,L)] is a random number from 1 to the Hamming distance between the two. An acquisition unit is configured to acquire the solution represented by the first leading wolf among the top 3 optimal solutions of the last iteration as the optimal path of the traveling salesman problem.
8. An electronic device, characterized in that, the electronic device includes: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the steps in the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, it implements the traveling salesman optimal path determination method based on the hybrid meta-heuristic algorithm as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Path planning method based on grey wolf algorithm
CN110675004A