Panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm
By combining a hybrid optimization algorithm with simulated annealing and whale algorithm, the optimization problem of panoramic multi-dimensional routing in multiple devices and multi-communication modes is solved, normalization of communication flow and efficient utilization of resources are achieved, and communication efficiency and stability are improved.
Patent Information
- Application Number
- CN202510168503.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-05-30
AI Technical Summary
At this stage, panoramic multi-dimensional routing is difficult to achieve effective routing optimization when facing multi-device and multi-communication methods, resulting in the inability to normalize communication flows, increase resource consumption, and decrease communication efficiency and stability.
A hybrid optimization algorithm (SA-WOA) based on simulated annealing and whale algorithm is adopted to optimize panoramic multi-dimensional routing through the combination of simulated annealing mechanism and whale algorithm. This method includes initializing whale populations and parameters, establishing a hybrid optimization algorithm that integrates simulated annealing mechanism and whale algorithm, continuously reducing the temperature and updating the optimal routing path during the iteration process.
Effectively manage routing problems under multi-device and multi-communication modes, realize normalization of communication flow, reduce resource consumption, and improve overall communication efficiency and stability.
Smart Images

Figure CN120075115A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of routing planning, and in particular to a panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm. Background Art
[0002] With the rapid development of mobile communication technology and intelligent devices, the scale of the network continues to expand, and people's demand for communication networks is increasing day by day, making higher requirements for the performance of the network; routing optimization of the network is a problem that must be solved at present. The goal of routing optimization is to select the optimal communication path in the communication network to maximize the quality and efficiency of communication; and the main role of panoramic multi-dimensional routing is to connect multiple networks and achieve optimal path transmission of data. As an advanced network technology, the core function of panoramic multi-dimensional routing is to be able to connect multiple networks, including home networks, enterprise networks, and external Internet, etc. This connection not only realizes the interconnection and interoperability between networks, but also makes the data transmission between different networks efficient and reliable. However, at present, the number of live working digital devices is increasing, the data communication methods are complex, and the communication flow cannot be normalized. Therefore, there is an urgent need for a method to optimize panoramic multi-dimensional routing. Summary of the Invention
[0003] The present invention provides a panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm, which can effectively manage routing problems under multiple devices and multiple communication methods, realize the normalization of communication flow, reduce resource consumption, and improve the overall communication efficiency and stability.
[0004] To achieve the above object, the present invention is implemented by the following technical solutions:
[0005] A panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm includes the following steps:
[0006] S1. Initialize the whale population and parameters, and calculate the cost function of each whale Whale;
[0007] S2. Establish a SA-WOA hybrid optimization algorithm that combines the simulated annealing mechanism and the whale algorithm: in each iteration, the whale algorithm WOA updates the position by simulating the behavior of the whale Whale surrounding the prey and pouncing on the prey, and the simulated annealing SA determines whether to accept the new solution through the acceptance criterion, and accepts a worse solution with a probability to avoid local optimum;
[0008] S3. Continuously reduce the temperature during the iteration process, and update the best routing path, and output the optimal routing path after reaching the maximum number of iterations.
[0009] Further, the parameters in step S1 include the initial temperature T 0, cooling rate α, maximum number of iterations MaxIter, and population size M, where the cooling rate α ranges from 0.8 to 0.99.
[0010] Furthermore, the formula for calculating the cost function of each whale Whale is:
[0011]
[0012] where S i is the initial solution, i = 1, 2,..., M, representing the routing path of the i-th whale; C(S i ) is the cost function of each solution S i ; Si j and Si j+1 are adjacent nodes in the path, distance(Si j , Si j+1 ) is the distance between adjacent nodes in the path, and distance(Si n , Si 1 ) is the distance from the last node back to the starting point.
[0013] Furthermore, the calculation of the new solution in step S2 includes the following steps:
[0014] 1) Generate random variables r1, r2 ∈ [0, 1] for controlling the behavior of whales
[0015] 2) Generate random variables a, c ∈ [-1, 1] for adjusting the step size and direction of whale position update
[0016] 3) Calculate the distance adjustment value between the current whale position S i and the current optimal solution S best
[0017]
[0018] where a is a random variable, ranging from [-1, 1], used to adjust the scaling ratio of the distance, introducing randomness;
[0019] 4) Calculate the new solution S′ i :
[0020] If r1 < 0.5:
[0021] Otherwise:
[0022] where S best is the best routing path of the current group, that is, the routing path with the minimum cost function; A is the variable for narrowing the range during the iteration process.
[0023] Further, the receiving criterion is for the new solution S′ i , calculate its cost function C(S′ i ), calculate the cost function difference ΔC, and use the acceptance criterion of simulated annealing to decide whether to accept the new solution S′ i , if ΔC < 0 (that is, the new solution is better), then accept the new solution: S i = S′ i , otherwise, accept a worse solution with a certain probability.
[0024] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0025] The present invention combines the advantages of simulated annealing SA and whale optimization algorithm WOA. The SA-WOA algorithm can perform global optimization search in a complex network environment. At the same time, it combines the memory mechanism of simulated annealing SA and the predation behavior of whale optimization algorithm WOA to avoid falling into local optimal solutions. During the iteration process, WOA simulates the behavior of whales surrounding and pouncing on prey to update the position of the routing path, while SA decides whether to accept the new solution through the acceptance criterion, and accepts a worse solution with a certain probability to increase the diversity of the search space. During the iteration and cooling process, the current path and the relevant parameters of simulated annealing are continuously updated, and finally the optimal path is output. This method can effectively manage the routing problems under multiple devices and multiple communication methods, realize the normalization of communication flow, reduce resource consumption, and improve the overall communication efficiency and stability. Brief Description of the Drawings
[0026] Figure 1 is the flowchart of the method of the present invention. Detailed Embodiments
[0027] The following further describes the detailed embodiments of the present invention with reference to the drawings:
[0028] 1. Introduction to the SA-WOA algorithm
[0029] (1) Simulated annealing algorithm SA
[0030] The simulated annealing algorithm is a global optimization search algorithm inspired by the physical annealing process. Simulated annealing controls the cooling rate, allows large fluctuations at high temperatures (physical unstable states) to jump out of local optimal solutions, and gradually reduces the search range at low temperatures for precise optimization. The main steps of the algorithm are as follows:
[0031] 1) Initialize parameters: initial temperature T 0 , cooling rate α, number of iterations I, initial solution S 0 ;
[0032] 2) Generate neighborhood solutions: For the current solution S, generate a set of new candidate solutions S′ by exchanging two nodes in the path;
[0033] 3) Acceptance probability: Decide whether to accept the new solution S′ according to the simulated annealing acceptance probability formula:
[0034]
[0035] Where C(S) is the value of the cost function;
[0036] 4) Update temperature: After each iteration, reduce the temperature according to the cooling rate α:
[0037] T=α·T (6)
[0038] 5) Output the optimal solution: record the best path S during the entire optimization process * , that is, the path that minimizes the cost function C(S).
[0039] (2) Whale Algorithm (WOA)
[0040] Whale Algorithm (WOA) is a heuristic algorithm based on biological behavior optimization method, inspired by the behavioral characteristics of sperm whales (gray whales) when hunting prey. WOA is mainly used to solve continuous optimization problems.
[0041] Basic principle:
[0042] Searching for prey: They search for potential prey by performing random walks;
[0043] Surrounding and capturing prey: Once they find prey, they will form a circle and then attack the prey collectively;
[0044] The whale algorithm finds the optimal solution to the optimization problem by simulating these two predation behaviors of sperm whales:
[0045] Orbiting prey: Simulates the behavior of whales circling around their prey;
[0046] Pounce on prey: simulate the behavior of a whale lunging to capture prey;
[0047] Steps of the whale algorithm:
[0048] 1) Initialization:
[0049] Set the population size M and the maximum number of iterations MaxIter;
[0050] Initialize M solutions (whales) and calculate their cost function C, each solution represents a potential solution to the problem;
[0051] Set the initial optimal solution S bestThe solution with the minimum cost function;
[0052] 2) Main iterative process:
[0053] Perform the following operations for each iteration number iter (iter = 1, 2,..., MaxIter):
[0054] 2.1) Calculate the shrinking range variable A and the step size variable C:
[0055]
[0056] C = 2 × rand() - 1 (8)
[0057] where rand() is a random number between [0, 1];
[0058] For each whale S i , generate random parameters a and c between [0, 1];
[0059] 2.2) Encircle the prey
[0060] Generate a random whale S rand from the current population;
[0061] Select whether to encircle the current optimal solution S according to the formula best :
[0062]
[0063]
[0064] where is the distance adjustment value between the current whale position S i and the current optimal solution S best ;
[0065] 2.3) Dive towards the prey
[0066] Generate two random numbers r 1 and r 2 between [0, 1];
[0067] Calculate the p value representing the probability of using the current optimal solution:
[0068] p = 2 × iter / MaxIter (11)
[0069] If p < 0.5, perform the encircling behavior to update the position S i ; otherwise perform the diving behavior to update the position S i ;
[0070] In the diving behavior, one of the three non-dominant whales will choose a random behavior (jet behavior, spiral update behavior, or search update behavior) to update its position;
[0071] Jet behavior: S i = S best - A × |Q × S best - S i | (12)
[0072] where Q is a random number between [0, 1];
[0073] Spiral update behavior: S i = D i × exp(b × l) × cos(2π × l) + S best (13)
[0074] where l is a random number between [-1, 1] and b is a constant;
[0075] Search update behavior: S i = S best + G × rand() × (S best - S i ) (14)
[0076] where G is a random variable between [0, 2];
[0077] Calculate the cost function C(S′ i ) of the new solution S i ), and compare it with the cost of the old solution C(S i ) to decide whether to accept the new solution;
[0078] Update the global optimal solution S best .
[0079] See Figure 1 , which is the flowchart of the method of the present invention. A panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm of the present invention includes the following steps:
[0080] S1. Initialize the whale population and parameters, and calculate the cost function of each whale Whale;
[0081] S1.1. Initialize parameters
[0082] Set the initial temperature T 0 ;
[0083] The cooling rate α takes a value of 0.9;
[0084] The maximum number of iterations MaxIter = 1000;
[0085] The population size M = 30;
[0086] S1.2. Initialize the whale population
[0087] Generate M initial solutions S i , i = 1, 2, ..., M, where S i represents the routing path of the i-th whale;
[0088] Calculate the cost function C(S i ) of each solution S i The cost function can be the total distance of the path:
[0089]
[0090] where S i is the initial solution, i = 1, 2, ..., M, representing the routing path of the i-th whale; C(S i ) is the cost function of each solution S i ; Si j and Si j+1 are adjacent nodes in the path, distance(Si j , Si j+1 ) is the distance between adjacent nodes in the path, distance(Si n , Si 1 ) is the distance from the last node back to the starting point;
[0091] Set the initial optimal solution S best as the solution with the minimum cost function:
[0092]
[0093] where S best is the set initial optimal solution, is the solution with the minimum cost function.
[0094] S2. Establish the SA-WOA hybrid optimization algorithm that combines the simulated annealing mechanism and the whale algorithm: In each iteration, the whale algorithm WOA updates the position by simulating the behavior of whales surrounding and pouncing on prey, and the simulated annealing SA decides whether to accept the new solution through the acceptance criterion, accepting a worse solution with a certain probability to avoid local optimum; specifically, it includes the following steps:
[0095] S2.1. Enter the main loop: For each iteration number iter (iter = 1, 2,..., MaxIter), execute steps S2.2 - S3.2;
[0096] S2.2. Calculate the update parameters:
[0097] Calculate the shrinking range variable A:
[0098] Calculate the step size variable G:
[0099] S2.3. Generate a random whale: Randomly select a whale S rand from the current population for the update operation;
[0100] S2.4. Calculate the new solution: For each whale S i , select the update method according to its current position. The whale algorithm selects one of three processes (individual pursuit, encircling the prey, capturing the prey) to update the position of each whale. Here, we combine simulated annealing for selection:
[0101] 1) Generate random variables r1, r2 ∈ [0, 1] for controlling the behavior of the whale
[0102] 2) Generate random variables a, c ∈ [-1, 1] for adjusting the step size and direction of the whale position update
[0103] 3) Calculate the distance adjustment value between the current whale position S i and the current optimal solution S best
[0104]
[0105] Among them, a is a random variable, ranging from [-1, 1], used to adjust the scaling ratio of the distance, introducing randomness;
[0106] 4) Calculate the new solution S′ i :
[0107] If r1 < 0.5:
[0108] Otherwise:
[0109] Among them, S best is the best routing path of the current population, and A is the variable for narrowing the range during the iteration process;
[0110] S2.5. Acceptance criterion
[0111] For the new solution S′ i , calculate its cost function C(S′ i );
[0112] Calculate the cost function difference ΔC: ΔC = C(S′ i ) - C(Si ) (22)
[0113] Use the acceptance criterion of simulated annealing to decide whether to accept the new solution S′ i :
[0114] If ΔC < 0, that is, the new solution is better, then accept the new solution S i = S′ i ,
[0115] Otherwise, accept the worse solution with a probability:
[0116] With a probability Accept the new solution. Specifically, generate a random number r that follows a uniform distribution [0, 1]. If Then accept the new solution S i = S′ i .
[0117] S3. During the iteration process, continuously reduce the temperature and update the optimal routing path. After reaching the maximum number of iterations, output the optimal routing path; specifically, it includes the following steps:
[0118] S3.1. Reduce the temperature: Update the current temperature T: T = T × α (23)
[0119] S3.2. Update the optimal solution: If the cost function C(S′ i ) < C(S i ), then update the optimal solution, best ) < C(S
[0120] S best = S′ i (24)
[0121] S3.3. Stopping criterion: When iter = MaxIter, stop the search and output the optimal routing path S found during the search best .
[0122] Through the above steps, combining simulated annealing and the whale algorithm can improve the effect and efficiency when optimizing the routing path.
[0123] The above embodiments are implemented on the premise of the technical solution of the present invention, and detailed implementation manners and specific operation processes are given, but the protection scope of the present invention is not limited to the above embodiments. The methods used in the above embodiments are all conventional methods unless otherwise specified.
Claims
1. A panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm, characterized in that: The steps include: S1. Initialize the whale group and parameters and calculate the cost function of each whale; S2. Establish a SA-WOA hybrid optimization algorithm that integrates simulated annealing mechanism and whale algorithm: In each iteration, the whale algorithm WOA updates the position by simulating the whale's behavior of circling and pouncing on prey, and the simulated annealing SA decides whether to accept the new solution through the acceptance criterion, and accepts a worse solution with probability to avoid local optimality; S3. During the iteration process, the temperature is continuously lowered and the optimal routing path is updated. After reaching the maximum number of iterations, the optimal routing path is output.
2. The panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm according to claim 1 is characterized in that: The parameters in step S1 include initial temperature T0, cooling rate α, maximum number of iterations MaxIter and population size M, and the cooling rate α takes a value of 0.8 to 0.
99.
3. The panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm according to claim 1 is characterized in that: The formula for calculating the cost function for each whale is: Among them, S i is the initial solution, i=1,2,…,M, represents the routing path of the i-th whale; C(S i ) for each solution S i The cost function of Si j and Si j+1 are adjacent nodes in the path, distance(Si j ,Si j+1 ) is the distance between adjacent nodes in the path, distance(Si n ,Si1) is the distance from the last node back to the starting point.
4. The panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm according to claim 1, characterized in that: The calculation of the new solution in step S2 includes the following steps: 1) Generate random variables r1,r2∈[0,1] used to control the behavior of whales 2) Generate random variables a,c∈[-1,1] for adjusting the whale position update step size and direction 3) Calculate the current whale position S i and the current optimal solution S best Distance adjustment value Among them, a is a random variable with a range of [-1,1], which is used to adjust the distance scaling ratio and introduce randomness; 4) Calculate the new solution S' i : If r1<0.5: otherwise: Among them, S best is the best routing path for the current group, that is, the routing path with the smallest cost function; A is the variable that reduces the range during the iteration process.
5. The panoramic multi-dimensional routing optimization method based on simulated annealing and whale algorithm according to claim 1, characterized in that: The acceptance criteria are for the new solution S' i , calculate its cost function C(S' i ), calculate the cost function difference ΔC, and use the acceptance criterion of simulated annealing to decide whether to accept the new solution S' i , if ΔC<0, that is, the new solution is better, then accept the new solution: S i =S' i , otherwise, accept the worse solution with probability.