Fusion ant colony genetic algorithm-based agricultural machine full-coverage path planning method
By dividing and merging sub-regions on a two-dimensional grid map, and combining ant colony genetic algorithm and A* path search algorithm, the path planning for full coverage of agricultural machinery is optimized, which solves the problems of high repetition rate and poor algorithm performance in existing technologies, and realizes efficient and highly adaptable farmland operation path planning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU UNIV
- Filing Date
- 2026-01-26
- Publication Date
- 2026-04-21
AI Technical Summary
Existing methods for full-coverage agricultural machinery path planning suffer from problems such as high path planning repetition rate, imbalance between global and local searches, poor algorithm performance, and insufficient consideration of special constraints in farmland operations.
A full-coverage path planning method for agricultural machinery based on a fusion ant colony genetic algorithm is adopted. By dividing and merging sub-regions on a two-dimensional grid map, and combining the ant colony genetic algorithm and the A* path search algorithm, the optimal traversal order is planned and a spiral path coverage pattern is adopted to optimize the path planning between and within regions.
It significantly improves the efficiency and quality of path planning, reduces the total length and repetition rate of operations, enhances the convergence speed and robustness of the algorithm, and improves its adaptability to complex farmland environments.
Smart Images

Figure CN121898425A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer and agricultural machinery vehicle path planning technology, and in particular to a method for full-coverage agricultural machinery path planning based on a fusion ant colony genetic algorithm. Background Technology
[0002] With the development of intelligent and modern agriculture, and the deep integration of computer science and agriculture, smart agriculture has become a major trend in future agricultural development. Traditional agricultural machinery faces the challenge of comprehensive path planning in complex environments, employing traditional geometric and heuristic methods, graph-based search methods, and modern intelligent optimization algorithms. Traditional geometric and heuristic methods, such as the inner spiral method and the reciprocating method, have extremely poor environmental adaptability, cannot handle complex obstacles, and are prone to problems such as excessive overlapping coverage, invalid turns, and low coverage efficiency. Graph-based search methods, based on topological graphs, model the environment as a graph structure, transforming the comprehensive path planning problem into a traveling salesman problem on a graph. This leads to a sharp increase in workload and exponential growth in planning time, making it difficult to meet real-time requirements. Modern intelligent optimization algorithms include traditional ant colony algorithms and traditional genetic algorithms. Traditional ant colony algorithms suffer from low pheromone levels in the early stages, resulting in slow convergence, susceptibility to local optima, and insufficient global exploration capabilities. Traditional genetic algorithms have weak local search capabilities, slow convergence speed, low evolutionary efficiency in the later stages, and their parameter settings are sensitive to performance, easily leading to premature convergence to local optima. In summary, existing full-coverage path planning methods suffer from core defects such as high path planning redundancy, imbalance between global and local searches, poor algorithm performance, and insufficient consideration of special constraints in farmland operations. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides a method for full-coverage agricultural machinery path planning based on a fusion ant colony genetic algorithm.
[0004] The present invention achieves the above-mentioned technical objectives through the following technical means.
[0005] A method for full-coverage agricultural machinery path planning based on a fusion ant colony genetic algorithm includes:
[0006] Step 1: Construct a two-dimensional raster map in the simulation environment, and then divide and merge sub-regions on the two-dimensional raster map;
[0007] Step 2: Use the fusion ant colony genetic algorithm to plan the optimal traversal order of the sub-regions. The fusion ant colony genetic algorithm includes initialization parameters, gene pool establishment, path construction, pheromone update, gene pool update, iteration and termination.
[0008] Step 3: Use a spiral path coverage pattern to complete the path coverage within the sub-region, and use the A* path search algorithm to connect the paths between the sub-regions.
[0009] Step four: By combining the optimal traversal order of the sub-regions planned by the ant colony genetic algorithm in step two, the internal path coverage of the sub-regions in step three, and the path connection of the sub-regions based on the A* path search algorithm, the final agricultural machinery full coverage path is generated.
[0010] Furthermore, the specific process of constructing the two-dimensional grid map is as follows: the agricultural machinery operation area is divided into square grid units with a side length equal to the width of the agricultural machinery operation area, feasible areas are marked with white grids, obstacles are marked with black grids, and the edges of the obstacles are expanded.
[0011] Furthermore, the specific process of sub-region division and merging is as follows:
[0012] Segmentation: Establish a coordinate system with the lower left corner vertex of the 2D grid map as the origin, the lower boundary as the X-axis, the left boundary as the Y-axis, and the grid side length as the unit length; along the edge of the obstacle, draw virtual segmentation lines perpendicular to the X-axis and Y-axis respectively to initially divide the entire feasible area into several rectangular sub-regions;
[0013] Merging: For adjacent rectangular sub-regions with equal common side length, a merging operation is performed; vertical merging is prioritized, followed by horizontal merging, ultimately resulting in n regular rectangular sub-regions of different sizes;
[0014] Numbering: Each sub-region is numbered in order from left to right and from bottom to top, and the coordinates of the center point of the sub-region are used as the representative property point of the region.
[0015] Furthermore, the specific process of establishing the gene bank is as follows: based on the traditional genetic algorithm, the sub-regions are traversed to obtain the optimal sub-region traversal sequence of the Nth generation; in the optimal sub-region traversal sequence of the Nth generation, continuous sub-region sequences are selected as genes of the gene bank in descending order of frequency of occurrence, and the number of continuous sub-region sequences is three, and the number of genes in the gene bank does not exceed one-sixth of the total number of sub-regions.
[0016] Furthermore, during the path construction process, restrictions are imposed on the initial and final sub-regions of the ant, specifically: the initial sub-region must be one of the four adjacent sub-regions in the two-dimensional grid map, and the final sub-region must be a boundary sub-region; wherein, the four adjacent sub-regions satisfy at least one of the following conditions:
[0017] (1) and (2) and (3) and (4) and ;
[0018] The boundary subregion satisfies at least one of the following conditions:
[0019] (1) (2) (3) (4) ;
[0020] in, This represents the minimum x-coordinate of the sub-region in the coordinate system. This represents the maximum x-coordinate of the sub-region in the coordinate system. This represents the minimum ordinate of the sub-region in the coordinate system. This represents the maximum ordinate of the sub-region in the coordinate system. This represents the number of columns in the raster map. This represents the number of rows in the raster map.
[0021] Furthermore, during the path construction process, a random decision is made with a preset probability p, and the next sub-region to be visited is determined by a selection mode. The selection modes include ant colony algorithm mode and gene injection mode; specifically as follows:
[0022] 1) Ant Colony Algorithm Mode: If the current gene pool does not contain a gene originating from the current sub-region, or if the current gene pool contains a gene originating from the current sub-region but the preset probability p > 0.3, then by selecting a probability... Find the next sub-region to visit;
[0023] 2) Gene injection mode: If the current gene library contains genes starting from the current sub-region, and the preset probability p ≤ 0.3, firstly, query all genes starting from the current sub-region in the gene library; then, filter out genes whose other two sub-regions have not been visited in the queried genes; finally, insert the two unvisited sub-regions of the filtered genes directly after the sub-region traversal sequence, change the current sub-region to the sub-region at the tail of the filtered genes, and remove the sub-regions in the filtered genes from the set of unvisited sub-regions.
[0024] Furthermore, the selection probability The formula is:
[0025]
[0026] Where allowed is the set of subregions that ant k can currently access. The heuristic function value between subregion i and subregion j. Where α is the pheromone concentration, β is the pheromone importance factor, and β is the heuristic information importance factor.
[0027] The formula for the heuristic function is as follows:
[0028]
[0029] Distance factor The formula is expressed as follows:
[0030]
[0031] in, Let be the shortest obstacle avoidance path length between the center point of one grid cell in subregion i and the center point of one grid cell in subregion j.
[0032] Center distance factor The formula is expressed as follows:
[0033]
[0034]
[0035] in, For the center mass of subregion i and the central mass of subregion j ( The distance between them;
[0036] Obstacle Quantity Factor The formula is expressed as follows:
[0037]
[0038] in, This represents the number of obstacles between subregion i and subregion j.
[0039] Adjacency Factor The formula is expressed as follows:
[0040]
[0041] Furthermore, the specific process of updating the gene pool is as follows: After a path is constructed, genes are selected from the constructed path in descending order of frequency of occurrence, with the selected number not exceeding one-sixth of the total number of sub-regions. These selected genes are then compared with all genes in the current gene pool in terms of coverage path length. Genes are sorted by coverage path length, and those with shorter coverage path lengths are retained. Simultaneously, it must be ensured that the number of genes in the updated gene pool does not exceed one-sixth of the total number of sub-regions. The coverage path length... The formula is expressed as:
[0042]
[0043] in, This refers to a subregion within a gene sequence. It is a sub-region The length of the internal spiral coverage path, It is a sub-region and subregions The minimum A between * Transfer path length.
[0044] Furthermore, the specific process of path coverage within the sub-region is as follows: a counter-clockwise spiral traversal path is executed from the outside to the inside within the current sub-region to be covered, and if the current sub-region to be covered is the last sub-region to be covered, its endpoint is at the center point of the sub-region.
[0045] Furthermore, the specific process of connecting the sub-region paths is as follows: When connecting from the currently covered sub-region to the next sub-region to be covered, one of the four right-angled grids of the next sub-region to be covered is selected as the coverage starting point of the sub-region. The selection principle is as follows: using the A* path search algorithm, the shortest transfer path distance from the end point of the currently covered sub-region to each right-angled grid of the next sub-region to be covered is calculated, and the grid with the shortest transfer path distance is selected as the coverage starting point of the next sub-region to be covered; and the transfer path obtained by the A* path search algorithm is used to reach the coverage starting point of the next sub-region to be covered from the end point of the currently covered sub-region.
[0046] The beneficial effects of this invention are as follows:
[0047] (1) Significantly improves the efficiency and quality of path planning. By integrating the local search capability of ant colony algorithm and the global exploration capability of genetic algorithm, the breadth and depth of the search process are effectively balanced. Ant colony algorithm uses pheromone feedback mechanism to construct high-quality local paths, while genetic algorithm ensures global exploration of sub-region traversal sequences through gene pool mechanism. The two work together to avoid the problem of single algorithm being prone to getting stuck in local optima or slow convergence.
[0048] (2) Reduce the total length and repetition rate of the operation. The innovative sub-region division and optimal traversal sequence solution decompose the complex full coverage problem into two sub-problems: "inter-regional sequence optimization" and "intra-regional coverage optimization". The improved ant colony algorithm is used to solve the sub-regional traversal sequence, and the A* algorithm is combined to optimize the transfer path between regions. This systematically reduces the invalid empty runs and repeated traversals of agricultural machinery between operation areas, thereby significantly shortening the total length of the overall operation path and reducing the path repetition coverage rate.
[0049] (3) Enhance the convergence speed and robustness of the algorithm. A dual-mode path construction mechanism and a dynamic gene pool were introduced. When constructing paths, ants inject high-performance "gene fragments" pre-mined by the genetic algorithm with a certain probability. This provides high-quality initial guidance for the algorithm, effectively overcoming the problem of slow convergence speed caused by pheromone scarcity in the early stage of traditional ant colony algorithms, and accelerating the discovery of high-quality solutions. In addition, a multi-factor fusion heuristic function was designed, which not only considers geometric distance, but also integrates actual farmland environmental factors such as adjacency relationship, number of obstacles, and obstacle avoidance path distance, making the heuristic information more realistic and guiding the search direction more accurately. A feedback update mechanism for the gene pool was implemented, which dynamically eliminates inferior genes and retains high-quality genes according to the iteration results, ensuring the effectiveness and timeliness of prior knowledge, preventing the algorithm from falling into suboptimal solutions, and improving the overall convergence speed and quality of the final solution.
[0050] (4) Enhanced adaptability and practicality to complex farmland environments. The proposed sub-region division method based on obstacle edges can automatically divide and merge unstructured farmland containing irregular obstacles into multiple regular rectangular operation units. This preprocessing not only fits the characteristics of the rectangular operation width of agricultural machinery, but also simplifies the complexity of subsequent path planning, enhancing adaptability to complex farmland with different shapes and obstacles. In sub-region connection and internal coverage, a spiral coverage with an A*-based optimal starting point selection is combined. Spiral coverage ensures the integrity and continuity of internal coverage within sub-regions; the A* algorithm ensures the shortest obstacle avoidance of the transfer path between regions. The combination of the two minimizes the cross-region transfer distance while ensuring full coverage without omissions. Attached Figure Description
[0051] Figure 1 This is the overall flowchart of the agricultural machinery full-coverage path planning method described in this invention.
[0052] Figure 2 This is a schematic diagram of the environmental modeling and sub-region division results described in this invention.
[0053] Figure 3 This is the final effect diagram of the agricultural machinery full coverage path described in this invention. Detailed Implementation
[0054] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but the scope of protection of the present invention is not limited thereto.
[0055] like Figure 1 As shown, a method for full-coverage agricultural machinery path planning based on a fusion ant colony genetic algorithm includes the following steps:
[0056] Step 1: Construct a 2D raster map and divide it into sub-regions in the simulation environment.
[0057] First, a two-dimensional farmland operation scenario was built in the Matlab simulation platform, and a two-dimensional grid map was obtained by mathematically modeling the farmland operation environment based on the grid method. Specifically, the farm machinery operation area was divided into square grid cells with a side length equal to the width of the farm machinery operation area. White grid cells (matrix value 0) were used to mark feasible areas, and black grid cells (matrix value 1) were used to mark obstacles such as trees and ditches. To ensure operational safety, the edges of obstacles were expanded, meaning that any grid cell partially covered by an obstacle was marked as an entire obstacle area.
[0058] Secondly, based on the two-dimensional raster map, a method for sub-region division and merging is implemented, including:
[0059] Segmentation: Establish a coordinate system with the bottom left corner of the 2D raster map as the origin, the bottom boundary as the X-axis, the left boundary as the Y-axis, and the grid side length as the unit length. Along the edge of the obstacle, draw virtual dividing lines perpendicular to the X-axis and Y-axis respectively, initially dividing the entire feasible area into several rectangular sub-regions.
[0060] Merging: For adjacent rectangular sub-regions with equal common side lengths, a merging operation is performed. Vertical merging is prioritized, followed by horizontal merging, ultimately resulting in n regular rectangular sub-regions of varying sizes.
[0061] Numbering: Number each sub-region in order from left to right and from bottom to top (1, 2, …, n), such as Figure 2 As shown, the coordinates of the center point of each sub-region are used as the representative property points of that region. Each sub-region is represented by a mathematical expression: the left boundary is... Indicates that the right boundary is represented by The lower boundary is indicated by... Indicates that the upper boundary is represented by This indicates that the coordinates of the center point are:
[0062]
[0063] in, This represents the minimum x-coordinate of the sub-region in the coordinate system. This represents the maximum x-coordinate of the sub-region in the coordinate system. This represents the minimum ordinate of the sub-region in the coordinate system. This represents the maximum ordinate of the sub-region in the coordinate system.
[0064] Step 2: Use an optimized fusion ant colony genetic algorithm to plan the optimal traversal order for the sub-regions.
[0065] The problem of finding the optimal sub-region traversal order can be viewed as a Traveling Salesman Problem (TSP), where a traveling salesman needs to visit n cities, visiting each city exactly once and visiting every single city. Given the pairwise distances between all cities, the goal is to find the route with the shortest total distance. To solve this TSP, an ant colony genetic algorithm combining an improved heuristic function and a gene injection mechanism is employed. This allows for full-coverage path planning, reducing the number of transfer paths and thus improving the efficiency of agricultural machinery operations.
[0066] The steps of the fusion ant colony genetic algorithm are as follows:
[0067] (1) Initialization parameters. First, set the initial parameters of the algorithm, including the number of ants m, the pheromone importance factor α, the heuristic pheromone importance factor β, the pheromone volatility coefficient ρ, and the total amount of pheromone released Q. Then, randomly place m ants in different cities and initialize the pheromone on all paths to a constant. In this embodiment, the initial pheromone is set to 1, as shown in the following formula:
[0068]
[0069] in, The pheromone between subregion i and subregion j.
[0070] (2) Establishing a gene pool. The establishment of a gene pool aims to reduce the time ants spend searching for paths and improve the efficiency of the ant colony algorithm. Specifically, based on the traditional genetic algorithm, sub-regions are traversed to obtain the optimal sub-region traversal sequence for N generations. In the optimal sub-region traversal sequence for N generations, consecutive sub-region sequences are selected as genes in the gene pool according to their frequency of occurrence from high to low. That is, a short sequence composed of three consecutively visited sub-regions. For example, if a complete path is sub-region A→sub-region B→sub-region C→sub-region D→sub-region E, then [A,B,C] and [B,C,D] are two different genes. The number of consecutive sub-region sequences is three, and the number of genes in the gene pool should not exceed one-sixth of the total number of sub-regions to avoid too many genes, which would cause the ant colony algorithm to become dependent on the gene pool and lose its global exploration ability.
[0071] (3) Constructing a path. Each ant k constructs a complete access sequence independently. The traditional method is as follows: starting from the sub-region where the ant is located, in each step of the path construction, the next unvisited sub-region is selected according to the pseudo-random ratio rule; the sub-region selection operation is iterated according to this logic until all unvisited sub-regions are traversed, and finally a complete path is constructed.
[0072] In the path construction process, this embodiment differs from the randomness of the initial position of ants in the traditional ant colony algorithm. Instead, it restricts the initial and final sub-regions of the ants. Specifically, the initial sub-region must belong to the four adjacent sub-regions in the two-dimensional grid map, and the final sub-region must belong to the boundary sub-region. This facilitates the entry and exit of agricultural machinery before and after operations.
[0073] A sub-region with four adjacent corners means that at least one of the four corners of the sub-region coincides with one of the four corners of the entire raster map, and must meet at least one of the following conditions:
[0074] (1) and (2) and (3) and (4) and .
[0075] A boundary sub-region refers to a sub-region whose four edges coincide with at least one of the four edges of the entire raster map, and must satisfy at least one of the following conditions:
[0076] (1) (2) (3) (4) .
[0077] in, This represents the minimum x-coordinate of the sub-region in the coordinate system. This represents the maximum x-coordinate of the sub-region in the coordinate system. This represents the minimum ordinate of the sub-region in the coordinate system. This represents the maximum ordinate of the sub-region in the coordinate system. This represents the number of columns in the raster map. This represents the number of rows in the raster map.
[0078] In the path construction process, this embodiment differs from the traditional ant colony algorithm, which directly selects probabilities through pseudo-random proportional rules. Instead of determining the next sub-region to be visited, a probability-based decision point is introduced. A random decision is made with a preset probability p (in this embodiment, p ≤ 0.3 to avoid over-reliance on the gene pool for the sub-region traversal sequence). The next sub-region to be visited is determined by a selection mode, which includes "gene injection mode" and "ant colony algorithm mode". Details are as follows:
[0079] 1) Ant Colony Algorithm Mode: If the current gene pool does not contain a gene originating from the current sub-region, or if the current gene pool contains a gene originating from the current sub-region but the random determination result is not to inject the gene (i.e., the preset probability p > 0.3), then by selecting a probability... Find the next sub-region to visit.
[0080] Choose probability It is determined by two parts: pheromone concentration and heuristic information The formula for the probability of selection is:
[0081]
[0082] Where allowed is the set of subregions that ant k can currently access, i.e., the unvisited subregions. Let α be the heuristic function value between subregion i and subregion j, β be the pheromone importance factor, and β be the heuristic information importance factor. α and β are decimals from 0 to 1.
[0083] This embodiment introduces an adjacency factor, an obstacle quantity factor, and a distance factor to innovatively improve the heuristic function, and its formula is as follows:
[0084]
[0085] Distance factor The A* path search algorithm is used to calculate the shortest obstacle avoidance path length between two sub-regions. Specifically, it calculates the shortest obstacle avoidance path length between the center point of one grid cell in sub-region i and the center point of one grid cell in sub-region j. .when A value of 1 indicates that the two sub-regions are adjacent. The distance factor is then calculated using the following formula:
[0086]
[0087] Center distance factor The distance factor is obtained using the heuristic function of the traditional ant colony algorithm, which is calculated by taking the geometric distance between the center points of two sub-regions. The formula is as follows:
[0088]
[0089]
[0090] in, For the center mass of subregion i and the central mass of subregion j ( The distance between them.
[0091] Obstacle Quantity Factor The Bresenham algorithm is used to draw a straight line connecting the center points of two sub-regions. The number of obstacles the line passes through is calculated and recorded. Then, the obstacle quantity factor is calculated using the following formula:
[0092]
[0093] in, This represents the number of obstacles between subregion i and subregion j.
[0094] Adjacency Factor The conditions for traversing the next sub-region are set as follows: First, adjacent boundary sub-regions are traversed, with an adjacency factor of 100; second, sub-regions separated by only one obstacle are traversed, with an adjacency factor of 50; finally, the adjacency factor of other sub-regions is set to 1. The formula is expressed as follows:
[0095]
[0096] 2) Gene Injection Mode: If the current gene bank contains genes starting from the current sub-region, and the random determination result is to perform gene injection (i.e., the preset probability p ≤ 0.3), firstly, all genes starting from the current sub-region are queried in the gene bank; then, genes whose other two sub-regions have not been visited are selected from the queried genes (if more than one gene is selected, one is chosen for subsequent processes); finally, the two unvisited sub-regions from the selected genes are directly inserted after the sub-region traversal sequence, changing the current sub-region to the sub-region at the end of the selected gene, and removing the sub-regions from the set of unvisited sub-regions. For example, if the current sub-region is sub-region A, the gene bank contains a gene [A, B, C], and sub-regions B and C have not been visited, sub-regions B and C are directly inserted after the sub-region traversal sequence, changing the current sub-region to sub-region C, and removing sub-regions B and C from the set of unvisited sub-regions.
[0097] (4) Pheromone Update. After all ants have completed path construction, a global pheromone update is performed. This process consists of the following two parts:
[0098] 1) Pheromones evaporate:
[0099] The pheromone evaporation formula is: ,in, ρ is the volatile coefficient of the pheromone, 0 < ρ < 1. Volatilization helps to "forget" bad paths, giving the algorithm a chance to explore new areas.
[0100] 2) Pheromone release:
[0101] Each ant k releases pheromones along its path. The pheromone increment is inversely proportional to the total length of the path traveled by the ant. The formula for the pheromone increment is: ,in, Let Q be the path length of the k-th ant, and let Q be the pheromone enhancement strength. In this example, Q=1, which means that the shorter the ant's path, the more pheromones are released.
[0102] Based on pheromone volatilization and release, the pheromone is updated using the following formula: .
[0103] (5) Gene pool update. After all ants have completed path construction, the gene pool is updated. Gene evaluation is performed after the ant colony algorithm completes one path construction iteration. To ensure the superiority of genes in the gene pool, this embodiment introduces a gene pool feedback mechanism to eliminate genes with longer path coverage lengths: After one path construction is completed, genes are selected from the constructed paths in descending order of frequency, with the selected number not exceeding one-sixth of the total number of genes in the sub-region. These selected genes are compared with all genes in the current gene pool in terms of coverage path length, sorted by coverage path length, and genes with shorter coverage path lengths are retained. Simultaneously, it must be ensured that the number of genes in the updated gene pool does not exceed one-sixth of the total number of genes in the sub-region. Here, each gene in the gene pool is defined to have a coverage path length value. The smaller the value, the better the gene. This value represents the length of the coverage path between the three nodes, expressed by the formula:
[0104]
[0105] in, This refers to a subregion within a gene sequence. It is a sub-region The length of the internal spiral coverage path, It is a sub-region and subregions The minimum A between * Length of the transition path. Minimum A here. * The transfer path length (sub-region path connection) and spiral coverage path length (internal path coverage) are based on the content of step three.
[0106] (6) Iteration and Termination. Repeat steps (3) and (5). When the preset maximum number of iterations is reached or the optimal solution no longer improves in multiple iterations, the algorithm terminates and outputs the global shortest path found in each generation of ants, thus obtaining the optimal traversal order of the sub-region.
[0107] Step 3: Path coverage within sub-regions and path connection within sub-regions based on the A* path search algorithm
[0108] Within the current sub-region, a spiral path coverage pattern is adopted. When the current sub-region is fully covered, a transition path from the current sub-region to the next sub-region needs to be planned. Details are as follows:
[0109] For the current sub-region to be covered, a counter-clockwise spiral traversal path is executed from the outside to the inside. If the current sub-region to be covered is the last sub-region to be covered, its endpoint is the center point of the sub-region. Based on this, the path coverage of the sub-region to be covered is achieved, and the endpoint position of the current traversal is recorded.
[0110] When transitioning from a currently covered sub-region to the next sub-region to be covered, one of the four right-angled grid cells in the next sub-region is selected as the coverage starting point. The selection principle is as follows: using the A* path search algorithm, the shortest transfer path distance from the end point of the currently covered sub-region to each right-angled grid cell in the next sub-region to be covered is calculated, and the grid cell with the shortest transfer path distance is selected as the coverage starting point of the next sub-region to be covered. The transfer path obtained by the A* path search algorithm is then used to reach the coverage starting point of the next sub-region from the end point of the currently covered sub-region.
[0111] This method combines systematic coverage within sub-regions with cross-regional starting point optimization based on the A* path search algorithm, which can effectively reduce the length of movement paths between regions and improve overall coverage efficiency while ensuring coverage integrity.
[0112] Step 4: Full Coverage Path Planning
[0113] The full-coverage path planning is completed based on the methods in steps two and three. First, the traversal order of sub-regions is determined based on the method in step two. Then, the internal path coverage of each sub-region and the path connection between sub-regions are completed based on the method in step three, thereby generating the final full-coverage agricultural machinery path. Figure 3 As shown.
[0114] The embodiments described above are preferred embodiments of the present invention, but the present invention is not limited to the above embodiments. Any obvious improvements, substitutions or modifications that can be made by those skilled in the art without departing from the essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A method for full-coverage agricultural machinery path planning based on a fusion ant colony genetic algorithm, characterized in that, include: Step 1: Construct a two-dimensional raster map in the simulation environment, and then divide and merge sub-regions on the two-dimensional raster map; Step 2: Use the fusion ant colony genetic algorithm to plan the optimal traversal order of the sub-regions. The fusion ant colony genetic algorithm includes initialization parameters, gene pool establishment, path construction, pheromone update, gene pool update, iteration and termination. Step 3: Use a spiral path coverage pattern to complete the path coverage within the sub-region, and use the A* path search algorithm to connect the paths between the sub-regions. Step four: By combining the optimal traversal order of the sub-regions planned by the ant colony genetic algorithm in step two, the internal path coverage of the sub-regions in step three, and the path connection of the sub-regions based on the A* path search algorithm, the final agricultural machinery full coverage path is generated.
2. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, The specific process of constructing the two-dimensional grid map is as follows: the agricultural machinery operation area is divided into square grid units with a side length equal to the width of the agricultural machinery operation area, feasible areas are marked with white grids, obstacles are marked with black grids, and the edges of the obstacles are expanded.
3. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, The specific process of subregion division and merging is as follows: Segmentation: Establish a coordinate system with the lower left corner vertex of the 2D grid map as the origin, the lower boundary as the X-axis, the left boundary as the Y-axis, and the grid side length as the unit length; along the edge of the obstacle, draw virtual segmentation lines perpendicular to the X-axis and Y-axis respectively to initially divide the entire feasible area into several rectangular sub-regions; Merging: For adjacent rectangular sub-regions with equal common side length, a merging operation is performed; vertical merging is prioritized, followed by horizontal merging, ultimately resulting in n regular rectangular sub-regions of different sizes; Numbering: Each sub-region is numbered in order from left to right and from bottom to top, and the coordinates of the center point of the sub-region are used as the representative property point of the region.
4. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, The specific process of establishing the gene bank is as follows: based on the traditional genetic algorithm, the sub-regions are traversed to obtain the optimal sub-region traversal sequence of the Nth generation; in the optimal sub-region traversal sequence of the Nth generation, continuous sub-region sequences are selected as genes of the gene bank in descending order of frequency of occurrence, and the number of continuous sub-region sequences is three, and the number of genes in the gene bank does not exceed one-sixth of the total number of sub-regions.
5. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, During the path construction process, restrictions are imposed on the initial and final sub-regions of the ant, specifically: the initial sub-region must be one of the four adjacent sub-regions in a two-dimensional grid map, and the final sub-region must be a boundary sub-region; wherein, the four adjacent sub-regions satisfy at least one of the following conditions: (1) and (2) and (3) and (4) and ; The boundary subregion satisfies at least one of the following conditions: (1) ;(2) ;(3) ;(4) ; in, This represents the minimum x-coordinate of the sub-region in the coordinate system. This represents the maximum x-coordinate of the sub-region in the coordinate system. This represents the minimum ordinate of the sub-region in the coordinate system. This represents the maximum ordinate of the sub-region in the coordinate system. This represents the number of columns in the raster map. This represents the number of rows in the raster map.
6. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, During the path construction process, a random decision is made with a preset probability p, and the next sub-region to be visited is determined by a selection mode. The selection modes include ant colony algorithm mode and gene injection mode; as detailed below: 1) Ant Colony Algorithm Mode: If the current gene pool does not contain a gene originating from the current sub-region, or if the current gene pool contains a gene originating from the current sub-region but the preset probability p > 0.3, then by selecting a probability... Find the next sub-region to visit; 2) Gene injection mode: If the current gene library contains genes starting from the current sub-region, and the preset probability p ≤ 0.3, firstly, query all genes starting from the current sub-region in the gene library; Then, the genes whose other two sub-regions in the queried genes have not been visited are selected; finally, the two unvisited sub-regions in the selected genes are directly inserted after the sub-region traversal sequence, and the current sub-region is changed to the sub-region at the tail of the selected gene, and the sub-regions in the selected genes are removed from the set of unvisited sub-regions.
7. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 6, characterized in that, The selection probability The formula is: Where allowed is the set of subregions that ant k can currently access. The heuristic function value between subregion i and subregion j. Where α is the pheromone concentration, β is the pheromone importance factor, and β is the heuristic information importance factor. The formula for the heuristic function is as follows: Distance factor The formula is expressed as follows: in, Let be the shortest obstacle avoidance path length between the center point of one grid cell in subregion i and the center point of one grid cell in subregion j. Center distance factor The formula is expressed as follows: in, For the center mass of subregion i and the central mass of subregion j ( The distance between them; Obstacle Quantity Factor The formula is expressed as follows: in, This represents the number of obstacles between subregion i and subregion j. Adjacency Factor The formula is expressed as follows:
8. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, The specific process of updating the gene bank is as follows: After a path is constructed, genes are selected from the constructed path in descending order of frequency, with the number of selected genes not exceeding one-sixth of the total number of genes in the sub-region. These selected genes are then compared with all genes in the current gene bank in terms of coverage path length. Genes are sorted by coverage path length, and those with shorter coverage path lengths are retained. Simultaneously, it must be ensured that the number of genes in the updated gene bank does not exceed one-sixth of the total number of genes in the sub-region. The coverage path length... The formula is expressed as: in, This refers to a subregion within a gene sequence. It is a sub-region The length of the internal spiral coverage path, It is a sub-region and subregions The minimum A between * Transfer path length.
9. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, The specific process of path coverage within the sub-region is as follows: a counter-clockwise spiral traversal path is executed from the outside to the inside within the current sub-region to be covered, and if the current sub-region to be covered is the last sub-region to be covered, its endpoint is the center point of the sub-region.
10. The agricultural machinery full-coverage path planning method based on fused ant colony genetic algorithm according to claim 1, characterized in that, The specific process of connecting sub-region paths is as follows: When connecting from the currently covered sub-region to the next sub-region to be covered, select one of the four right-angled grids of the next sub-region to be covered as the coverage starting point of the sub-region. The selection principle is as follows: use the A* path search algorithm to calculate the shortest transfer path distance from the end point of the currently covered sub-region to each right-angled grid of the next sub-region to be covered, and select the grid with the shortest transfer path distance as the coverage starting point of the next sub-region to be covered; and use the transfer path obtained by the A* path search algorithm to reach the coverage starting point of the next sub-region to be covered from the end point of the currently covered sub-region.