An optimal path acquisition method based on an ant colony algorithm
By introducing arrival update and deadlock update strategies into the ant colony algorithm, and combining evaluation scores and reward mechanisms, the ant path selection is optimized, solving the problems of large pheromone concentration distribution differences and deadlock in the ant colony algorithm, and achieving more efficient global optimal path planning.
Patent Information
- Application Number
- CN202310015209.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-01-04
AI Technical Summary
Existing ant colony algorithms suffer from significant differences in pheromone concentration distribution during path planning, resulting in low diversity of ant exploration paths, a tendency to get trapped in local optima, and difficulty in finding the globally optimal path.
By introducing arrival update strategy and deadlock update strategy, pheromone concentration is dynamically adjusted. Combined with evaluation score calculation and reward mechanism, the path selection of ants is optimized, the pheromone concentration gap of deadlock ants is reduced, and the diversity of path exploration is improved.
This improves the likelihood of ants finding the globally optimal path in path planning, reduces the likelihood of finding the locally optimal path, and enhances the convergence speed and effectiveness of the ant colony model in path planning.
Smart Images

Figure CN116026338B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of path planning technology, specifically relating to an optimal path acquisition method based on ant colony algorithm. Background Technology
[0002] With the development of high-tech industries, robots are playing an increasingly important role in daily life, industry, and agriculture. Path planning is the autonomous planning of a path from a starting point to a destination by a robot, ensuring that the robot does not collide with obstacles while traveling along that path. Therefore, path planning plays a decisive role in the application of robots and has become a key research focus both domestically and internationally.
[0003] Currently, the most commonly used path planning methods include intelligent search algorithms, artificial intelligence-based algorithms, geometric model-based algorithms, and algorithms for local obstacle avoidance. Intelligent search algorithms include ant colony optimization (ACO), particle swarm optimization (PSO), genetic algorithms, fast random search tree (SRS), and probabilistic road graph methods. Among these, ant colony optimization (ACO) is widely used in path planning due to its strong robustness.
[0004] The principle behind ant colony optimization (ACO) lies in the fact that ant colonies can find the optimal path to food sources in different environments. Research has shown that ants release a substance called "pheromone" along their paths. Ants in the colony are able to sense this pheromone and will walk along paths with higher pheromone concentrations. Each passing ant leaves pheromone trails, creating a positive feedback mechanism. After a period of time, the entire colony will reach the food source along the optimal path.
[0005] The existing ant colony algorithm updates pheromone concentration by rewarding ants that have reached the destination with pheromone concentration after each iteration, while evaporating pheromone concentration from paths taken by ants that have not reached the destination or paths not traversed by any ants. The level of pheromone concentration on a path reflects the probability that an ant will eventually reach the destination after traversing that path. The more ants that reach the destination and the shorter the path they take, the easier it is to reach the destination, and the higher the pheromone concentration on that path, indicating a greater probability that an ant will reach the destination by traversing that path.
[0006] In the early stages of ant colony optimization (ACO), ants' pathfinding is often blind, leading to many ants getting stuck in deadlock. This is especially true during the first iteration, where the number of deadlocked ants is the highest and the number of ants reaching the destination is the lowest. The information concentration updated after the first iteration has the greatest impact on the pathfinding of subsequent generations of ants and the final result. However, existing ACO algorithms do not update the information concentration of the paths of deadlocked ants, resulting in a large difference in the distribution of pheromone concentration across different paths on the map. This reduces the likelihood of ants exploring paths and increases the possibility of finding a locally optimal path, which is not conducive to the ant colony finding the globally optimal path. Summary of the Invention
[0007] The present invention aims to at least solve the technical problems existing in the prior art, and provide an optimal path acquisition method based on ant colony algorithm, which reduces the pheromone concentration distribution gap of each path, improves the diversity of exploration paths, reduces the possibility of the solution path being a local optimal path, and helps the ant colony find the global optimal path.
[0008] To achieve the above-mentioned objectives of the present invention, according to a first aspect of the present invention, the present invention provides an optimal path acquisition method based on ant colony algorithm, comprising the following steps: acquiring a map and placing it into an ant colony model, setting the number of ants, the starting point and the ending point of the map, placing ants at the starting point of the map and starting multiple iterations of pathfinding until the ant colony model converges; acquiring the evaluation scores of the ants, and selecting the path traversed by the ant with the highest evaluation score as the optimal path; the process of one iteration of pathfinding is as follows: calculating the probability of an ant transitioning to the next node based on the pheromone concentration of the path in the map and performing state transition iterations; updating the pheromone concentration of the path traversed by ants that can reach the endpoint after this iteration according to the arrival update strategy, and updating the pheromone concentration of the path traversed by deadlocked ants after this iteration according to the deadlock update strategy; completing one iteration of pathfinding.
[0009] Furthermore, the steps of the arrival update strategy are as follows: Calculate the arrival concentration increment for this iteration, and update the pheromone concentration along the ant's path based on the arrival concentration increment and the first update formula; the first update formula is as follows: τ ij (t+1)=(1-ρ)×τ ij (t)+ρ×Δτ ij (t); where t represents the iteration number t, ρ represents the pheromone evaporation coefficient, and ij represents the path segment.<i,j> ,Δτ ij (t) represents the path segment in the t-th iteration.<i,j> The concentration increment upon arrival, τ ij (t) represents the path segment in the t-th iteration.<i,j> pheromone concentration, τ ij(t+1) represents the path segment in the t-th iteration.<i,j> The updated pheromone concentration, i.e., the path segment in the (t+1)th iteration.<i,j> The pheromone concentration; the formula for calculating the concentration increment is as follows: Δτ ij (t)= Where M represents the total number of ants participating in the iterative pathfinding, m represents the m-th ant, and Δτ ij m (t) represents the path segment in the t-th iteration.<i,j> The concentration increment of the m-th ant; kp(t, m) represents the evaluation score of the m-th ant in the t-th iteration.
[0010] Furthermore, the specific steps of the deadlock update strategy are as follows: Obtain the optimal path in this iteration as the reference path; obtain the intersection point of the deadlock ant's path and the reference path in this iteration as the segment point; denote the path from the starting point to the segment point on the deadlock ant's path as the dominant path, and the path from the segment point to the ending point on the deadlock ant's path as the suboptimal path; calculate the deadlock concentration increment, and update the pheromone concentration of the dominant path and the suboptimal path according to the deadlock concentration increment and the second update formula, respectively; the second update formula is as follows: Where t represents the iteration number t, and ij represents the path segment.<i,j> , τ ij (t) represents the path segment in the t-th iteration.<i,j> pheromone concentration; τ ij (t+1) represents the path segment in the t-th iteration.<i,j> The updated pheromone concentration, i.e., the path segment in the (t+1)th iteration.<i,j> pheromone concentration; Δτ ij-d (t) represents the path segment in the t-th iteration.<i,j> The deadlock concentration increment; P b P represents the dominant path. w The dominant path is represented; the formula for calculating the deadlock concentration increment is as follows: Where, n suc Let L represent the number of ants that have reached the destination, m represent the m-th ant, and kp(t, m) represent the evaluation score of the m-th ant in the t-th iteration. m Let n represent the path length of the m-th ant, Q represent the pheromone intensity, and n dead This represents the number of deadlocked ants in this iteration, and M represents the number of ants participating in the iterative pathfinding.
[0011] Furthermore, the formula for calculating the evaluation score is as follows: Where t represents the iteration number t, m represents the m-th ant, kp(t, m) represents the evaluation score of the m-th ant in the t-th iteration, α1 represents the node coefficient, α2 represents the path coefficient, N(t, m) represents the number of nodes traversed by the m-th ant in the t-th iteration, and nnode Let d represent the map size, PL(t, m) represent the length of the path traversed by the m-th ant in the t-th iteration, and d represent the length of the path traversed by the m-th ant in the t-th iteration. se It represents the Euclidean distance from the starting point to the ending point on the map.
[0012] Furthermore, the iterative pathfinding process also includes the following steps: obtaining the optimal path and optimal path length after the last iteration, obtaining the shortest path and shortest path after the current iteration; if the shortest path length is less than or equal to the optimal path length, then the updated pheromone concentration is rewarded using the reward formula.
[0013] Furthermore, the reward formula is as follows: Where m represents the m-th ant, t represents the iteration number t, and ij represents the path segment.<i,j> , τ ij (t+1) represents the updated pheromone concentration after the t-th iteration. Let P represent the reward coefficient for the m-th ant in the t-th iteration. b-n τ represents the shortest path. ij (t+1)′ represents the pheromone concentration after the reward in the t-th iteration.
[0014] Furthermore, the formula for calculating the reward coefficient is as follows: Where m represents the m-th ant, and t represents the iteration number t. The reward coefficient for the m-th ant in the t-th iteration, kp b-n (t, m) represents the path p in the t-th iteration. b-n The evaluation score of the m-th ant, where NC represents the maximum number of iterations.
[0015] Furthermore, the steps of calculating the probability of an ant transitioning to the next node based on the pheromone concentration of the path in the map and performing state transition iterations include: if the ant has a next node that is feasible, then calculate the probability of the ant transitioning to the next node based on the pheromone concentration of the path in the map and perform state transition iterations; if the ant has no next node to move to, determine the deadlock state of the ant. Deadlock states include self-deadlock and passive deadlock. Unlock the ant according to the deadlock state.
[0016] Furthermore, the process of unlocking the deadlocked ant is as follows: Ignore the restrictions imposed on the ant by the local tabu list, which is used to record the infeasible nodes of the ant; calculate the probability of feasible nodes around the deadlock position, set the probability of the node preceding the deadlock position to zero, select a feasible node as the loop point using a roulette wheel approach, and let the ant backtrack step by step according to the order of feasible nodes on the path until it backtracks to the loop point; restore the local tabu list, update the nodes on the path traversed by the ant and the length of the path traversed, and continue the next iteration of pathfinding.
[0017] Furthermore, the process of unlocking passively deadlocked ants is as follows: Backtracking step: Let the ant backtrack one step from the deadlock position along the path it has traversed; Judgment step: If the number of feasible nodes around the current node after backtracking is less than or equal to 2, then repeat the backtracking step; If the number of feasible nodes around the current node after backtracking is greater than or equal to 3, then add the position of the current node to the global tabu list, and the ant continues to backtrack one step and continue searching for a new path; The global tabu list is used to record all infeasible nodes of all ants.
[0018] The technical principle and beneficial effects of this invention are as follows: After an ant completes a state transition iteration, its state is determined. The ant states after the iteration are categorized as either ants that can reach the destination or deadlocked ants. Based on the different states, a corresponding update strategy is selected to update the pheromone concentration of the path in the map. The probability of the ant moving to the next node is calculated based on the pheromone concentration of the path, and the state transition iteration is performed again. After multiple iterations, the ant colony model converges, and the path traversed by the ant with the highest evaluation score is output as the optimal path. Although deadlocked ants fail to reach the destination in this iteration, their traversed paths are still considered to have a certain probability of reaching the destination. This invention still updates the pheromone concentration of the paths of deadlocked ants, reducing the difference in path pheromone concentration between deadlocked ants and ants that can reach the destination. The pheromone concentration of paths that may reach the destination but do not are retained and passed to the ants in the next iteration for continued exploration. Compared with existing technologies, this invention increases the diversity of ant path exploration, reduces the possibility of finding a locally optimal path, and increases the probability of ants finding the globally optimal path. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating an optimal path acquisition method based on ant colony algorithm according to the present invention.
[0020] Figure 2 This is a schematic diagram of the optimal path in one iteration of the ant colony model of this invention;
[0021] Figure 3 This is a schematic diagram illustrating the segmentation points of the deadlock path in this invention;
[0022] Figure 4 This is a schematic diagram illustrating the segmentation points of the deadlock path in this invention;
[0023] Figure 5 This is a schematic diagram of the invalidation turning point of the present invention;
[0024] Figure 6 This is a schematic diagram of path selection before removing invalid turning points in this invention;
[0025] Figure 7This is a schematic diagram of path selection after removing invalid turning points according to the present invention;
[0026] Figure 8 This is a schematic diagram of the ant path during passive deadlock in this invention;
[0027] Figure 9 This is a schematic diagram illustrating the ant state transition iteration process during one iteration of pathfinding in this invention;
[0028] Figure 10 This is a schematic diagram of the ant path during self-deadlock in this invention;
[0029] Figure 11 This is a schematic diagram of the ant's unlocking circuit in a deadlock state according to the present invention;
[0030] Figure 12 This is a schematic diagram of the route selection of ants after unlocking from a deadlock state according to the present invention;
[0031] Figure 13 This is a schematic diagram of the unlocking process for the passive deadlock ant of the present invention;
[0032] Figure 14 This is a schematic diagram of the unlocking route for the passive deadlock ant of this invention;
[0033] Figure 15 This is a schematic diagram of the route selection after the passive deadlock ant of the present invention is unlocked;
[0034] Figure 16 This is the experimental result of the optimal path acquisition method based on ant colony algorithm of the present invention on a 20×20 grid map;
[0035] Figure 17 This is the experimental result of the optimal path acquisition method based on ant colony algorithm of the present invention on a 30×30 grid map;
[0036] Figure 18 This is the grid map used in the comparative experiment of this invention;
[0037] Figure 19 This is the grid map used in the comparative experiment of this invention. Detailed Implementation
[0038] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0039] In the description of this invention, it should be understood that the terms "longitudinal", "lateral", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0040] The basic principle of ant colony optimization is as follows: Imagine a colony of ants that will travel along a straight path between their nest and a food source. If an obstacle suddenly appears between the nest and the food source, the ants will have to decide whether to move left or right. Initially, since there are no pheromones left by previous ants on the path, the probability of an ant moving in either direction is equal. However, when an ant passes by, it releases pheromones along its path, and these pheromones dissipate at a certain rate. Pheromones are one of the tools for communication between ants. Ants following behind make decisions about whether to go left or right based on the concentration of pheromones on the path. The pheromones along the shorter side of the path will become increasingly concentrated, attracting more and more ants to follow this path. The ant stops searching when it reaches the destination. If an ant has not yet reached the destination and there is no other path to take, the ant is in a deadlock state and stops searching.
[0041] As attached Figure 1 As shown, this invention provides an optimal path acquisition method based on ant colony optimization, comprising the following steps:
[0042] Get the map and put it into the ant colony model. Set the number of ants, the start and end points of the map. Place the ants at the start point on the map and start iterative pathfinding multiple times until the ant colony model converges to all ants and ends the pathfinding. Get the evaluation scores of the ants and select the path taken by the ant with the highest evaluation score as the optimal path.
[0043] The process of one iteration of pathfinding is as follows: Calculate the probability of an ant transitioning to the next node based on the pheromone concentration of the path in the map and perform state transition iteration; update the pheromone concentration of the path traversed by the ants that can reach the destination after this iteration according to the arrival update strategy; update the pheromone concentration of the path traversed by the deadlocked ants after this iteration according to the deadlock update strategy; complete one iteration of pathfinding.
[0044] In this embodiment, in order to more comprehensively evaluate the path quality and enable ants to converge to high-quality paths more quickly, the present invention establishes a formula for calculating the evaluation score, which is as follows:
[0045]
[0046]
[0047] Where t represents the iteration number t, m represents the m-th ant, and kp(t, m) represents the evaluation score of the m-th ant in the t-th iteration; α1 represents the node coefficient, specifically the evaluation coefficient for the number of nodes; α2 represents the path coefficient, specifically the evaluation coefficient for the path length; α1 and α2 are both model parameters, set during model parameter initialization, representing the importance of the two evaluation coefficients; N(t, m) represents the number of nodes traversed by the m-th ant in the t-th iteration, n node Indicates the map size; in this embodiment, when the map is a square map, n node The value can be either the length or width of the raster map; PL(t, m) represents the length of the path traversed by the m-th ant in the t-th iteration, and d se It represents the Euclidean distance from the starting point to the ending point on the map, which is the shortest distance that the path can reach without obstacles.
[0048] The evaluation score is calculated by combining the length of the ant's path and the number of nodes along the path. The shorter the path and the fewer the nodes along the path, the higher the quality of the path and the higher the evaluation score.
[0049] Specifically, the ant chooses its next node based on a roulette wheel algorithm and the probability of transitioning from the current node to the next node; the probability of an ant transitioning from the current node to the next node is calculated using the following formula:
[0050]
[0051] Where m represents the m-th ant, and i and j represent nodes i and j, respectively. τ represents the probability that ant m moves from node i to node j; ij The pheromone concentration represents the path segment from node i to node j, α represents the information heuristic factor, β represents the expected heuristic factor, ψ represents the set of nodes that can be reached from the current node i, and η represents the pheromone concentration from the current node i to the next node j. j The value of the heuristic function for node j is represented; where the information heuristic factor α and the expectation heuristic factor β are both model parameters, which are set during model parameter initialization. In this embodiment, the step of setting the map to be placed into the ant colony model also includes initializing the model parameters.
[0052] Where, η j The calculation process is as follows:
[0053]
[0054] Where e represents the set map endpoint, d jeLet x represent the Euclidean distance from node j to the endpoint e. j y j (x) represents the coordinates of node j. e y e ) represents the coordinate value of the endpoint e.
[0055] Preferably, the steps of the arrival update strategy are as follows: calculate the arrival concentration increment for this iteration, and update the pheromone concentration along the ant's path according to the arrival concentration increment and the first update formula;
[0056] The first updated formula is as follows:
[0057] τ ij (t+1)=(1-ρ)×τ ij (t)+ρ×Δτ ij (t)
[0058] Where t represents the iteration number t, ρ represents the pheromone evaporation coefficient, which is a model parameter set during model parameter initialization, with ρ < 1; and ij represents the path segment.<i,j> ,Δτ ij (t) represents the path segment in the t-th iteration.<i,j> The concentration increment upon arrival, τ ij (t) represents the path segment in the t-th iteration.<i,j> pheromone concentration, τ ij (t+1) represents the path segment in the t-th iteration.<i,j> The updated pheromone concentration, i.e., the path segment in the (t+1)th iteration.<i,j> pheromone concentration;
[0059] The formula for calculating the concentration increment is as follows:
[0060]
[0061] Where M represents the total number of ants participating in the iterative pathfinding, m represents the m-th ant, and Δτ ij m (t) represents the path segment in the t-th iteration.<i,j> The concentration increment of the m-th ant; kp(t, m) represents the evaluation score of the m-th ant in the t-th iteration.
[0062] Δτ ij m The calculation process for (t) is as follows:
[0063]
[0064] Where PL(t, m) represents the length of the path traversed by the m-th ant in the t-th iteration, Q represents the pheromone intensity, which is a model parameter set during model parameter initialization, and tour m This represents the path of the m-th ant.
[0065] Preferably, for each iteration of pathfinding, the pheromone concentration along the path traversed by the deadlocked ants is adaptively updated to improve the convergence speed of the ant colony. The pheromone concentration of the deadlocked path is updated according to the deadlock update strategy. The specific steps of the deadlock update strategy are as follows:
[0066] The optimal path in this iteration is taken as the reference path. The intersection of the deadlocked ant's path and the reference path in this iteration is taken as the segment point. The path from the starting point to the segment point on the deadlocked ant's path is recorded as the dominant path, and the path from the segment point to the destination on the deadlocked ant's path is recorded as the suboptimal path. After segmenting the deadlocked ant's path, it can be considered that the ant has a high probability of reaching the destination after passing through the dominant path, but it went in the wrong direction at the segment point. Therefore, it is considered that the probability of the ant reaching the destination after passing through the suboptimal path is low.
[0067] As attached Figure 2 The diagram shows the optimal path of the ant colony model in the first iteration. Figure 3 and attached Figure 4 For the two deadlocked paths in this iteration, when updating the pheromone concentration of the deadlocked paths, we first find the intersection of the deadlocked path and the reference path, then reward the advantageous path from the starting point to the segment point with pheromone concentration, and penalize the disadvantageous path from the segment point to the deadlock position; we maximize the use of deadlocked ants to help the ant colony model improve the quality of path search.
[0068] Therefore, this invention designs a second update formula based on the probability that an ant can reach the destination after traversing a certain path; firstly, the deadlock concentration increment is calculated, and the pheromone concentration of the dominant path and the pheromone concentration of the disadvantaged path are updated according to the deadlock concentration increment and the second update formula respectively.
[0069] The second updated formula is as follows:
[0070]
[0071] Where t represents the iteration number t, and ij represents the path segment.<i,j> , τ ij (t) represents the path segment in the t-th iteration.<i,j> pheromone concentration; τ ij (t+1) represents the path segment in the t-th iteration.<i,j> The updated pheromone concentration, i.e., the path segment in the (t+1)th iteration.<i,j> pheromone concentration; Δτ ij-d (t) represents the path segment in the t-th iteration.<i,j> The deadlock concentration increment; P b P represents the dominant path. w Indicates the weakest path;
[0072] The formula for calculating the deadlock concentration increment is as follows:
[0073]
[0074] Where, n suc Let L represent the number of ants that have reached the destination, m represent the m-th ant, and kp(t, m) represent the evaluation score of the m-th ant in the t-th iteration. m Let n represent the path length of the m-th ant, Q represent the pheromone intensity, and n dead This represents the number of deadlocked ants in this iteration, and M represents the number of ants participating in the iterative pathfinding.
[0075] Preferably, the pheromone concentration is mainly affected by two factors: the number of ants and the pheromone increment of the ants. Therefore, the pheromone concentration has a cumulative effect. Through the calculation of the deadlock concentration increment above, if the number of deadlock ants is high in this iteration, it indicates that the overall pathfinding quality is not high, with only a few ants reaching the destination. In this case, the pheromone concentration increment for deadlock ants should be reduced, thus reducing the probability of the cumulative effect and preventing the pheromone concentration increment on advantageous sections of certain deadlock paths from being higher than that of paths that successfully reach the destination due to the numerical advantage of deadlock ants. If the number of deadlock ants is low in this iteration, it indicates that the overall pathfinding quality is high, and the pheromone concentration distribution on the map has already reached a relatively optimal state before this iteration. There is a greater probability of choosing to trust the current pheromone concentration distribution, and the pheromone concentration increment should be appropriately increased.
[0076] As shown in the formula for calculating the deadlock concentration increment, the deadlock concentration increment decreases with the increase of the number of iterations. This is because in the early stages of the ant colony algorithm, ants' pathfinding is somewhat blind, leading to many ants getting stuck in a deadlock state. However, as the number of iterations increases, the pheromone concentration on the map gradually converges towards the optimal path, and the number of deadlocked ants decreases generation by generation. If deadlocked ants still appear in the later stages of the iteration, it is considered that the pathfinding quality of these deadlocked ants is poor, and therefore the deadlock concentration increment decreases with the increase of the number of iterations. Although deadlocked ants fail to reach the destination after this iteration, they are still considered to have a possibility of reaching the destination on the dominant path. Extensive experiments have shown that when the dominant path is the path that successfully reaches the destination during this iteration... Therefore, the ant colony algorithm is considered to have the best overall pathfinding quality.
[0077] Preferably, if multiple ants repeatedly traverse the suboptimal path in a single iteration, the concentration increment on that path is the highest, causing more ants to follow that path in the next iteration. The optimal path, however, is randomly chosen by a single ant. Although the concentration increment for a single ant is highest on the optimal path, overall, more ants traverse the suboptimal path. After the iteration, the pheromone update concentration on the suboptimal path is higher than that on the optimal path. This can lead to a situation where ants can find the optimal path during the pathfinding iteration, but ultimately converge to the suboptimal path – this is the cumulative effect.
[0078] To mitigate the adverse effects of cumulative effects on the ant colony algorithm, this embodiment proposes a reward mechanism. During iterative pathfinding, this mechanism rewards the pheromone concentration after path updates, increasing the distinction between the optimal and suboptimal paths. This guides the ant colony towards the current optimal route, improving the convergence speed and the likelihood of convergence to the optimal path. Therefore, the iterative pathfinding process also includes the following steps:
[0079] Obtain the optimal path and its length after the last iteration, and the shortest path and its length after the current iteration. If the shortest path length is less than or equal to the optimal path length, then use the reward formula to reward the updated pheromone concentration. If the shortest path length is greater than the optimal path length, then do not reward the updated pheromone concentration for this iteration.
[0080] Preferably, the reward formula is as follows:
[0081]
[0082] Where m represents the m-th ant, t represents the iteration number t, and ij represents the path segment.<i,j> , τ ij (t+1) represents the updated pheromone concentration after the t-th iteration. Let P represent the reward coefficient for the m-th ant in the t-th iteration. b-n τ represents the shortest path. ij (t+1)′ represents the pheromone concentration after the reward in the t-th iteration.
[0083] Preferably, the formula for calculating the reward coefficient is as follows:
[0084]
[0085] Where m represents the m-th ant, and t represents the iteration number t. The reward coefficient for the m-th ant in the t-th iteration, kp b-n (t, m) represents the path p in the t-th iteration. b-nThe evaluation score of the m-th ant, where NC represents the maximum number of iterations.
[0086] The reward formula is designed by comprehensively considering the path's evaluation score and the number of iterations. A higher evaluation score indicates a higher path quality and a higher reward coefficient. Once the reward mechanism is triggered, the rewarded path is considered the optimal path so far and may also become the optimal path in this iteration. The later the optimal path appears, the more likely it is to become the optimal path in this iteration; therefore, this probability increases with the number of iterations.
[0087] Preferably, the optimal path acquisition method based on ant colony algorithm of the present invention adopts a dynamic reward measure, comprehensively considering the pathfinding situation of each iteration to select whether to reward the pheromone concentration updated in the current iteration. If a reward is given for the current iteration, the reward coefficient is adaptively adjusted based on the evaluation score of the optimal path in the current iteration, and the pheromone concentration on the path is rewarded; thus enabling the ant colony model to converge to the optimal path more quickly.
[0088] The step of setting up the map and placing it into the ant colony model also includes preprocessing the map, generating a global taboo list, and initializing a local taboo list. The local taboo list is only for a single ant and is used to record the nodes that the ant has passed through, so as to prevent the ant from repeating the path nodes that it has already passed. The preprocessing process is as follows: count the number of obstacles in the four positive directions of all feasible nodes on the map. If the number of obstacles exceeds three, the feasible node is identified as an invalid turning point and added to the global taboo list to prevent the robot from entering invalid turning points.
[0089] As attached Figure 5 As shown, there are two feasible nodes A and B on the map. Each node has more than three obstacles in the positive direction. When the ant moves to this node, the next node can only be a node on the same plane as the direction it came from. This will cause the robot to rotate too much in place, making it more difficult to walk and more likely to collide with obstacles. Therefore, feasible nodes A and B are considered invalid turning points.
[0090] As attached Figure 6 As shown, the ant entered an invalid turning point P on the original route, where the turning angle reached 90 degrees. After preprocessing the invalid turning point, the ant will be unable to reach point P, and the final path is shown in the attached figure. Figure 7 As shown, preprocessing the map can reduce the total length of the searched path and make it more suitable for the robot's actual movement, resulting in smaller rotation angles each time. This reduces the possibility of collisions between the robot and obstacles, preventing damage to the robot due to excessive collisions during operation.
[0091] As attached Figure 8As shown, an ant is trapped in obstacle trap G. The actual state transition process of the ant is as follows: Figure 9 As shown, the arrows point to all non-obstacle nodes around the ant's current position, the pentagons represent feasible nodes that could be chosen but were not selected under the constraints of the local tabu list, the squares represent the next feasible node actually chosen by the ant, and the circles represent nodes that cannot be traversed due to the constraints of the local tabu list. t1~t n N1 to N represent the time it takes for an ant to perform state transitions while searching for a path. n-1 This represents the nodes the ant has visited during its pathfinding. When the ant reaches point G, it has no next node to visit and is stuck in a deadlock state.
[0092] Because deadlocked ants stop pathfinding, reducing the diversity of pathfinding methods in the ant colony, and in severe cases, no ant can reach the destination in a single iteration, resulting in low quality of iterative pathfinding, slow convergence of the ant colony model, and getting stuck in local optima. To rescue deadlocked ants, existing techniques typically employ a strategy of backtracking one or two steps. However, for obstacle traps of varying depths, a single, fixed backtracking step strategy has limited effectiveness and does not fundamentally solve the problem of ant deadlock caused by obstacles.
[0093] Therefore, this embodiment proposes a new solution: based on the cause of the ant deadlock, a targeted backtracking strategy is adopted to reduce the number of deadlocked ants and increase the diversity of path exploration. There are two main reasons for ant deadlock: the first is that ants get stuck in obstacle traps, causing deadlock, as shown in the attached diagram. Figure 8 As shown, when the ant reaches the last node G, it becomes deadlocked because obstacles and restrictions from local or global taboo lists prevent it from moving to the next node. The second reason is self-locking caused by local taboo lists, as shown in the attached diagram. Figure 10 Since all feasible nodes around node P have been added to the local tabu list, the ant has no next node to traverse and is stuck in a deadlock state.
[0094] If an ant gets stuck in a deadlock during its iterative pathfinding process, it stops pathfinding and initiates a rescue step. Therefore, the steps of calculating the probability of the ant transitioning to the next node based on the pheromone concentration of the path in the map and performing state transition iterations also include a rescue step, which is as follows:
[0095] If an ant has a next node that is feasible, the probability of the ant transitioning to the next node is calculated based on the pheromone concentration of the path in the map, and the state transition is iterated. If the ant has no next node to move to, the deadlock state of the ant is determined. Deadlock states include self-deadlock and passive deadlock. The ant is unlocked according to the deadlock state.
[0096] During implementation, the local taboo list is ignored, and the cause of the deadlock by the deadlock ants can be determined based on the number of adjacent feasible nodes in the map. (See attached table.) Figure 8 As shown, if node G has only one feasible node around it in the map, then the deadlock is caused by an obstacle. If node P has two or more feasible nodes around it in the map, then the deadlock is caused by a local tabu list. Based on the number of feasible nodes around the deadlocked position of the ant in the map, the deadlock phenomenon is considered to be common.
[0097] As attached Figure 10 As shown, let the nodes on the path where the ant gets stuck in a deadlock be in the following order of the arrows:
[0098] {N1......N n-4 N n-3 N n-2 N n-1 ,P}
[0099] Where P is the deadlock position of the ant, and node {N} n-4 N n-3 N n-2 N n-1} are the feasible nodes surrounding node P. Since node {N} n-4 N n-3 N n-2 N n-1 All of these are added to the local tabu list, causing the ant to have no next path and fall into a deadlock state. The process of unlocking the deadlocked ant is as follows:
[0100] Ignoring the restrictions imposed on ants by the local taboo list, calculate the probability of feasible nodes around the deadlock position using the probability calculation formula, and then set the node N preceding the deadlock position as the next node. n-1 The probability is set to zero, and a feasible node is selected as the closed loop point N using a roulette wheel method. x The ant is guided to backtrack step by step in the order of feasible nodes along the path until it reaches the closed loop point N. x Restore the local tabu list, update the nodes on the ant's path and the length of the path, and continue the next iteration of pathfinding.
[0101] Among them, node N n-1 The reason the probability is set to zero is because in the initial pathfinding process, the ant starts from node N. n-1 The deadlock point P has been reached; if node N is selected using a roulette wheel approach... n-1 After using node N as a loop backoff point and performing a backoff, there is a high probability of reaching deadlock point P again during subsequent pathfinding, thus reducing the effectiveness of the deadlock backoff strategy. Therefore, node N... n-1 The probability is set to zero to prevent ants from choosing this node as the loop closure point N.x .
[0102] As attached Figure 11 As shown, the ant chose node N on the original path at the deadlock point P. n-3 As the closed loop point N x Then, revert along the original path. (See attached image.) Figure 12 As shown, when reverting to point N x The ants then continue their pathfinding until they either get stuck in a deadlock again or reach the destination and stop.
[0103] As attached Figure 13 As shown and attached Figure 14 The process of unlocking passively deadlocked ants is as follows:
[0104] Backtracking step: Let the ant backtrack one step from the deadlock position along the path it has already traversed;
[0105] Decision steps: If, after backtracking, there are N feasible nodes around the current node... e If the number is less than or equal to 2, repeat the backtracking step; if after backtracking there are N feasible nodes around the current node... e If the number of ants is greater than or equal to 3, the current node's position is added to the global taboo list to prevent later ants from falling into the same trap; the ant then backtracks one step and continues its pathfinding. The global taboo list records all infeasible nodes for all ants. The differences in path planning between the map after deadlock handling are shown in the attached figure. Figure 15 As shown.
[0106] Experiments were conducted using the optimal path acquisition method of the ant colony algorithm described in this invention. (Attached) Figure 16 This represents the experimental results obtained by placing a 20×20 complex obstacle grid map into an ant colony model. (Attached) Figure 17 This represents the experimental results obtained by placing a 30×30 grid map into an ant colony model.
[0107] To verify the practicality of the optimal path acquisition method for ant colony algorithm described in this invention, and to demonstrate its ability to improve the probability of the ant colony model finding the optimal path and solve the ant deadlock problem; an attached... Figure 18 The 20×20 raster map shown and the attached Figure 19 A robot path planning experiment was conducted using a 30×30 grid map, with 10 experiments performed and the average value taken. Two existing ant colony algorithms were also introduced for comparative experiments.
[0108] The first existing ant colony algorithm is an algorithm that combines an improved genetic algorithm with the DWA algorithm. It first uses the GRRT-Connect algorithm to initialize the pheromone concentration in the map, then uses the ant colony relay search method to solve the tabu list self-deadlock problem, and uses the slice optimization method to optimize the optimal path selection mechanism to obtain the global optimal path. However, the improved algorithm uses an improved RRT algorithm in the map initialization process, which leads to a significant increase in the amount of computation and an excessively long convergence time, making it unsuitable for occasions with high real-time requirements.
[0109] The second existing ant colony algorithm proposes a pheromone penalty mechanism. After one iteration, it accelerates the convergence of the ant colony to the optimal path by rewarding the best path and penalizing the worst path. However, this method will result in the pheromone concentration remaining unchanged in the overlapping part between the best and worst paths. As the pathfinding iteration progresses, the evaporation of pheromone concentration will lead to a lower pheromone concentration in the overlapping part of the path, which may cause ants to go in the wrong direction and get lost.
[0110] The model parameters were set in the comparative experiment as shown in the table below:
[0111] Table 1. Parameters set in the experiment
[0112]
[0113] The experimental results of the optimal path acquisition method ① of the ant colony algorithm described in this invention, the first prior art ant colony algorithm ②, and the second prior art ant colony algorithm ③ under two different map conditions are shown in the table below:
[0114] Table 2 Comparison of experimental data for the three algorithms
[0115]
[0116] Data comparison reveals that the optimal path acquisition method of the ant colony algorithm described in this invention significantly reduces the number of deadlocked ants during iterative pathfinding. Furthermore, the convergence generation time is lower than that of the two existing algorithms. Therefore, the optimal path acquisition method of the ant colony algorithm described in this invention has higher path search efficiency, faster convergence speed, and effectively solves the deadlock problem in ant colony algorithms.
[0117] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0118] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for obtaining the optimal path based on the ant colony algorithm, characterized in that, Includes the following steps: The map is obtained and put into the ant colony model. The number of ants, the start point and the end point of the map are set. The ants are placed at the start point of the map and the pathfinding is iterated multiple times until the ant colony model converges. The evaluation scores of the ants are obtained and the path of the ant with the highest evaluation score is selected as the optimal path. The process of one iteration of pathfinding is as follows: Calculate the probability of an ant transitioning to the next node based on the pheromone concentration of the path in the map and perform state transition iterations; update the pheromone concentration of the path traversed by ants that can reach the destination after this iteration according to the arrival update strategy; update the pheromone concentration of the path traversed by deadlocked ants after this iteration according to the deadlock update strategy; complete one iteration of pathfinding. The specific steps of the deadlock update strategy are as follows: The optimal path in this iteration is taken as the reference path; the intersection of the deadlock ant's path and the reference path in this iteration is taken as the segment point. The path from the starting point to the segment point on the deadlock ant's path is recorded as the dominant path, and the path from the segment point to the end point on the deadlock ant's path is recorded as the suboptimal path. Calculate the deadlock concentration increment, and update the pheromone concentration of the dominant path and the pheromone concentration of the disadvantaged path according to the deadlock concentration increment and the second update formula respectively. The second updated formula is as follows: in, Indicates the number of iterations , Represents path segment , Indicates the first Sub-iteration path segment pheromone concentration; Indicates the first Sub-iteration path segment The updated pheromone concentration, i.e., the first Sub-iteration path segment pheromone concentration; Indicates the first Sub-iteration path segment The increase in deadlock concentration; Indicates the dominant path, Indicates the weakest path; The formula for calculating the deadlock concentration increment is as follows: in, This indicates the number of ants that have reached the destination. Indicates the first Just an ant. Indicates the first The second iteration The rating score for just one ant. Indicates the first The path length of an ant. Indicates pheromone intensity, This indicates the number of deadlock ants in this iteration. This represents the number of ants participating in the iterative pathfinding process. The evaluation score is calculated using the following formula: in, Indicates the number of iterations , Indicates the first Just an ant. Indicates the first The second iteration The rating score for just one ant. Represents the node coefficients. Represents the path coefficient. Indicates the first The second iteration The number of nodes traversed by an ant along its path. Indicates map size. Indicates the first The second iteration The length of the path traveled by an ant This represents the Euclidean distance from the starting point to the ending point on the map. One iteration of pathfinding also includes the following steps: Obtain the optimal path and its length after the previous iteration, and the shortest path and its length after the current iteration. If the shortest path length is less than or equal to the optimal path length, then apply a reward formula to the updated pheromone concentration. The reward formula is as follows: in, Indicates the first Just an ant. Indicates the number of iterations , Represents path segment , Indicates the first The updated pheromone concentration in the next iteration Indicates the first The second iteration The reward coefficient for each ant Indicates the shortest path. Indicates the first The formula for calculating the pheromone concentration after the reward in the next iteration, and the reward coefficient, is as follows: in, Indicates the first Just an ant. Indicates the number of iterations , No. The second iteration The reward coefficient for each ant Indicates the first Sub-iteration path The Middle The rating score for just one ant. This indicates the maximum number of iterations.
2. The optimal path acquisition method based on ant colony algorithm as described in claim 1, characterized in that, The specific steps to reach the update strategy are as follows: Calculate the arrival concentration increment for this iteration, and update the pheromone concentration along the ant's path based on the arrival concentration increment and the first update formula; The first updated formula is as follows: in, Indicates the number of iterations , Indicates the pheromone evaporation coefficient. Represents path segment , Indicates the first Sub-iteration path segment The increase in concentration reached Indicates the first Sub-iteration path segment pheromone concentration, Indicates the first Sub-iteration path segment The updated pheromone concentration, i.e., the first Sub-iteration path segment pheromone concentration; The formula for calculating the concentration increment is as follows: in, This represents the total number of ants participating in the iterative pathfinding process. Indicates the first Just an ant. Indicates the first Sub-iteration path segment The Middle The concentration increase upon arrival of a single ant; Indicates the first The second iteration The rating score for each ant.
3. The optimal path acquisition method based on ant colony algorithm as described in claim 1 or 2, characterized in that, The steps for calculating the probability of an ant transitioning to the next node based on the pheromone concentration of the path in the map and performing state transition iterations include: if the ant has a next node that is feasible, then calculate the probability of the ant transitioning to the next node based on the pheromone concentration of the path in the map and perform state transition iterations; if the ant has no next node to move to, determine the deadlock state of the ant. Deadlock states include self-deadlock and passive deadlock. Unlock the ant according to the deadlock state.
4. The optimal path acquisition method based on ant colony algorithm as described in claim 3, characterized in that, The process for unlocking an ant that is deadlocked is as follows: Ignore the restrictions imposed on the ant by the local tabu list, which is used to record infeasible nodes for the ant; calculate the probability of feasible nodes around the deadlock position, set the probability of the node preceding the deadlock position to zero, select a feasible node as the loop point using a roulette wheel approach, and let the ant backtrack step by step according to the order of feasible nodes on the path until it backs to the loop point; restore the local tabu list, update the nodes on the path traversed by the ant and the length of the path traversed, and continue the next iteration of pathfinding.
5. The optimal path acquisition method based on ant colony algorithm as described in claim 3, characterized in that, The process of unlocking ants that are passively deadlocked is as follows: Backtracking step: Let the ant backtrack one step from the deadlock position along the path it has already traversed; Judgment steps: If the number of feasible nodes around the current node after backtracking is less than or equal to 2, then repeat the backtracking step; if the number of feasible nodes around the current node after backtracking is greater than or equal to 3, then add the position of the current node to the global taboo list, and the ant continues to backtrack one step and continue to search for a path; the global taboo list is used to record all infeasible nodes of all ants.
Citation Information
Patent Citations
Application method of adaptive ant colony algorithm (AACO) in mobile robot path planning
CN108241375A
Mobile robot path planning method based on ant colony algorithm under dynamic environment
CN109282815A