Path planning method and device, electronic equipment and computer program product
By integrating heuristic factors of road congestion and smoothness with the ant colony algorithm, an optimal path that avoids congestion and is smooth is generated, solving the problem of inaccuracy in urban waste collection and transportation route planning and improving waste collection and transportation efficiency and the accuracy of path planning.
Patent Information
- Application Number
- CN202511108274.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-10-17
AI Technical Summary
Existing urban waste collection and transportation route planning technologies suffer from inaccurate path planning, especially in complex urban environments. Traditional ant colony algorithms are inefficient and prone to getting trapped in local optima when dealing with dynamic traffic data and multiple constraints.
By integrating road congestion and road smoothness as heuristic factors and combining them with the ant colony algorithm, the target path is generated through iterative calculation. The pheromone update mechanism of ants in path selection is used to avoid local optima and ensure the smoothness and safety of the path.
It enables more precise route planning, improves waste collection and transportation efficiency, avoids efficiency losses caused by road congestion, ensures route smoothness and safety, and enhances the accuracy and real-time adaptability of route planning.
Smart Images

Figure CN120802957A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of path planning, and in particular to a path planning method, device, electronic device and computer program product. Background Art
[0002] Optimizing municipal waste collection and transportation systems is a major challenge in global urban management. With the acceleration of urbanization, the amount of municipal waste generated continues to grow, and the requirements for waste collection and transportation efficiency and environmental performance are also increasing. Traditional waste collection and transportation routes are often fixed, resulting in inefficient resource utilization and increased environmental pollution. Therefore, optimizing waste collection and transportation routes to improve efficiency and reduce carbon emissions has become an urgent issue that needs to be addressed.
[0003] Urban waste collection and transportation route planning is essentially a special form of the Traveling Salesman Problem (TSP), a classic problem in operations research and computational mathematics. The core of the TSP is to find the shortest possible route, allowing the salesperson to visit each city exactly once and return to the starting point. This problem was first proposed by mathematicians in 1930 and has been a focus of algorithmic research since the early days of computer science.
[0004] In the study of the Traveling Salesperson (TSP) problem, numerous algorithms have been proposed to seek near-optimal solutions, especially for large-scale problems. The ant colony algorithm, a search strategy that mimics the foraging behavior of ants, is one effective approach to solving the TSP problem. This algorithm simulates the behavior of ants searching for food paths and uses pheromones to guide the search process, effectively finding an approximate shortest path. In urban environments with multiple variables and constraints, traditional ant colony algorithms require a long time to converge, impacting the timeliness of decision-making. They are also prone to falling into local optimal solutions during the search process, especially in complex scenarios such as urban waste collection and transportation, which require consideration of multiple constraints (such as traffic conditions, time windows, and environmental requirements).
[0005] Ant colony algorithms, as effective optimization tools, have demonstrated excellent optimization potential in various fields, such as logistics and production scheduling. However, when applied to complex urban waste collection and transportation systems, these algorithms need to adapt to the unique urban traffic and geographical conditions, as well as environmental requirements, which further complicates the problem. In practical applications, their adaptability to dynamic traffic data remains limited, and their ability to handle real-time changes in road conditions is not strong enough, resulting in inaccurate path planning.
[0006] Regarding the above-mentioned existing urban garbage collection and transportation route planning technology, there is a problem of inaccurate path planning, and no effective solution has been proposed yet. Summary of the Invention
[0007] Embodiments of the present application provide a path planning method and device, electronic equipment and computer program product to at least solve the technical problem of inaccurate path planning in existing urban garbage collection and transportation route planning technology.
[0008] According to an aspect of the embodiments of the present application, a path planning method is provided, comprising: obtaining a set of to-be-planned sites, wherein the set of to-be-planned sites comprises a plurality of to-be-planned sites; determining a road congestion degree and a road smoothness degree between a first site and a second site, wherein the first site and the second site are any two to-be-planned sites in the set of to-be-planned sites; determining a first heuristic factor according to the road congestion degree and a second heuristic factor according to the road smoothness degree, wherein the first heuristic factor and the second heuristic factor represent the expected degree of movement from the first site to the second site, and the road smoothness degree at least represents the flatness of the road surface; and generating a target path according to the first heuristic factor and the second heuristic factor between a plurality of to-be-planned sites in the set of to-be-planned sites using an ant colony algorithm, wherein the target path passes through all the to-be-planned sites in the set of to-be-planned sites.
[0009] Optionally, generating a target path according to the first heuristic factor and the second heuristic factor between a plurality of to-be-planned sites in the set of to-be-planned sites using an ant colony algorithm comprises: randomly placing a plurality of ants in a preset ant colony in different to-be-planned sites, wherein the ants are used to simulate objects moving between the to-be-planned sites; performing a predetermined number of iterations on the preset ant colony to obtain the target path, wherein the target path is a candidate path obtained by the preset ant colony based on the last iteration, the candidate path is a movement path obtained by a last ant in the same preset ant colony moving a plurality of times, the movement path passes through all the to-be-planned sites in the set of to-be-planned sites, in the process of each movement of the ant, the second site of each movement is selected according to the first heuristic factor, the second heuristic factor and residual pheromone, and the residual pheromone is updated on the path of each movement until the second site is the last to-be-planned site in the set of to-be-planned sites, the residual pheromone is locally updated after each movement of the ant, and globally updated after each ant in the same preset ant colony completes movement.
[0010] Optionally, the calculation process in each iteration comprises: traversing each of the ants in the preset ant colony, and taking each of the ants as a target ant after each traversal; iteratively selecting a target station for each movement of the target ant in the set of to-be-planned stations according to a predetermined transition probability, until the target station is the last to-be-planned station in the set of to-be-planned stations, wherein the transition probability is positively correlated with the first heuristic factor, the second heuristic factor, and the residual pheromone respectively, and the target station is the to-be-planned station with the maximum transition probability in the set of to-be-planned stations; generating the movement path according to a plurality of target stations passed through by the target ant in a plurality of movements, and performing the local pheromone update on the residual pheromone between two to-be-planned stations passed through by each movement; in the case that the target ant is the last ant traversed from the preset ant colony, determining the movement path as the candidate path obtained by the current iteration calculation, and performing the global pheromone update on the residual pheromone between any two to-be-planned stations in the candidate path.
[0011] Optionally, iteratively selecting a target station for each movement of the target ant in the set of to-be-planned stations according to a predetermined transition probability, until the target station is the last to-be-planned station in the set of to-be-planned stations comprises: determining the to-be-planned station where the target ant is located as the first station, wherein there are a plurality of second stations corresponding to the same first station; calculating the transition probability of each second station according to the first heuristic factor, the second heuristic factor, and the residual pheromone; determining the second station with the highest transition probability as the target station; in the case that the target station is not the last to-be-planned station in the set of to-be-planned stations, determining the target station as the first station.
[0012] Optionally, after determining the second station with the highest transition probability as the target station, the method further comprises: moving the target station from the set of to-be-planned stations to a set of taboo stations; detecting whether the set of to-be-planned stations is empty; in the case that the set of to-be-planned stations is not empty, determining that the target station is not the last to-be-planned station in the set of to-be-planned stations.
[0013] Optionally, after obtaining the target path through the iteration calculation of the preset ant colony for a predetermined number of times, the method further comprises: adjusting the weight values corresponding to the first heuristic factor, the second heuristic factor, and the residual pheromone respectively by using a genetic algorithm, to obtain the target path that meets the preset path requirement.
[0014] Optionally, after the target path is generated by using the ant colony algorithm according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned stations in the to-be-planned station set, the method further includes: moving according to the arrangement order of the to-be-planned stations in the target path; detecting an average speed of reaching the to-be-planned station along the target path in the case of moving to each to-be-planned station; in the case that the average speed does not meet a preset speed requirement, generating the to-be-planned station set according to the plurality of to-be-planned stations not passed through in the target path, and updating the target path by using the ant colony algorithm according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned stations in the to-be-planned station set.
[0015] According to another aspect of the embodiments of the present application, a path planning device is further provided, which comprises: an acquisition module configured to acquire a to-be-planned station set, wherein the to-be-planned station set comprises a plurality of to-be-planned stations; a first determination module configured to determine a road congestion degree and a road smoothness degree between a first station and a second station, wherein the first station and the second station are any two to-be-planned stations in the to-be-planned station set; a second determination module configured to determine a first heuristic factor according to the road congestion degree and a second heuristic factor according to the road smoothness degree, wherein the first heuristic factor and the second heuristic factor represent an expected degree of moving from the first station to the second station, and the road smoothness degree at least represents a flatness of a road surface; and a generation module configured to generate a target path by using an ant colony algorithm according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned stations in the to-be-planned station set, wherein the target path passes through all the to-be-planned stations in the to-be-planned station set.
[0016] According to another aspect of the embodiments of the present application, an electronic device is further provided, which comprises a memory and a processor, the memory stores a computer program, and the processor is configured to execute the path planning method by using the computer program.
[0017] According to another aspect of the embodiments of the present application, a computer program product is further provided, which comprises computer instructions, and the computer instructions are executed by a processor to implement the steps of the path planning method.
[0018] In the embodiment of the present application, the road congestion degree and the road smoothness degree are fused as heuristic factors, which can more accurately reflect the actual road conditions of urban garbage collection and transportation. By fusing the two key heuristic factors, i.e., the road congestion degree and the road smoothness degree, multiple factors can be comprehensively considered to realize more intelligent and efficient path planning. Through iterative calculation of the ant colony algorithm, an optimal path that avoids congestion and ensures road smoothness can be explored, which effectively avoids the efficiency loss caused by road congestion and ensures the smoothness and safety of the path, thereby realizing the technical effect of improving the accuracy of path planning, significantly improving the garbage collection and transportation efficiency, and further solving the technical problem of inaccurate path planning in the existing urban garbage collection and transportation route planning technology. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0020] Figure 1 is a flowchart of a path planning method according to an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of an improved ant colony algorithm according to an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of updating a planned path according to road congestion conditions using an ant colony algorithm according to an embodiment of the present application;
[0023] Figure 4 is a schematic diagram of a planned path generated using an ant colony algorithm according to an embodiment of the present application;
[0024] Figure 5 is a schematic diagram of a planned path generated using an ant colony algorithm according to an embodiment of the present application;
[0025] Figure 6 is a schematic diagram of a path planning device according to an embodiment of the present application;
[0026] Figure 7 is a structural block diagram of a computer terminal according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort should belong to the protection scope of the present application.
[0028] It should be noted that the terms "first", "second" and the like in the description and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in other than the order illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a list of steps or units need not be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products or devices.
[0029] According to an embodiment of the present application, a path planning method is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0030] Figure 1 is a flowchart of a path planning method according to an embodiment of the present application, as shown in Figure 1 The method comprises the following steps:
[0031] Step S102, obtaining a set of to-be-planned sites, wherein the set of to-be-planned sites comprises a plurality of to-be-planned sites;
[0032] Step S104, determining a road congestion degree and a road smoothness degree between a first site and a second site, wherein the first site and the second site are any two to-be-planned sites in the set of to-be-planned sites, and the road smoothness degree at least represents the flatness of the road surface;
[0033] Step S106, determining a first heuristic factor according to the road congestion degree and a second heuristic factor according to the road smoothness degree, wherein the first heuristic factor and the second heuristic factor represent the expected degree of moving from the first site to the second site;
[0034] Step S108, an ant colony algorithm is used to generate a target path according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned sites in the to-be-planned site set, wherein the target path passes through all the to-be-planned sites in the to-be-planned site set.
[0035] In the embodiment of the present application, the road congestion degree and the road smoothness degree are fused as heuristic factors, which can more accurately reflect the actual road conditions of urban garbage collection and transportation. By fusing the two key heuristic factors, i.e., the road congestion degree and the road smoothness degree, multiple factors can be comprehensively considered to achieve more intelligent and efficient path planning. Through iterative calculation of the ant colony algorithm, an optimal path that avoids congestion and ensures road smoothness can be explored, which effectively avoids the efficiency loss caused by road congestion and ensures the smoothness and safety of the path, thereby achieving the technical effect of improving the accuracy of path planning, significantly improving the efficiency of garbage collection and transportation, and solving the technical problem of inaccurate path planning in the existing urban garbage collection and transportation route planning technology.
[0036] In the above step S102, the to-be-planned site is a position that must be passed through for path planning, which can be a garbage station. The planned path (such as the target path) can be a garbage transfer vehicle for collecting and transporting garbage from each garbage station.
[0037] In the above step S104, the road congestion degree and the road smoothness degree are numerical evaluations of the road between the first site and the second site.
[0038] In the above step S104, the road congestion degree can be determined by real-time traffic data, and the road smoothness degree can be evaluated by historical maintenance records or vehicle driving data.
[0039] In the above step S104, the road smoothness degree is determined at least according to the flatness and slope of the road surface.
[0040] In the above step S106, the heuristic factor (Enrichment Factor) is one of the key parameters in the ant colony algorithm (ACO), which is used to guide ants to preferentially select better paths in the search process. The heuristic factor and the pheromone factor jointly affect the decision probability of ants.
[0041] In the step S108, the ant colony optimization (ACO) is a swarm intelligence optimization algorithm simulating the foraging behavior of ants in nature, mainly used to solve combinatorial optimization problems (such as the traveling salesman problem, path planning, etc.). The core idea is to gradually converge to the global optimal solution through the positive feedback mechanism of the ant colony and the pheromone evaporation mechanism. Among them, the ants release pheromones on the path, and the subsequent ants select the path according to the pheromone concentration, forming a positive feedback, in which the pheromones of high-quality paths are added, and the pheromones of low-quality paths are volatilized over time.
[0042] As an optional embodiment, the ant colony algorithm generates the target path according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned sites in the to-be-planned site set, including: randomly placing a plurality of ants in the preset ant colony in different to-be-planned sites, wherein the ants are used to simulate objects moving between the to-be-planned sites; performing a predetermined number of iteration calculations on the preset ant colony to obtain the target path, wherein the target path is a candidate path obtained by the preset ant colony based on the last iteration calculation, and the candidate path is a movement path obtained by the last ant in the same preset ant colony moving a plurality of times, the movement path passes through all to-be-planned sites in the to-be-planned site set, in the process of each movement of the ant, the second site of each movement is selected according to the first heuristic factor, the second heuristic factor and the residual pheromone, and the residual pheromone is updated on the path of each movement, until the second site is the last to-be-planned site in the to-be-planned site set, the residual pheromone is updated locally after each movement of the ant, and the global pheromone is updated after each ant in the same preset ant colony completes the movement.
[0043] In the above embodiments of the present application, the ant colony algorithm simulates the behavior of ants finding food in nature, and uses the first heuristic factor (road congestion degree) and the second heuristic factor (road smoothness) to guide the ants to find the optimal path in the iteration process. The update mechanism of the residual pheromone, including local update and global update, ensures the convergence of the algorithm and the diversity of the path, avoiding the trap of local optimal solution.
[0044] The above path planning method of the present application can be applied in garbage collection and transportation, logistics distribution, urban public transportation and other scenarios, and the path is optimized by intelligent algorithm, effectively improving the service efficiency and user experience.
[0045] As an optional embodiment, the iteration calculation process comprises: traversing each ant in the preset ant colony, and taking each traversed ant as a target ant; iteratively selecting a target station for each movement of the target ant in the set of to-be-planned stations according to a predetermined transition probability until the target station is the last to-be-planned station in the set of to-be-planned stations, wherein the transition probability is positively correlated with the first heuristic factor, the second heuristic factor and the residual pheromone respectively, and the target station is the to-be-planned station with the maximum transition probability in the set of to-be-planned stations; generating a movement path according to the plurality of target stations passed through by the target ant in the plurality of movements, and performing local pheromone updating on the residual pheromone between the two to-be-planned stations passed through by the target ant in each movement; in the case that the target ant is the last ant traversed from the preset ant colony, determining the movement path as a candidate path obtained by the current iteration calculation, and performing global pheromone updating on the residual pheromone between any two to-be-planned stations in the candidate path.
[0046] In the above embodiments of the present application, in each iteration calculation process, the movement of each ant in the preset ant colony is affected by the pheromone left by the previous ant, and the heuristic of the road congestion degree and the road smoothness degree is combined to gradually optimize the path selection and finally find a path that is both fast and smooth.
[0047] Optionally, the residual pheromone can be represented by pheromone concentration. The ant releases pheromone during movement. The more ants pass through a path, the higher the pheromone concentration, and the greater the probability of subsequent ants selecting the path. However, the pheromone will gradually volatilize over time (such as calculation time). For example, the ant releases pheromone on the path it passes through, but as time (such as calculation time) increases, the pheromone on the path volatilizes, thereby reducing the pheromone concentration on the path. Therefore, only a small number of ants pass through the path, and the pheromone released by the ants volatilizes when they pass through, thereby maintaining a relatively low concentration. Therefore, the path will not be the optimal path for subsequent ants, thereby avoiding premature convergence of the ant colony algorithm to a local optimal solution.
[0048] Optionally, the pheromone of the current path can be updated in real time during the movement of each ant by means of local pheromone updating. The local pheromone updating usually adopts a decay model (such as multiplying a volatilization coefficient).
[0049] Optionally, the local pheromone updating method is as follows:
[0050] τ ij (t+1)=(1-ε)·τ ij (t)+ε·τ0;
[0051] wherein t is the calculation time of the iteration calculation; τ0 is the pheromone at the beginning of each iteration; ε is the volatilization coefficient of the pheromone during local updating; τij is the residual pheromone on the link from site i to site j; τ ij (t) is the residual pheromone on the link from site i to site j before the ant moves from site i to site j; τ ij (t+1) is the updated residual pheromone on the link from site i to site j after the ant moves from site i to site j.
[0052] Optionally, through global pheromone updating, the pheromone of the optimal path (or part of the high-quality solution) can be reinforced after each iteration.
[0053] Optimization variant: the Max-Min Ant System (MMAS) prevents concentration polarization by setting upper and lower limits on pheromone.
[0054] Optionally, the global pheromone updating method is as follows:
[0055] τ ij = (1- p) τ ij + p / L best ;
[0056] where τ ij is the residual pheromone on the link from site i to site j; L best is the optimal path length at the end of a cycle; p is the pheromone evaporation coefficient, between 0 and 1.
[0057] The above embodiments of the present application are not only applicable to garbage collection and transportation scenarios, but can also be applied to scenarios that need to consider road conditions and efficiency, including but not limited to emergency rescue, express delivery, and travel route planning. By dynamically adjusting the path, the ability to respond to unexpected situations is improved, and the flexibility and robustness of the system are enhanced.
[0058] As an optional embodiment, according to a predetermined transition probability, the target site of each movement of the target ant is iteratively selected from the set of to-be-planned sites until the target site is the last to-be-planned site in the set of to-be-planned sites, including: determining the to-be-planned site where the target ant is located as a first site, wherein there are a plurality of second sites corresponding to the same first site; calculating the transition probability of each second site according to the first heuristic factor, the second heuristic factor, and the residual pheromone; determining the second site with the highest transition probability as the target site; in the case where the target site is not the last to-be-planned site in the set of to-be-planned sites, determining the target site as the first site.
[0059] The above embodiments of the present application ensure that the selection of each ant movement is based on the current optimal conditions through dynamic calculation of the transition probability, thereby avoiding the blindness and randomness in path planning and improving the accuracy and efficiency of path planning.
[0060] Optionally, the transition probability is shown as follows:
[0061]
[0062] wherein t is the calculation time; is the probability of the kth ant moving from i to j; τ ij is the residual pheromone concentration on the road segment between site i and site j (i.e., residual pheromone); η ij is a heuristic function, representing the expected degree of the ant from i to j when at site i; α, β, and γ are the weights of pheromone and heuristic factor, respectively; η0(i, j) represents the influence of road congestion degree on the expected degree of the ant from i to j when at site i (i.e., the first heuristic factor); η1(i, j) represents the influence of road smoothness and road slope (e.g., road smoothness) on the expected degree of the ant from i to j when at site i (i.e., the second heuristic factor); o represents the next site to which the kth ant can be allowed to go; allow k is the set of next sites to which the kth ant can be allowed to go, and the allow k may be a subset of the set of sites to be planned.
[0063] It should be noted that if there is no road directly connecting two sites in the set of sites to be planned, the two sites are not allowed to go to each other. The allowed sites can be selected from the set of sites to be planned to obtain the allow k of each site to be planned. Alternatively, the residual pheromone on the path between the two sites not allowed to go to each other can be set to a constant 0 in the ant colony algorithm.
[0064] As an optional embodiment, after determining the second site with the highest transition probability as the target site, the method further comprises: moving the target site from the set of sites to be planned to the set of taboo sites; detecting whether the set of sites to be planned is empty; and in the case that the set of sites to be planned is not empty, determining that the target site is not the last site to be planned in the set of sites to be planned.
[0065] The above embodiments of the present application add the visited sites in the set of sites to be planned to the set of taboo sites, avoiding repeated visits, ensuring the continuity and integrity of the path, solving the possible loop or redundancy problem in path planning, and improving the efficiency and practicality of path planning.
[0066] As an optional embodiment, after the target path is obtained through a predetermined number of iterations of the preset ant colony, the method further comprises: adjusting the weight values corresponding to the first heuristic factor, the second heuristic factor and the residual pheromone respectively by using a genetic algorithm to obtain a target path that meets the preset path requirements.
[0067] The introduction of the genetic algorithm in the above embodiments of the application enables the path planning method to further optimize the weights of the heuristic factors, gradually adjusts the weight values to adapt to changing environmental conditions through simulating natural selection and genetic variation in the biological evolution process, solves the problem of local optimal solution that the ant colony algorithm may encounter in a complex environment, improves the global optimization capability of the path planning, and the combination of the ant colony algorithm and the genetic algorithm not only improves the efficiency of the path planning, but also ensures the optimization of the planned path, thereby greatly reducing carbon emissions in the garbage collection and transportation process and improving energy utilization efficiency.
[0068] For example, in garbage collection and transportation, the genetic algorithm can dynamically adjust the weights of road congestion degree and road smoothness degree according to real-time traffic conditions and road maintenance records, ensure that the planned path is both fast and safe, reduce operational risks and improve service quality.
[0069] Alternatively, the preset path requirements can be requirements for carbon emissions, after obtaining the target path through the above step S108, the carbon emissions generated by moving according to the target path can be predicted, and then it is evaluated whether the carbon emissions of the target path meet the requirements for carbon emissions, and further, in the case that the carbon emissions of the target path meet the requirements for carbon emissions, the target path is determined as the final planned path; in the case that the carbon emissions of the target path do not meet the requirements for carbon emissions, the weight values corresponding to the parameters (the first heuristic factor, the second heuristic factor and the residual pheromone) used by the ant colony algorithm can be adjusted by using the genetic algorithm to optimize the target path until a target path that meets the requirements for carbon emissions is obtained.
[0070] As an optional embodiment, after the target path is obtained by using the ant colony algorithm according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned stations in the to-be-planned station set, the method further comprises: moving according to the arrangement order of the to-be-planned stations in the target path; detecting the average speed of reaching the to-be-planned stations along the target path in the case of moving to each to-be-planned station; in the case that the average speed does not meet the preset speed requirements, generating a to-be-planned station set according to the plurality of to-be-planned stations not passed through in the target path, and updating the target path by using the ant colony algorithm according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned stations in the to-be-planned station set.
[0071] The above embodiments of the present application can move according to the target path after the target path is generated, and can monitor the path execution in real time during the movement process, so as to realize dynamic adjustment of path planning. For example, in the garbage collection and transportation process, if the average speed of a certain path is lower than the preset value due to a sudden traffic event, the path will be automatically re-planned to avoid the congested road section, so as to ensure that the garbage collection and transportation task can be completed on time. Through the updating mechanism of the target path, the real-time performance and adaptability of the path planning are improved, and the rigid problem of the traditional planning method in the face of sudden situations is solved, which has a significant effect on improving the operation efficiency and service quality in fields including but not limited to garbage collection and transportation, logistics distribution, public transportation and the like.
[0072] The above embodiments of the present application realize the function of dynamically adjusting the path by updating the target path, can respond to the change of the traffic condition in real time, further enhance the flexibility and practicability of the path planning, and have a significant promoting effect on improving the overall operation efficiency of the urban garbage collection and transportation system.
[0073] The present application also provides a preferred embodiment, which provides a method for planning a garbage collection and transportation path in a city. The method proposes an improved ant colony algorithm, which is specially designed for dynamic optimization of the urban garbage collection and transportation system. The improved ant colony algorithm not only considers the real-time road congestion condition and the shortest path, but also integrates environmental factors such as road congestion condition, carbon emission and energy efficiency, so as to promote sustainable development. Through experimental verification, the algorithm shows better potential than the traditional method in improving the garbage collection and transportation efficiency and environmental friendliness.
[0074] Figure 2 is a schematic diagram of an improved ant colony algorithm according to an embodiment of the present application, as shown in Figure 2 , the method comprises the following steps:
[0075] Step S201, initialize parameters and set initial values t=0, initial iteration number Num=0, and k=0, wherein t represents the calculation time, k represents the serial number of the ant, m ants are randomly placed in different stations, and the initial pheromone τ ij (0) of the road between station i and station j is c, and c is a constant.
[0076] Step S202, Num=Num+1.
[0077] Step S203, the kth ant moves to the next station j from station i according to the transition probability ; wherein j belongs to allow k ; allow k is a set of next stations that the kth ant can be allowed to go to.
[0078] Optionally, the transition probability is:
[0079]
[0080] wherein t is the calculation time; is the probability of the kth ant moving from i to j; τ ij is the residual pheromone concentration on the link between site i and site j; η ij is the heuristic function, representing the expected degree of the ant at site i when moving from i to j; α, β, γ are the weights of pheromone and heuristic respectively; η0(i, j) represents the influence of road congestion degree on the expected degree of the ant at site i when moving from i to j; η1(i, j) represents the influence of road smoothness and road slope on the expected degree of the ant at site i when moving from i to j; o represents the next site that the kth ant can be allowed to go to.
[0081] Step S204, filling the site reached by the ant this time into the tabu table, and locally updating the pheromone τ ij (t+1).
[0082] Optionally, the locally updated pheromone is: τ ij (t+1) = (1-ε)·τ ij (t) + ε·τ0; wherein τ0 is the pheromone at the beginning of each iteration, and ε is the evaporation coefficient of the pheromone during local updating.
[0083] Step S205, if site j is the terminal point, executing step S206, otherwise jumping to step S203.
[0084] Step S206, k = k + 1, if k is greater than the total number of ants, executing step S207, otherwise jumping to step S203.
[0085] Step S207, globally updating the pheromone τ ij .
[0086] Optionally, the globally updated pheromone is: τ ij = (1-ρ)τ ij + ρ / L best , wherein L best is the optimal path length at the end of a cycle period; and ρ is the evaporation coefficient of the pheromone, between 0 and 1.
[0087] Step S208, if the maximum number of iterations Num max is met, executing step S209, otherwise executing step S202.
[0088] Step S209, outputting the optimal result under the set parameters at initialization, and recording the carbon emission index.
[0089] Step S210, parameter optimization, find a set of optimal parameter set x u = (a u , b u , l u , p) so that the carbon emission is the lowest, and the path under the optimal parameters is used as the optimal path.
[0090] Figure 3 is a schematic diagram of a planning path generated by using an ant colony algorithm according to an embodiment of the present application, as shown in Figure 3 each new site is added to the arrived table arrive, and it is detected whether the average road speed changes, if the average road speed changes, it indicates that the road congestion condition changes, and then the planning path is updated according to the ant colony algorithm mentioned above; if the road congestion condition does not change, the path planned before is still used.
[0091] Table 1 is a recognition table of site positions of a planning path generated by using an ant colony algorithm according to an embodiment of the present application, as shown in Table 1, 12 sites are set, and the position of each site and the garbage quality of each site on the day are set.
[0092] Table 1
[0093]
[0094] Figure 4 is a schematic diagram of a planning path generated by using an ant colony algorithm according to an embodiment of the present application, as shown in Figure 4 , according to the 12 sites shown in Table 1, the number of ants is 60, the maximum iteration number Num max = 100, a = 1, b = 1, g = 2, p = 0.5, the speed from the current site to other sites is randomly generated in the range of [10, 60], and the best driving track is obtained.
[0095] Figure 5 is a schematic diagram of a planning path generated by using an ant colony algorithm according to an embodiment of the present application, as shown in Figure 5 , the genetic algorithm is used to calculate the optimal parameters, and the best driving track under the optimal parameters is obtained.
[0096] The above embodiments of the present application not only innovatively extend the ant colony algorithm in theory, but also provide a practical solution for urban garbage management, which is expected to significantly improve the efficiency and environmental performance of the urban garbage collection and transportation system, and meets the needs of current urban sustainable development.
[0097] According to an embodiment of the present invention, a path planning device embodiment is also provided. It should be noted that the path planning device can be used to execute the path planning method in the embodiment of the present invention, and the path planning method in the embodiment of the present invention can be executed in the path planning device.
[0098] Figure 6 is a schematic diagram of a path planning device according to an embodiment of the present invention. Figure 6 As shown, the device may include: an acquisition module 62, used to acquire a set of sites to be planned, wherein the set of sites to be planned includes: multiple sites to be planned; a first determination module 64, used to determine the road congestion level and road smoothness level between the first site and the second site, wherein the first site and the second site are any two sites to be planned in the set of sites to be planned, and the road smoothness level at least represents the flatness of the road surface; a second determination module 66, used to determine a first heuristic factor based on the road congestion level, and to determine a second heuristic factor based on the road smoothness level, wherein the first heuristic factor and the second heuristic factor represent the expected degree of movement from the first site to the second site; a generation module 68, used to generate a target path based on the first heuristic factor and the second heuristic factor between multiple sites to be planned in the set of sites to be planned using an ant colony algorithm, wherein the target path passes through all sites to be planned in the set of sites to be planned.
[0099] It should be noted that the acquisition module 62 in this embodiment can be used to execute step S102 in the embodiment of the present application, the first determination module 64 in this embodiment can be used to execute step S104 in the embodiment of the present application, the second determination module 66 in this embodiment can be used to execute step S106 in the embodiment of the present application, and the generation module 68 in this embodiment can be used to execute step S108 in the embodiment of the present application. The examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments.
[0100] In an embodiment of the present invention, the integration of road congestion level and road smoothness as heuristic factors can more accurately reflect the actual road conditions of urban garbage collection and transportation. By integrating two key heuristic factors, namely road congestion level and road smoothness, multiple factors can be integrated to achieve smarter and more efficient path planning. Moreover, through the iterative calculation of the ant colony algorithm, the optimal path that avoids congestion and ensures road smoothness can be explored, effectively avoiding the efficiency loss caused by road congestion, while ensuring the smoothness and safety of the path, thereby achieving the technical effect of improving the accuracy of path planning, significantly improving the efficiency of garbage collection and transportation, and thus solving the technical problem of inaccurate path planning in existing urban garbage collection and transportation route planning technologies.
[0101] As an optional embodiment, the generating module comprises: an initializing unit, configured to randomly place a plurality of ants in a preset ant group in different to-be-planned sites, wherein the ants are used to simulate objects moving between the to-be-planned sites; and an iterative calculating unit, configured to perform iterative calculation on the preset ant group for a predetermined number of times to obtain a target path, wherein the target path is a candidate path obtained by the preset ant group based on the last iteration, and the candidate path is a moving path obtained by a last ant in the same preset ant group through a plurality of movements, the moving path passing through all to-be-planned sites in the set of to-be-planned sites, in the process of each movement of the ant, a second site of each movement is selected according to a first heuristic factor, a second heuristic factor and residual pheromone, and the residual pheromone is updated on the path of each movement until the second site is the last to-be-planned site in the set of to-be-planned sites, and the residual pheromone is updated locally after each movement of the ant, and the residual pheromone is updated globally after each ant in the same preset ant group completes the movement.
[0102] As an optional embodiment, the device for performing each iteration in the iterative calculating unit comprises: a traversing unit, configured to traverse a plurality of ants in the preset ant group and take each traversed ant as a target ant; a determining unit, configured to iteratively select a target site of each movement of the target ant in the set of to-be-planned sites according to a predetermined transition probability between two to-be-planned sites, until the target site is the last to-be-planned site in the set of to-be-planned sites, wherein the transition probability is positively correlated with the first heuristic factor, the second heuristic factor and the residual pheromone respectively, and the target site is a to-be-planned site with the maximum transition probability in the set of to-be-planned sites; a first processing unit, configured to generate a moving path according to a plurality of target sites passed through by the target ant in a plurality of movements, and perform local pheromone update on the residual pheromone between two to-be-planned sites passed through by each movement; and a second processing unit, configured to determine the moving path as a candidate path obtained by the iteration in the case that the target ant is the last ant traversed from the preset ant group, and perform global pheromone update on the residual pheromone in the candidate path.
[0103] As an optional embodiment, the determining unit comprises: a first determining subunit, configured to determine a to-be-planned site where the target ant is located as a first site, wherein there are a plurality of second sites corresponding to the same first site; a calculating subunit, configured to calculate a transition probability of each second site according to the first heuristic factor, the second heuristic factor and the residual pheromone; a second determining subunit, configured to determine the second site with the highest transition probability as the target site; and a third determining subunit, configured to determine the target site as the first site in the case that the target site is not the last to-be-planned site in the set of to-be-planned sites.
[0104] As an optional embodiment, the device further comprises a moving subunit, configured to move the target station from the set of to-be-planned stations to the set of taboo stations after determining the second station with the highest transition probability as the target station; a detecting subunit, configured to detect whether the set of to-be-planned stations is empty; and a fourth determining subunit, configured to determine that the target station is not the last to-be-planned station in the set of to-be-planned stations when the set of to-be-planned stations is not empty.
[0105] As an optional embodiment, the device further comprises an adjusting unit, configured to adjust the weight values corresponding to the first heuristic factor, the second heuristic factor and the residual pheromone respectively by using a genetic algorithm after obtaining the target path by performing the predetermined number of iterations of the preset ant colony, so as to obtain the target path meeting the preset path requirement.
[0106] As an optional embodiment, the device further comprises a moving subunit, configured to move according to the arrangement order of the to-be-planned stations in the target path after generating the target path by using the ant colony algorithm according to the first heuristic factor and the second heuristic factor between the to-be-planned stations in the set of to-be-planned stations; a detecting subunit, configured to detect the average speed of reaching the to-be-planned stations along the target path when moving to each to-be-planned station; and an updating subunit, configured to generate the set of to-be-planned stations according to the to-be-planned stations not passed through in the target path and update the target path by using the ant colony algorithm according to the first heuristic factor and the second heuristic factor between the to-be-planned stations in the set of to-be-planned stations when the average speed does not meet the preset speed requirement.
[0107] Embodiments of the present application can provide an electronic device, which can be a computer terminal, and the computer terminal can be any one of computer terminal devices in a computer terminal group. Alternatively, in the present embodiment, the computer terminal can be replaced by a mobile terminal or other terminal device.
[0108] Alternatively, in the present embodiment, the computer terminal can be located in at least one of a plurality of network devices in a computer network.
[0109] In the embodiment, the computer terminal can execute program codes of the following steps in the path planning method: obtaining a set of to-be-planned sites, wherein the set of to-be-planned sites comprises a plurality of to-be-planned sites; determining a road congestion degree and a road smoothness degree between a first site and a second site, wherein the first site and the second site are any two to-be-planned sites in the set of to-be-planned sites; determining a first heuristic factor according to the road congestion degree and a second heuristic factor according to the road smoothness degree, wherein the first heuristic factor and the second heuristic factor represent an expected degree of moving from the first site to the second site, and the road smoothness degree at least represents a flatness of a road surface; and generating a target path according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned sites in the set of to-be-planned sites by using an ant colony algorithm, wherein the target path passes through all the to-be-planned sites in the set of to-be-planned sites.
[0110] Figure 7 According to the structural diagram of the computer terminal in the embodiment of the present application, as shown in Figure 7 the computer terminal 70 can comprise one or more (only one is shown in the figure) processors 72 and a memory 74.
[0111] The memory can be used to store software programs and modules, such as program instructions / modules corresponding to the path planning method and device in the embodiment of the present application. The processor executes various functions and data processing by running the software programs and modules stored in the memory, that is, implements the path planning method described above. The memory can comprise a high-speed random access memory, and can further comprise a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further comprise a memory remotely arranged relative to the processor, which can be connected to the terminal 70 through a network. Examples of the network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0112] The processor can call information and application programs stored in the memory through the transmission device to execute the following steps: obtaining a set of to-be-planned sites, wherein the set of to-be-planned sites comprises a plurality of to-be-planned sites; determining a road congestion degree and a road smoothness degree between a first site and a second site, wherein the first site and the second site are any two to-be-planned sites in the set of to-be-planned sites; determining a first heuristic factor according to the road congestion degree and a second heuristic factor according to the road smoothness degree, wherein the first heuristic factor and the second heuristic factor represent an expected degree of moving from the first site to the second site, and the road smoothness degree at least represents a flatness of a road surface; and generating a target path according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned sites in the set of to-be-planned sites by using an ant colony algorithm, wherein the target path passes through all the to-be-planned sites in the set of to-be-planned sites.
[0113] Optionally, the processor can further execute program codes of the following steps: randomly placing multiple ants in the preset ant colony in different to-be-planned sites, wherein the ants are used to simulate objects moving between the to-be-planned sites; performing a predetermined number of iterations on the preset ant colony to obtain a target path, wherein the target path is a candidate path obtained by the preset ant colony based on the last iteration, the candidate path is a moving path obtained by a last ant in the same preset ant colony moving multiple times, the moving path passes through all to-be-planned sites in the to-be-planned site set, in the process of each movement of the ant, a second site of each movement is selected according to the first heuristic factor, the second heuristic factor and the residual pheromone, and the residual pheromone is updated on the path of each movement until the second site is the last to-be-planned site in the to-be-planned site set, the residual pheromone is updated locally after each movement of the ant, and the residual pheromone is updated globally after each ant in the same preset ant colony completes the movement.
[0114] Optionally, the processor can further execute program codes of the following steps: traversing multiple ants in the preset ant colony, and taking each traversed ant as a target ant; iteratively selecting a target site of each movement of the target ant in the to-be-planned site set according to a predetermined transition probability until the target site is the last to-be-planned site in the to-be-planned site set, wherein the transition probability is positively correlated with the first heuristic factor, the second heuristic factor and the residual pheromone respectively, and the target site is a to-be-planned site with the maximum transition probability in the to-be-planned site set; generating a moving path according to multiple target sites passed through in the process of multiple movements of the target ant, and performing local pheromone update on the residual pheromone between two to-be-planned sites passed through in each movement; in the case that the target ant is the last ant traversed from the preset ant colony, determining the moving path as a candidate path obtained in the current iteration, and performing global pheromone update on the residual pheromone between any two to-be-planned sites in the candidate path.
[0115] Optionally, the processor can further execute program codes of the following steps: determining a to-be-planned site where the target ant is located as a first site, wherein there are multiple second sites corresponding to the same first site; calculating a transition probability of each second site according to the first heuristic factor, the second heuristic factor and the residual pheromone; determining a second site with the highest transition probability as the target site; in the case that the target site is not the last to-be-planned site in the to-be-planned site set, determining the target site as the first site.
[0116] Optionally, the processor can further execute program codes of the following steps: moving the target station from the set of stations to be planned to the set of taboo stations; detecting whether the set of stations to be planned is empty; and determining that the target station is not the last station to be planned in the set of stations to be planned when the set of stations to be planned is not empty.
[0117] Optionally, the processor can further execute program codes of the following steps: adjusting the weight values corresponding to the first heuristic factor, the second heuristic factor and the residual pheromone respectively by using a genetic algorithm to obtain a target path meeting preset path requirements.
[0118] Optionally, the processor can further execute program codes of the following steps: moving according to the arrangement order of the stations to be planned in the target path; detecting an average speed of reaching the stations to be planned along the target path when moving to each station to be planned; and generating a set of stations to be planned according to the stations to be planned not passed through in the target path and updating the target path by using an ant colony algorithm according to the first heuristic factor and the second heuristic factor between the stations to be planned in the set of stations to be planned when the average speed does not meet preset speed requirements.
[0119] Those skilled in the art can understand that, Figure 7 The structure shown is only schematic, and the computer terminal can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, or other terminal devices. Figure 7 It does not limit the structure of the electronic device. For example, the computer terminal 70 includes more or fewer components (such as a network interface, a display device, etc.) than shown in the figure, or has a different configuration from Figure 7 that shown in the figure.
[0120] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device by a computer program, and the computer program can be stored in a non-volatile storage medium, which can include a flash disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, etc.
[0121] Embodiments of the present application also provide a non-volatile storage medium. Optionally, in the present embodiment, the non-volatile storage medium can be used to save the program codes executed by the path planning method provided by the above embodiments.
[0122] Optionally, in the embodiment, the non-volatile storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
[0123] Optionally, in the embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: obtaining a set of to-be-planned sites, wherein the set of to-be-planned sites includes a plurality of to-be-planned sites; determining a road congestion degree and a road smoothness degree between a first site and a second site, wherein the first site and the second site are any two to-be-planned sites in the set of to-be-planned sites; determining a first heuristic factor according to the road congestion degree and a second heuristic factor according to the road smoothness degree, wherein the first heuristic factor and the second heuristic factor represent an expected degree of moving from the first site to the second site, and the road smoothness degree at least represents a flatness of a road surface; and generating a target path according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned sites in the set of to-be-planned sites by using an ant colony algorithm, wherein the target path passes through all the to-be-planned sites in the set of to-be-planned sites.
[0124] Optionally, in the embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: randomly placing a plurality of ants in a preset ant colony in different to-be-planned sites, wherein the ants are used to simulate objects moving between the to-be-planned sites; performing a predetermined number of iterations on the preset ant colony to obtain a target path, wherein the target path is a candidate path obtained by the preset ant colony based on the last iteration, the candidate path is a moving path obtained by a last ant in the same preset ant colony moving a plurality of times, the moving path passes through all the to-be-planned sites in the set of to-be-planned sites, in each movement of the ants, a second site of each movement is selected according to the first heuristic factor, the second heuristic factor, and residual pheromone, and the residual pheromone is updated on each movement path until the second site is the last to-be-planned site in the set of to-be-planned sites, the residual pheromone is updated locally after each movement of the ants, and the residual pheromone is updated globally after each ant in the same preset ant colony completes the movement.
[0125] Optionally, in the embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: traversing a plurality of ants in a preset ant colony, and taking each traversed ant as a target ant; iteratively selecting a target station for each movement of the target ant in the set of to-be-planned stations according to a predetermined transition probability until the target station is the last to-be-planned station in the set of to-be-planned stations, wherein the transition probability is positively correlated with the first heuristic factor, the second heuristic factor, and the residual pheromone respectively, and the target station is the to-be-planned station with the maximum transition probability in the set of to-be-planned stations; generating a movement path according to a plurality of target stations passed through by the target ant in the process of multiple movements, and performing local pheromone update on the residual pheromone between two to-be-planned stations passed through by each movement; in the case that the target ant is the last ant traversed from the preset ant colony, determining the movement path as a candidate path obtained by the current iteration calculation, and performing global pheromone update on the residual pheromone between any two to-be-planned stations in the candidate path.
[0126] Optionally, in the embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: determining a to-be-planned station where the target ant is located as a first station, wherein there are a plurality of second stations corresponding to the same first station; calculating a transition probability of each second station according to the first heuristic factor, the second heuristic factor, and the residual pheromone; determining the second station with the highest transition probability as the target station; in the case that the target station is not the last to-be-planned station in the set of to-be-planned stations, determining the target station as the first station.
[0127] Optionally, in the embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: moving the target station from the set of to-be-planned stations to the set of taboo stations; detecting whether the set of to-be-planned stations is empty; in the case that the set of to-be-planned stations is not empty, determining that the target station is not the last to-be-planned station in the set of to-be-planned stations.
[0128] Optionally, in the embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: adjusting the weight values corresponding to the first heuristic factor, the second heuristic factor, and the residual pheromone respectively by using a genetic algorithm to obtain a target path meeting a preset path requirement.
[0129] Optionally, in the embodiment, the nonvolatile storage medium is configured to store program code for performing the following steps: moving according to the arrangement order of the to-be-planned sites in the target path; detecting an average speed of reaching the to-be-planned sites along the target path in the case of moving to each to-be-planned site; in the case that the average speed does not meet a preset speed requirement, generating a to-be-planned site set according to a plurality of to-be-planned sites not passed through in the target path, and updating the target path according to the first heuristic factor and the second heuristic factor between the plurality of to-be-planned sites in the to-be-planned site set by using the ant colony algorithm.
[0130] The embodiment of the present application further provides a computer program product comprising a computer program. Optionally, in the embodiment, the computer program is executed by a processor to realize the steps of the path planning method provided by the above-mentioned embodiments.
[0131] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0132] In the above-mentioned embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0133] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some interface, indirect coupling or communication connection between units or modules, which can be electrical or other forms.
[0134] The units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or can be distributed to multiple units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.
[0135] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0136] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a nonvolatile storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a nonvolatile storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned nonvolatile storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0137] The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A path planning method, characterized in that: include: Acquire a site set to be planned, wherein the site set to be planned includes: a plurality of sites to be planned; Determining a road congestion level and a road smoothness level between a first site and a second site, wherein the first site and the second site are any two sites to be planned in the set of sites to be planned; Determining a first heuristic factor based on the road congestion level, and determining a second heuristic factor based on the road smoothness level, wherein the first heuristic factor and the second heuristic factor represent a desired degree of movement from the first station to the second station, and the road smoothness level at least represents a flatness of a road surface; An ant colony algorithm is used to generate a target path according to the first heuristic factor and the second heuristic factor between multiple sites to be planned in the site set to be planned, wherein the target path passes through all the sites to be planned in the site set to be planned.
2. The method according to claim 1, characterized in that Generating a target path using an ant colony algorithm according to the first heuristic factor and the second heuristic factor between a plurality of the to-be-planned sites in the to-be-planned site set includes: Randomly placing a plurality of ants in a preset ant colony in different sites to be planned, wherein the ants are used to simulate objects moving between the sites to be planned; Performing a predetermined number of iterative calculations on the preset ant colony to obtain the target path, wherein the target path is a candidate path obtained by the preset ant colony based on the last iterative calculation, and the candidate path is a movement path obtained by multiple movements of the last ant in the same preset ant colony, and the movement path passes through all the sites to be planned in the set of sites to be planned. During each movement of the ant, the second site for each movement is selected based on the first heuristic factor, the second heuristic factor, and the residual pheromone, and the residual pheromone is updated on the path of each movement until the second site is the last site to be planned in the set of sites to be planned. The residual pheromone is locally updated after each movement of the ant, and is globally updated after each ant in the same preset ant colony completes its movement.
3. The method according to claim 2, characterized in that Each iterative calculation process includes: Traversing the plurality of ants in the preset ant colony, and taking the ants traversed each time as target ants; Iteratively selecting a target site for each movement of the target ant in the set of sites to be planned according to a predetermined transition probability until the target site is the last site to be planned in the set of sites to be planned, wherein the transition probability is positively correlated with the first heuristic factor, the second heuristic factor, and the residual pheromone, respectively, and the target site is the site to be planned with the largest transition probability in the set of sites to be planned; Generating the movement path according to the multiple target sites respectively passed by the target ant during multiple movements, and performing the local pheromone update on the residual pheromone between two sites to be planned passed by the target ant each time; In the case where the target ant is the last ant traversed from the preset ant colony, the moving path is determined as the candidate path obtained by this iterative calculation, and the global pheromone update is performed on the residual pheromones between any two sites to be planned in the candidate path.
4. The method according to claim 3, characterized in that Iteratively selecting a target site for each movement of the target ant in the set of sites to be planned according to a predetermined transition probability until the target site is the last site in the set of sites to be planned, wherein: Determine the site to be planned where the target ant is located as the first site, wherein the same first site has corresponding multiple second sites; Calculating the transition probability of each second site according to the first heuristic factor, the second heuristic factor, and the residual pheromone; Determine the second site with the highest transfer probability as the target site; In a case where the target site is not the last site to be planned in the set of sites to be planned, the target site is determined as the first site.
5. The method according to claim 4, characterized in that After determining the second site with the highest transfer probability as the target site, the method further includes: Moving the target site from the to-be-planned site set to the taboo site set; Detecting whether the set of sites to be planned is empty; When the set of sites to be planned is not empty, it is determined that the target site is not the last site to be planned in the set of sites to be planned.
6. The method according to claim 2, characterized in that After performing a predetermined number of iterative calculations on the preset ant colony to obtain the target path, the method further includes: A genetic algorithm is used to adjust the weight values corresponding to the first heuristic factor, the second heuristic factor and the residual pheromone, respectively, to obtain the target path that meets the preset path requirements.
7. The method according to claim 1, characterized in that After generating a target path based on the first heuristic factor and the second heuristic factor between a plurality of the to-be-planned sites in the to-be-planned site set using an ant colony algorithm, the method further includes: Move according to the arrangement order of the sites to be planned in the target path; When moving to each of the to-be-planned sites, detecting an average speed along the target path to reach the to-be-planned site; When the average speed does not meet the preset speed requirement, the set of sites to be planned is generated based on the multiple sites to be planned that are not passed through in the target path, and the target path is updated using an ant colony algorithm based on the first heuristic factor and the second heuristic factor between the multiple sites to be planned in the set of sites to be planned.
8. A path planning device, characterized in that: include: An acquisition module is used to acquire a site set to be planned, wherein the site set to be planned includes: a plurality of sites to be planned; A first determining module is configured to determine a road congestion level and a road smoothness level between a first site and a second site, wherein the first site and the second site are any two sites to be planned in the set of sites to be planned; a second determining module, configured to determine a first heuristic factor based on the road congestion level, and a second heuristic factor based on the road smoothness level, wherein the first heuristic factor and the second heuristic factor represent a desired degree of movement from the first station to the second station, and the road smoothness level represents at least a flatness of a road surface; A generation module is used to generate a target path by using an ant colony algorithm based on the first heuristic factor and the second heuristic factor between multiple sites to be planned in the site set to be planned, wherein the target path passes through all the sites to be planned in the site set to be planned.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the path planning method according to any one of claims 1 to 7 through the computer program.
10. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the path planning method according to any one of claims 1 to 7 are implemented.