CN115392539A - Path planning algorithm based on greedy algorithm - Google Patents

Path planning algorithm based on greedy algorithm Download PDF

Info

Publication number
CN115392539A
CN115392539A CN202210883285.2A CN202210883285A CN115392539A CN 115392539 A CN115392539 A CN 115392539A CN 202210883285 A CN202210883285 A CN 202210883285A CN 115392539 A CN115392539 A CN 115392539A
Authority
CN
China
Prior art keywords
node
traversed
path
nodes
distance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210883285.2A
Other languages
Chinese (zh)
Inventor
***
阮亚良
周旭
虞儒新
王战
张英驰
韩昊一
鲁鼎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Zheneng Digital Technology Co ltd
Zhejiang Zheneng Jiahua Power Generation Co Ltd
Original Assignee
Zhejiang Zheneng Digital Technology Co ltd
Zhejiang Zheneng Jiahua Power Generation Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Zheneng Digital Technology Co ltd, Zhejiang Zheneng Jiahua Power Generation Co Ltd filed Critical Zhejiang Zheneng Digital Technology Co ltd
Priority to CN202210883285.2A priority Critical patent/CN115392539A/en
Publication of CN115392539A publication Critical patent/CN115392539A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • G06Q10/047Optimisation of routes or paths, e.g. travelling salesman problem

Landscapes

  • Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Development Economics (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a path planning algorithm based on a greedy algorithm, which comprises the following steps: when the traversal encounters a branch, the branch is extracted, and after both branches are traversed, the overall result is better than that of which branch is traversed first to determine which branch is taken preferentially rather than the branch with the closest point fixed. The invention has the beneficial effects that: the method ensures that the greedy algorithm cannot obtain the global optimal solution difficultly due to trapping in local optimization, thereby achieving the effect of high path planning efficiency.

Description

Path planning algorithm based on greedy algorithm
Technical Field
The invention relates to the technical field of path planning algorithms, in particular to a path planning algorithm based on a greedy algorithm.
Background
The simple description of the application scenario of the robot path planning is that given n points, the shortest path traversing the n points is found. It is clear that this is a classical problem in graph theory, a variant of the traveler problem, distinguishing whether or not it is only necessary to return to the starting point in the end.
The Traveling Salesman Problem (TSP) is a classical combinatorial optimization Problem, which can be described as: a salesperson going to several cities to market goods needs to go from one city, go through all cities and return to the place of departure. How the travel route should be selected to minimize the total travel. The traveling salesman problem is a Non-deterministic (NP) complete problem with Polynomial complexity, the efficiency of exhaustive algorithm is too poor, and the time complexity is O (n |), so that at present, some random and heuristic search algorithms such as genetic algorithm, ant colony algorithm, simulated annealing algorithm, neural network, etc. are adopted as the mainstream method.
However, these algorithms all have a disadvantage that the optimal solution cannot be obtained necessarily, and only the optimal solution can be converged (approximated) to obtain an approximate optimal solution, because they are random algorithms in nature, most of them can select solutions according to the similar concept of "accepting or discarding with a certain probability"; the realization ideas of the algorithms are different, but more or less mutually reference places are also provided, some are related to random factors, some are related to initial states, some are related to random functions, and some are related to selection strategies. In combination with the above analysis, the solution to the TSP problem is presumably made up of two steps: 1. calculating the shortest path between every two cities: solving the shortest route by using an algorithm similar to Dijkstra, flord and A star; 2. calculating the shortest itinerant path: and (4) utilizing a search algorithm like a genetic algorithm and an ant colony algorithm to find the sequence of the round visits.
In the prior art, the first step is to use the Dijkstra algorithm to find the shortest path between every two points. Then, a classical algorithm for solving the TSP problem is used in the second step of path planning: the Lin-Kernigen-Helsgaun (Lin-Kernighan-Helsgaun, LKH) algorithm. However, the idea of the algorithm is based on the TSP problem which needs to return to the starting point finally, an optimal loop is solved, and the optimal path is not needed in a robot path planning application scene. It is therefore desirable to find new algorithms suitable for the current robot path planning application scenarios.
Among known algorithms, the greedy algorithm has the highest efficiency, but it is difficult to obtain a globally optimal solution because of falling into local optima. A representative example of the greedy algorithm trapped in local optimization is that when a branch path is encountered, a branch where the closest point is located is traversed and then another branch is returned; however, in many cases, the optimal solution is the global optimal solution by preferentially traversing another branch, thereby reducing the path planning efficiency.
Disclosure of Invention
The invention aims to overcome the defects in the prior art and provides a path planning algorithm based on a greedy algorithm.
In a first aspect, a greedy algorithm based path planning algorithm is provided, which includes:
s1, acquiring a node set to be traversed, and determining any node in the node set to be traversed as an initial node;
s2, calculating the distance between the starting node and the rest nodes in the node set to be traversed, acquiring a first distance set, and determining the nearest node of the starting node; if the shortest path from the starting node to the nearest node has a node in the path sequence set, moving out the nearest node from the node set to be traversed, storing the nearest node into a waiting node set, and executing S2 again; moving out the starting node from the set of nodes to be traversed and storing the starting node into a current path sequence;
s3, assigning the initial node as a previous node, assigning the nearest node as an initial node, assigning the first distance set as a second distance set, and repeating the S2;
s4, comparing the first distance set with the second distance set, if nodes with the distance greater than the distance of the initial node from the previous node exist in the node set to be traversed, moving the nodes out of the node set to be traversed, storing the previous node into a branch point sequence, and repeating S3;
s5, repeating the step S4 until the set of the nodes to be traversed is an empty set, and if the set of the nodes to be traversed is not the empty set, moving out all the nodes in the set of the nodes to be traversed and storing the nodes in the set of the nodes to be traversed; taking out a first branch point from the branch point sequence, and taking a nearest node which is in the node set to be traversed and is far away from the first branch point as a starting node; all nodes in the current path sequence are moved out and stored in the nth path sequence;
s6, repeating the S5 until the waiting node set is an empty set;
and S7, combining all the path sequences in the path sequence set to obtain a global path sequence.
In a second aspect, a computer storage medium having a computer program stored therein is provided; the computer program, when run on a computer, causes the computer to perform the greedy algorithm based path planning algorithm of the first aspect.
In a third aspect, there is provided a computer program product which, when run on a computer, causes the computer to perform a greedy algorithm based path planning algorithm as described in the first aspect.
The invention has the beneficial effects that: according to the method, the path planning efficiency is improved through the greedy algorithm, the branches are extracted when the branches meet, the total result of traversing the branches first is better than that of traversing the branches first after the two branches are traversed, the branch which is preferentially taken is determined instead of fixedly taking the nearest point branch, the situation of falling into the local optimum can be basically avoided, the situation that the greedy algorithm is difficult to obtain the global optimum solution due to falling into the local optimum is further ensured, and the effect of high path planning efficiency is achieved.
Drawings
FIG. 1 is a flow chart of a greedy algorithm based path planning algorithm according to the present invention;
FIG. 2 is a schematic diagram of a map path provided by the present invention;
fig. 3 is a schematic diagram of an outdoor test site path provided by the present invention.
Detailed Description
The present invention will be further described with reference to the following examples. The following examples are set forth merely to aid in the understanding of the invention. It should be noted that, for a person skilled in the art, several modifications can be made to the invention without departing from the principle of the invention, and these modifications and modifications also fall within the protection scope of the claims of the present invention.
Example 1:
in order to solve the problem that the existing greedy algorithm is trapped in local optimization and causes difficulty in obtaining a global optimal solution, the application provides a path planning algorithm based on the greedy algorithm, as shown in fig. 1, including:
s1, acquiring a node set to be traversed, and determining any node in the node set to be traversed as an initial node.
In S1, a set of nodes to be traversed may also be referred to as an unordered set of nodes, and in a starting stage, the set includes all the point nodes, and for example, the set of nodes to be traversed is denoted by point [ ]. In addition, the present application needs to determine a certain node in the set of nodes to be traversed as a start node, for example, the start node is represented by a start.
S2, calculating the distance between the starting node and the rest nodes in the node set to be traversed, acquiring a first distance set, and determining the nearest node of the starting node; if the shortest path from the starting node to the nearest node has a node in the path sequence set, moving out the nearest node from the node set to be traversed, storing the nearest node into the waiting node set, and executing S2 again; and moving out the starting node from the node set to be traversed and storing the starting node into the current path sequence.
Illustratively, in S2, a first distance set is represented by cost [ ], a current path sequence is represented by path [ ], a nearest node is represented by next, a waiting node set is represented by wait [ ], and a path sequence set is represented by path _ N [ ]. It should be noted that, in the shortest path from the start node to the next closest node, there is no node in the node set point [ ] to be traversed, but there may be a point in the already extracted path sequence.
And S3, assigning the initial node as the previous node, assigning the nearest node as the initial node, assigning the first distance set as the second distance set, and repeating the step S2.
In S3, last represents the previous node, and last _ cost [ ] represents the second distance set, and S3 may also be represented as: last = start, start = next, last _ cost [ ] = cost [ ].
And S4, comparing the first distance set with the second distance set, if nodes with the distance larger than that of the previous node exist in the node set to be traversed, moving out the nodes from the node set to be traversed, storing the nodes into a waiting node set, storing the previous node into a branch point sequence, and repeating the S3.
In S4, branch point sequences are denoted by branch [ ].
S5, repeating the step S4 until the set of the nodes to be traversed is an empty set, and if the set of the nodes to be traversed is not the empty set, moving out all the nodes in the set of the nodes to be traversed and storing the nodes in the set of the nodes to be traversed; taking out a first branch point from the branch point sequence, and taking the nearest node which is far away from the first branch point in the node set to be traversed as a starting node; and all nodes in the current path sequence are moved out and stored into the nth path sequence.
And S6, repeating the S5 until the waiting node set is an empty set.
And S7, combining all the path sequences in the path sequence set to obtain a global path sequence. For example, total _ path [ ] represents the resulting global path sequence. Specifically, starting from the first path sequence path _0[ ], how the global path sequences total _ path [ ] and path _ n [ ] are optimally combined is calculated, the path _ n [ ] is optimally inserted into the global path sequence total _ path [ ], and the process is continuously repeated until all path sequences are merged into the total _ path [ ].
The algorithm provided by the application optimizes the sequence of n nodes into the sequence of n paths, can reduce the calculation amount, and takes out the point which belongs to the current path from point [ ] through calculation in sequence, and the point which does not belong to the current path enters wait [ ]untilpoint [ ] is empty. Then, the points in wait are extracted in turn according to the above flow to obtain a subsequent path _1, a path _2 and a path _ n, and finally, the path segments need to be combined into a total _ path, and the total _ path is the required optimal path.
It should be noted that, in the above process, the invention continuously calculates and judges whether the next point enters wait [ ] or path [ ], and judges whether there are two criteria, firstly, it judges whether the distance cost [ ] from other points in point [ ] to the next point is closer than the distance last _ cost [ ] to the start point; for example, cost [1] is compared with last _ cost [1], cost [2] is compared with last _ cost [2], until cost [ n ] and last _ cost [ n ]; then, it is determined whether the existing path _0 to path _ n have not passed between the next point and the start point. If both the two judgments are yes, the next point and the start point are the same branch, and path can be entered, otherwise the next point belongs to a branch different from the start point, and wait is entered.
Example 2:
as shown in fig. 2, the new algorithm and the LKH algorithm provided by the present invention are respectively adopted, and with point 29 as a starting point, the solution results of traversing all the points on the map are:
the new algorithm: 29 28 27 43 32 33 35 36 42 44 37 38 39 31 30cost:27.4627
LKH algorithm: 29 28 27 30 31 39 40 37 36 34 32 43 44 42 41cost:26.6023
The LKH algorithm has better result.
When the outdoor test site path diagram shown in fig. 3 is used, starting from point 11, the solution results of traversing points 0,2,7,9, 11, 12, 13, 14, and 17 are:
the new algorithm: 11 13 12 14 17 29 7 0cost:83.4379
LKH algorithm: 11 13 12 14 9 02 17cost:87.196
Therefore, the result of the new algorithm provided by the invention is better.
In conclusion, the path planning efficiency is improved through the greedy algorithm, the branches are extracted when the branches are encountered, and after the two branches are traversed, the overall result of traversing the branches is better than that of traversing the branches first to determine which branch is to be taken preferentially, instead of fixedly taking the closest branch, so that the situation of falling into the local optimum can be basically avoided, the greedy algorithm is ensured not to be difficult to obtain a global optimum solution due to falling into the local optimum, and the effect of high path planning efficiency is achieved.

Claims (3)

1. A greedy algorithm based path planning algorithm, comprising:
s1, acquiring a node set to be traversed, and determining any node in the node set to be traversed as an initial node;
s2, calculating the distance between the starting node and the rest nodes in the node set to be traversed, acquiring a first distance set, and determining the nearest node of the starting node; if the shortest path from the starting node to the nearest node has a node in the path sequence set, moving out the nearest node from the node set to be traversed, storing the nearest node into a waiting node set, and executing S2 again; moving out the starting node from the set of nodes to be traversed and storing the starting node into a current path sequence;
s3, assigning the initial node as a previous node, assigning the nearest node as an initial node, assigning the first distance set as a second distance set, and repeating the S2;
s4, comparing the first distance set with the second distance set, if nodes with the distance greater than the distance of the initial node from the previous node exist in the node set to be traversed, moving the nodes out of the node set to be traversed, storing the previous node into a branch point sequence, and repeating S3;
s5, repeating the step S4 until the node set to be traversed is an empty set, and if the node set to be traversed is not the empty set, moving out all nodes in the node set to be traversed and storing the nodes in the node set to be traversed; taking out a first branch point from the branch point sequence, and taking a nearest node which is in the node set to be traversed and is far away from the first branch point as a starting node; all nodes in the current path sequence are moved out and stored in the nth path sequence;
s6, repeating the S5 until the waiting node set is an empty set;
and S7, combining all the path sequences in the path sequence set to obtain a global path sequence.
2. A computer storage medium, wherein a computer program is stored in the computer storage medium; the computer program, when run on a computer, causes the computer to execute the greedy algorithm based path planning algorithm of claim 1.
3. A computer program product, which, when run on a computer, causes the computer to execute a greedy algorithm based path planning algorithm according to claim 1.
CN202210883285.2A 2022-07-26 2022-07-26 Path planning algorithm based on greedy algorithm Pending CN115392539A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210883285.2A CN115392539A (en) 2022-07-26 2022-07-26 Path planning algorithm based on greedy algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210883285.2A CN115392539A (en) 2022-07-26 2022-07-26 Path planning algorithm based on greedy algorithm

Publications (1)

Publication Number Publication Date
CN115392539A true CN115392539A (en) 2022-11-25

Family

ID=84116034

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210883285.2A Pending CN115392539A (en) 2022-07-26 2022-07-26 Path planning algorithm based on greedy algorithm

Country Status (1)

Country Link
CN (1) CN115392539A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117435850A (en) * 2023-12-20 2024-01-23 中交通力建设股份有限公司 Road inspection method, system, equipment and medium based on improved greedy algorithm

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117435850A (en) * 2023-12-20 2024-01-23 中交通力建设股份有限公司 Road inspection method, system, equipment and medium based on improved greedy algorithm
CN117435850B (en) * 2023-12-20 2024-03-19 中交通力建设股份有限公司 Road inspection method, system, equipment and medium based on improved greedy algorithm

Similar Documents

Publication Publication Date Title
CN109115226B (en) Route planning method for avoiding multi-robot conflict based on jumping point search
Gange et al. Lazy CBS: implicit conflict-based search using lazy clause generation
Alpern et al. Mining coal or finding terrorists: The expanding search paradigm
JP7156385B2 (en) Method, apparatus and system for determining reachable paths between two nodes
Provan A polynomial‐time algorithm to find shortest paths with recourse
CN115392539A (en) Path planning algorithm based on greedy algorithm
CN102546440B (en) Routing and wavelength assignment method and system
Aksakalli et al. An AO* based exact algorithm for the Canadian traveler problem
WO2010058785A1 (en) Path calculation order deciding method, program and calculating apparatus
CN105698796B (en) A kind of method for searching path of multirobot scheduling system
CN113808424B (en) Method for acquiring K shortest paths of urban road network based on bidirectional Dijkstra
Shen et al. Beyond pairwise reasoning in multi-agent path finding
CN108683593A (en) A kind of computational methods of K short paths
CN116625378B (en) Cross-regional path planning method and system and storage medium
CN115685982A (en) Navigation path planning method based on connected graph and iterative search
CN107449426B (en) Navigation logic method and indoor AR navigation system thereof
Ticha et al. A solution method for the multi-destination bi-objectives shortest path problem
CN110975291B (en) Path extraction method and system
KR20180093158A (en) Method of shortest path discovery based on graph reachability
CN115270377B (en) Multi-cable optimal path planning method based on improved ant colony algorithm
CN111780762B (en) Patrol path generation method and device and storage medium
Carlson et al. Optimal pathfinding on weighted grid maps
US20130010643A1 (en) Method and apparatus for loop path search in mesh network
Tang et al. Dual Bounds from Decision Diagram-Based Route Relaxations: An Application to Truck-Drone Routing
CN113804197A (en) Multi-machine trolley path planning method based on complex track map

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination