CN109858703B - Method and system for acquiring shortest path of sampling - Google Patents

Method and system for acquiring shortest path of sampling Download PDF

Info

Publication number
CN109858703B
CN109858703B CN201910118412.8A CN201910118412A CN109858703B CN 109858703 B CN109858703 B CN 109858703B CN 201910118412 A CN201910118412 A CN 201910118412A CN 109858703 B CN109858703 B CN 109858703B
Authority
CN
China
Prior art keywords
path
sampling
place
location
pheromone
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.)
Active
Application number
CN201910118412.8A
Other languages
Chinese (zh)
Other versions
CN109858703A (en
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.)
CHINA NATIONAL ENVIRONMENTAL MONITORING CENTRE
Original Assignee
CHINA NATIONAL ENVIRONMENTAL MONITORING CENTRE
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 CHINA NATIONAL ENVIRONMENTAL MONITORING CENTRE filed Critical CHINA NATIONAL ENVIRONMENTAL MONITORING CENTRE
Priority to CN201910118412.8A priority Critical patent/CN109858703B/en
Publication of CN109858703A publication Critical patent/CN109858703A/en
Application granted granted Critical
Publication of CN109858703B publication Critical patent/CN109858703B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The application provides a method and a system for acquiring the shortest path of sampling, wherein the method comprises the following steps: constructing a position map according to the sampling task; initializing three kinds of pheromones of each place; judging whether the condition of finishing iteration is met; if not, acquiring a supplementary path of each sampling vehicle to form the whole path of each sampling vehicle until the condition of finishing iteration is met; taking the set of the whole paths of all the sampling vehicles as a final path set; the shortest path is obtained from the final set of paths. The addition of the place pheromone and the path pheromone changes the problem that the shortest path passing through a specified place cannot be processed by the traditional ant colony algorithm.

Description

Method and system for acquiring shortest path of sampling
Technical Field
The application relates to the technical field of environmental monitoring, in particular to a method and a system for acquiring the shortest path of sampling.
Background
The environment detection system comprises a plurality of sampling points and a plurality of detection stations, and in actual operation, after a sampling vehicle obtains a sampling task, the sampling vehicle needs to start from the position of the sampling vehicle, approach the sampling points in the sampling task, and send samples obtained by the sampling points to the detection stations in the task. The walking route of the sampling vehicle is related to the sampling efficiency, so how to obtain the shortest sampling path is an urgent technical problem to be solved.
In the prior art, the Dijkstra algorithm is used for calculating the shortest path between the position of the sampling vehicle and the last detection station, but the method only comprises a starting point and an ending point, and cannot take specified points (including a sampling point and the detection stations except the ending point) which are passed in the midway into consideration, so that the accuracy of the shortest path is reduced.
In the prior art, a greedy algorithm or a genetic algorithm is also used for searching the shortest path of the sampling vehicle. The greedy algorithm is that the whole path of the sampling vehicle is firstly divided into sub-paths among a plurality of adjacent sites, then the optimal solutions of all the sub-paths are calculated according to the Dijkstra algorithm, the solutions of all the sub-paths form an approximate optimal solution set to be selected, and finally the shortest path meeting the conditions is screened out. The greedy algorithm obtains the optimal solution of the sub-path, and although the algorithm has high efficiency, the shortest path obtained after synthesis is not necessarily the optimal solution of the original problem.
The genetic algorithm enables the fitness to be high by constructing a proper fitness function, namely, the paths which accord with the conditions are stored, the paths with the low fitness are abandoned, and the paths which accord with the conditions most are selected as the shortest paths after operator operations such as selection, intersection, mutation and the like of a plurality of generations. Because the behavior of the intermediate operator in the genetic algorithm is not easy to control, the time for obtaining the approximate optimal solution is long, resources are wasted, and the algorithm cannot be effectively used particularly in real-time engineering.
In addition, the above algorithms are all weightless, and the weights of the edges formed between the connected points are all regarded as the same, and the difference caused by the lengths of different edges is not considered, so that the matching degree of the final result and the actual application is low.
Disclosure of Invention
The application aims to provide a method and a device for acquiring the shortest path of sampling, which solve the problem of the shortest path passing through a specified place.
The application provides a method for acquiring the shortest path of sampling, which comprises the following steps: constructing a position map according to the appointed place and the non-appointed place of the sampling task; initializing three kinds of pheromones of each place, wherein the three kinds of pheromones are a length pheromone L _ Pm _ ij, a place pheromone A _ Pm _ i and a path pheromone P _ Pm _ Pi; acquiring an initial path set of all sampling vehicles; judging whether the iteration finishing condition is met, wherein the judgment condition is that whether all sampling vehicles pass through all designated places or not; if the condition for finishing the iteration is not met, acquiring a supplementary path of each sampling vehicle, and forming the whole path of each sampling vehicle until the condition for finishing the iteration is met; taking the set of the whole paths of all the sampling vehicles as a final path set; the shortest path is obtained from the final set of paths.
Preferably, the length pheromone L _ Pm _ ij is a derivative of a distance d _ ij between two directly connected sites; the place pheromone A _ Pm _ i is w × L _ Pm _ ij; the path information element P _ Pm _ Pi is l × s/m; wherein w is the attenuation coefficient of the location pheromone; s is the number of elements in the specified place contained in the path Pi; l is the enhancement coefficient of the path pheromone, and m is the number of elements of all the specified positions.
Preferably, the acquiring the supplementary path of each sampling vehicle to form the whole path of each sampling vehicle includes the following steps: for each sampling vehicle, acquiring a location set of a supplementary path, wherein the location in the location set of the supplementary path is connected with a certain location and does not belong to the location in the initial path set; enabling each sampling vehicle to move, and updating three kinds of pheromones; judging whether each sampling vehicle reaches the last place of the place set of the supplementary path or not, wherein the last place is the last appointed place; and if so, obtaining a sub-path from the last place to the end place of each sampling vehicle, thereby forming the whole path taken by the sampling vehicle.
Preferably, the sub-path between the last location reached by each sampling vehicle and the end location is obtained by dijkstra algorithm.
Preferably, the method further comprises adding only the minimum value of the path taken by each sampling vehicle to the final path set.
The application also provides a system for acquiring the shortest path of sampling, which comprises a composition module, an pheromone initialization module, an initial path acquisition module, a first judgment module, a final path acquisition module, a shortest path acquisition module and a supplementary path acquisition module; the composition module is used for constructing a position map according to the specified positions and the non-specified positions of the sampling task; the pheromone initialization module is used for initializing three pheromones of each place, wherein the three pheromones are a length pheromone L _ Pm _ ij, a place pheromone A _ Pm _ i and a path pheromone P _ Pm _ Pi; the initial path obtaining module is used for obtaining an initial path set of all sampling vehicles; the first judgment module is used for judging whether the conditions for finishing iteration are met, and the judgment conditions are whether all sampling vehicles pass through all designated places; the supplementary path obtaining module is used for obtaining the supplementary path of each sampling vehicle under the condition that the condition of finishing iteration is not met, and forming the whole path of each sampling vehicle until the condition of finishing iteration is met; the final path obtaining module is used for taking the set of the whole paths of all the sampling vehicles as a final path set; the shortest path obtaining module is used for obtaining a shortest path from the final path set.
Preferably, the length pheromone L _ Pm _ ij is a derivative of a distance d _ ij between two directly connected sites; the place pheromone A _ Pm _ i is w × L _ Pm _ ij; the path information element P _ Pm _ Pi is l × s/m; wherein w is the attenuation coefficient of the location pheromone; s is the number of elements in the specified place contained in the path Pi; l is the enhancement coefficient of the path pheromone, and m is the number of elements of all the specified positions.
Preferably, the supplementary path obtaining module comprises a location set obtaining module, a moving module, a second judging module and a whole path obtaining module; the location set obtaining module is used for obtaining a location set of a supplementary path of each sampling vehicle, and the location in the location set of the supplementary path is connected with a certain location and does not belong to the location in the initial path set; the moving module is used for moving each sampling vehicle and updating three kinds of pheromones; the second judging module is used for judging whether each sampling vehicle reaches the last place of the place set of the supplementary path or not, and the last place is the last appointed place; the whole path obtaining module is used for obtaining a sub-path from the last place to the end place where each sampling vehicle arrives under the condition that the result of the second judging module is yes, so that the whole path which the sampling vehicle walks through is formed.
Preferably, the sub-path between the last location reached by each sampling vehicle and the end location is obtained by dijkstra algorithm.
Preferably, the system further comprises a candidate optimal path obtaining module, wherein the candidate optimal path obtaining module is used for obtaining the minimum value of the path traveled by each sampling vehicle; and the final path obtaining module is a set of minimum values of paths traveled by each sampling vehicle.
The beneficial effect of this application is as follows:
1. the addition of the place pheromone and the path pheromone changes the problem that the traditional ant colony algorithm cannot process the shortest path passing through a specified place.
2. The pheromone is updated in a global mode, the current iteration result is guaranteed to be the optimal path in all the results, and therefore the operation is beneficial to accelerating the end of the algorithm.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a flow chart of a method of obtaining a shortest path to a sample of the present application;
FIG. 2 is a flow chart of step 170 of FIG. 1;
FIG. 3 is a block diagram of a shortest path system for obtaining samples;
fig. 4 is a structural diagram of a supplementary path obtaining module.
Detailed Description
The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Example one
Fig. 1 is a flowchart of a method of obtaining a shortest path to a sample according to the present application.
As shown in fig. 1, obtaining the shortest path of the sample includes the following steps:
step 110: and constructing a position map according to the designated places and the non-designated places, wherein the designated places are all necessary places in the sampling task, and the non-designated places are places except the designated places in the environment monitoring area.
Let L be { a1, a2, … … An }, where n is the number of all places.
The set GL of the designated places is { GA1, GA2, … … GAm }. epsilon.l, wherein m is the number of the designated places. Let the starting point SA belong to L and the end point EA belong to L.
The following matrix C represents the relationship between any two locations Ai and Aj in the set L as being directly connected or not:
Figure GDA0002954030090000051
wherein
Figure GDA0002954030090000052
The distance matrix between any two locations Ai and Aj is as follows:
Figure GDA0002954030090000053
wherein the content of the first and second substances,
Figure GDA0002954030090000054
all the above information constitutes a diagram F in which the set S of paths between two points Ai and Aj is
S={(Ai,Aj)|i,j∈(1,2……n)and cij=1}
It should be noted that, the set P of complete paths (the entire path taken by the sampling vehicle when completing the sampling task) satisfying the above conditions
P={P1,p2,……}
Finding a shortest path Pi ∈ P from the set P. Wherein Pi is of the form:
Pi={(Aa,Ab),(Ab,Ac),(Ac,Ad)……}
wherein Aa, Ab, Ac, Ad epsilon L; (Aa, Ab) is a route from the point Aa to the point Ab and satisfies cab=1,
Because it is impossible to find all elements of P, a heuristic search method is required to solve the following equation:
Figure GDA0002954030090000061
step 120: three kinds of pheromones for respective locations are initialized.
In the present application, the ant colony algorithm has three parts of pheromone sources, one part is a length pheromone L _ Pm _ ij, the other part is a location pheromone a _ Pm _ i, and the other part is a path pheromone P _ Pm _ Pi.
According to the information of the graph F, the three pheromones are defined by initialization respectively:
L_Pm_ij=1/dij (1)
A_Pm_i=w*L_Pm_ij (2)
w is an attenuation coefficient of the place pheromone, attenuates along with the increase of iteration times, and is set according to experience;
P_Pm_Pi=l*s/m (3)
wherein s is the number of elements in GL contained in the path Pi; l is an enhancement coefficient of the path pheromone, which increases with the number of iterations, and is set empirically.
During initialization, adding a place pheromone to the whole graph F according to the information of the specified place in the GL, and the steps are as follows:
step 1210: setting two levels of place sets:
a first stage: for any GAi ∈ GL, Aj ∈ L, and i > j, the set of places made up of Aj for which all (GAi, Aj) ∈ S hold is set as the first-level place set FL.
And a second stage: for any FAi ∈ FL, Aj ∈ L, and i > j, the set of places made up of Aj for all (FAi, Aj) ∈ S holds is set as the second level set of places SL.
Step 1220: adding location pheromones for each location in the two-level location set, wherein the location pheromone of the location in the first-level location set FL is FN1 ═ A _ Pm _ i, and the location pheromone of the location in the second-level location set SL is SN2 ═ FN 1/2.
The principle of addition is that place pheromones are added only once per place, and the second level is repeated with the first level, and only the first level is added.
Step 130: and obtaining an initial path set according to the ant colony algorithm. Wherein, all X sampling vehicles start from the starting point SA, H (X1) is the set of points which the sampling vehicle X1 passes through, PH (X1) is the set of paths which the sampling vehicle X1 passes through, and X is more than or equal to 1 and less than or equal to n.
Step 140: and judging whether the condition of finishing iteration is met. Judging conditions: and judging whether each sampling vehicle xi meets the condition GA ∈ H (xi), namely whether the sampling vehicle xi passes through all the specified places.
If yes, go to step 150; otherwise, step 170 is performed.
Step 150: and taking the set of the whole paths of all the sampling vehicles as a final path set P.
Step 160: the shortest path is obtained from the final set of paths P.
Step 170: and acquiring the supplementary path of each sampling vehicle to form the whole path of each sampling vehicle.
After step 170 is completed, the process returns to step 140.
As shown in fig. 2, each sampling vehicle performs step 170. Specifically, step 170 includes the steps of:
step 1710: for each sampling vehicle xi, the set of points B which obtain its supplementary path is B1, B2, … …, B is the set of points connected to the point Aa except the elements of the set in h (xi) belonging to the initial path; where Aa is any point in the set L.
Step 1720: and (3) moving each sampling vehicle xi, and updating the three pheromones once each time the sampling vehicle xi finishes moving.
In the moving process of each sampling vehicle xi, the moving probability between two places in the supplementary path is obtained according to the three pheromones
Figure GDA0002954030090000071
Wherein the content of the first and second substances,
Figure GDA0002954030090000072
is the probability that the sampling car xi is going from the point Aa to the point Ab at the moment t;
Figure GDA0002954030090000073
is the sum of the three pheromones on the side between the point Aa and the point Ab. Wherein when t is 0, the pheromone includes only a length pheromone and a location pheromone. When the movement (from the point Aa and the point Ab) is completed once and the arriving point is exactly the element in GL, there is a corresponding path pheromone, and the pheromone at this time is distributed on each side (the connecting line of two adjacent points in the path traveled by the sampling vehicle xi is one side) to be P _ Pm _ Pi (see formula (3)).
Alpha and beta respectively represent pheromones accumulated by the sampling vehicle xi in the moving process and the function of a heuristic factor in path selection;
ηabindicating the degree of expectation from the point Aa and the point Ab.
After one movement is completed, the three kinds of pheromones need to be updated, and the global updating is realized. The probability of the next move will change due to the update of the three pheromones.
Note that, in the process of obtaining the supplementary path, the point where the sample vehicle xi has traveled is also placed in the set H (x1), and the path where the sample vehicle xi has traveled is also placed in the set PH (x 1).
Step 1730: and judging whether each sampling vehicle xi reaches the last place of the place set B, wherein the last place is the last appointed place in the place set B which is walked by the sampling vehicle xi, namely judging whether the sampling vehicle xi walks all appointed places in the appointed place set GL. This last location is also the last location PH (xi) end of the set PH (x 1).
If yes, go to step 1740; otherwise, return to step 1720.
Step 1740: a sub-path from the last location ph (xi) end to the end location EA reached by each sampling vehicle xi is obtained, thereby forming the whole path lp (xi) traveled by the sampling vehicle xi.
Figure GDA0002954030090000081
And DK [ EA, PH (xi) _ end ] is the distance of the shortest path between the last position PH (xi) _ end and the ending position EA, which is calculated by utilizing the Dijkstra algorithm.
After step 170, if all the sampling vehicles xi satisfy the condition of ending the iteration, step 150 specifically includes: and taking the set of the paths of all the sampling vehicles as a final path set P, and taking the minimum value min (Pi) in P as the optimal approximate solution of the shortest path problem.
Preferably, for the sampling vehicle xi, the lp (xi) with the smallest value is found in all the lps (xi) thereof, and the smallest value of the paths traveled by the sampling vehicle xi is formed and added to the final path set P as the optimal alternative path. That is, the final path set P includes the candidate optimal paths that are traveled by only each sampling vehicle xi. In the preferred embodiment, step 160 selects the shortest path from a fewer number of paths, which improves the efficiency of obtaining the optimal approximate solution.
Example two
The present application further provides a shortest path system 300 for obtaining samples, as shown in fig. 3, the system includes a composition module 310, a pheromone initialization module 320, an initial path obtaining module 330, a first judgment module 340, a final path obtaining module 350, a shortest path obtaining module 360, and a supplemental path obtaining module 370.
The composition module 310 is used for constructing a location map according to the designated locations and the non-designated locations, wherein the designated locations are all necessary locations in the sampling task, and the non-designated locations are locations other than the designated locations in the environment monitoring area.
Let L be { a1, a2, … … An }, where n is the number of all places.
The set GL of the designated places is { GA1, GA2, … … GAm }. epsilon.l, wherein m is the number of the designated places. Let the starting point SA belong to L and the end point EA belong to L.
The following matrix C represents the relationship between any two locations Ai and Aj in the set L as being directly connected or not:
Figure GDA0002954030090000091
wherein
Figure GDA0002954030090000092
The distance matrix between any two locations Ai and Aj is as follows:
Figure GDA0002954030090000093
wherein the content of the first and second substances,
Figure GDA0002954030090000101
all the above information constitutes a diagram F in which the set S of paths between two points Ai and Aj is
S={(Ai,Aj)|i,j∈(1,2……n)and cij=1}
It should be noted that, the set P of complete paths (the entire path taken by the sampling vehicle when completing the sampling task) satisfying the above conditions
P={P1,p2,……}
Finding a shortest path Pi ∈ P from the set P. Wherein Pi is of the form:
Pi={(Aa,Ab),(Ab,Ac),(Ac,Ad)……}
wherein Aa, Ab, Ac, Ad epsilon L; (Aa, Ab) is a route from the point Aa to the point Ab and satisfies cab=1,
Because it is impossible to find all elements of P, a heuristic search method is required to solve the following equation:
Figure GDA0002954030090000102
the pheromone initialization module 320 is used to initialize three kinds of pheromones for each location.
In the present application, the ant colony algorithm has three parts of pheromone sources, one part is a length pheromone L _ Pm _ ij, the other part is a location pheromone a _ Pm _ i, and the other part is a path pheromone P _ Pm _ Pi.
According to the information of the graph F, the three pheromones are defined by initialization respectively:
L_Pm_ij=1/dij (1)
A_Pm_i=w*L_Pm_ij (2)
w is an attenuation coefficient of the place pheromone, attenuates along with the increase of iteration times, and is set according to experience;
P_Pm_Pi=l*s/m (3)
wherein s is the number of elements in GL contained in the path Pi; l is an enhancement coefficient of the path pheromone, which increases with the number of iterations, and is set empirically.
Preferably, the pheromone initialization module 320 includes a two-stage location acquisition module and a pheromone addition module.
And the two-stage position obtaining module and the pheromone adding module are used for adding the position pheromone to the whole graph F according to the information of the specified position in the GL.
The two-level location acquisition module is used for setting two-level location sets:
a first stage: for any GAi ∈ GL, Aj ∈ L, and i > j, the set of places made up of Aj for which all (GAi, Aj) ∈ S hold is set as the first-level place set FL.
And a second stage: for any FAi ∈ FL, Aj ∈ L, and i > j, the set of places made up of Aj for all (FAi, Aj) ∈ S holds is set as the second level set of places SL.
The pheromone adding module is used for adding a place pheromone for each place in the two-level place set, the place pheromone of the place in the first-level place set FL is FN1 ═ A _ Pm _ i, and the place pheromone of the place in the second-level place set SL is SN2 ═ FN 1/2.
The principle of addition is that place pheromones are added only once per place, and the second level is repeated with the first level, and only the first level is added.
The initial path obtaining module 330 is configured to obtain an initial path set according to an ant colony algorithm. Wherein, all X sampling vehicles start from the starting point SA, H (X1) is the set of points which the sampling vehicle X1 passes through, PH (X1) is the set of paths which the sampling vehicle X1 passes through, and X is more than or equal to 1 and less than or equal to n.
The first determining module 340 is used for determining whether a condition for ending the iteration is satisfied. Judging conditions: and judging whether each sampling vehicle xi meets the condition GA ∈ H (xi), namely whether the sampling vehicle xi passes through all the specified places.
The final path obtaining module 350 is configured to use the set of the entire complete paths of all the sampling vehicles as the final path set P if the condition for ending the iteration is satisfied.
The shortest path obtaining module 360 is used to obtain the shortest path from the final path set P obtained by the final path obtaining module 350.
The supplementary path obtaining module 370 is configured to obtain a supplementary path of each sample vehicle to form an entire path of each sample vehicle if the result of the first determining module 340 is negative. And under the condition that iteration is not finished, each sampling vehicle needs to continuously move to obtain a supplementary path.
As shown in fig. 4, the supplementary path obtaining module 370 includes a location set obtaining module 3710, a moving module 3720, a second judging module 3730, and an entire path obtaining module 3740.
The place set obtaining module 3710 is configured to obtain, for each sampling vehicle xi, a place set B of its supplementary route { B1, B2, … … }, where B is a set of places connected to the place Aa excluding elements belonging to a set in h (xi) of the initial route; where Aa is any point in the set L.
The moving module 3720 is configured to move each sampling vehicle xi, and update three kinds of pheromones once each time the sampling vehicle xi completes the movement.
In the moving process of each sampling vehicle xi, the moving probability between two places in the supplementary path is obtained according to the three pheromones
Figure GDA0002954030090000121
Figure GDA0002954030090000122
Is the probability that the sampling car xi is going from the point Aa to the point Ab at the moment t;
Figure GDA0002954030090000123
is the sum of the three pheromones on the side between the point Aa and the point Ab. Wherein when t is 0, the pheromone includes only a length pheromone and a location pheromone. When the movement (from the point Aa and the point Ab) is completed once and the arriving point is exactly the element in GL, there is a corresponding path pheromone, and the pheromone at this time is distributed on each side (the connecting line of two adjacent points in the path traveled by the sampling vehicle xi is one side) to be P _ Pm _ Pi (see formula (3)).
Alpha and beta respectively represent pheromones accumulated by the sampling vehicle xi in the moving process and the function of a heuristic factor in path selection;
ηabindicating the degree of expectation from the point Aa and the point Ab.
After one movement is completed, the three kinds of pheromones need to be updated, and the global updating is realized. The probability of the next move will change due to the update of the three pheromones.
Note that, in the process of obtaining the supplementary path, the point where the sample vehicle xi has traveled is also placed in the set H (x1), and the path where the sample vehicle xi has traveled is also placed in the set PH (x 1).
The second determining module 3730 is configured to determine whether each sampling vehicle xi has reached the last location in the location set B, where the last location is the last designated location in the location set B that the sampling vehicle xi has walked, that is, the module determines whether the sampling vehicle xi has walked through all designated locations in the designated location set GL. This last location is also the last location PH (xi) end of the set PH (x 1).
The whole path obtaining module 3740 is configured to, if the result of the second determining module 370 is yes, obtain a sub-path from the last location ph (xi) _ end to the end location EA where each sampling vehicle xi arrives, so as to form a whole path lp (xi) traveled by the sampling vehicle xi.
Figure GDA0002954030090000131
And DK [ EA, PH (xi) _ end ] is the distance of the shortest path between the last position PH (xi) _ end and the ending position EA, which is calculated by utilizing the Dijkstra algorithm.
After the complementary path obtaining module 370 obtains the complementary path and the whole path of each sampling vehicle, if all the sampling vehicles xi meet the condition of ending the iteration, the final path red module 350 takes the set of paths of all the sampling vehicles as a final path set P, and takes the minimum value min (pi) in P as the optimal approximate solution of the shortest path problem.
Preferably, the system further comprises an alternative optimal path obtaining module. For the sampling vehicle xi, the candidate optimal path obtaining module is configured to find the lp (xi) with the minimum value among all lps (xi) of the sampling vehicle xi, form the minimum value of the path traveled by the sampling vehicle xi, and add the minimum value as the candidate optimal path into the final path set P. That is, the final path set P only includes the candidate optimal paths that each sampling vehicle xi has traveled. In the preferred embodiment, the shortest path is selected from fewer paths, and the efficiency of obtaining the optimal approximate solution is improved.
The beneficial effect of this application is as follows:
1. the addition of the place pheromone and the path pheromone changes the problem that the traditional ant colony algorithm cannot process the shortest path passing through a specified place.
2. The pheromone is updated in a global mode, the current iteration result is guaranteed to be the optimal path in all the results, and therefore the operation is beneficial to accelerating the end of the algorithm.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (6)

1. A method for obtaining a shortest path for sampling, comprising the steps of:
constructing a position map according to the appointed place and the non-appointed place of the sampling task;
initializing three kinds of pheromones of each place, wherein the three kinds of pheromones are a length pheromone L _ Pm _ ij, a place pheromone A _ Pm _ i and a path pheromone P _ Pm _ Pi;
acquiring an initial path set of all sampling vehicles;
judging whether the iteration finishing condition is met, wherein the judgment condition is that whether all sampling vehicles pass through all designated places or not;
if the condition for finishing the iteration is not met, acquiring a supplementary path of each sampling vehicle, and forming the whole path of each sampling vehicle until the condition for finishing the iteration is met;
taking the set of the whole paths of all the sampling vehicles as a final path set;
obtaining a shortest path from the final path set;
wherein the length information element L _ Pm _ ij is the distance d between two directly connected sitesijA derivative of (a);
the place information element a _ Pm _ i ═ w × L _ Pm _ ij
The path information element P _ Pm _ Pi is l × s/m
Wherein w is the attenuation coefficient of the location pheromone; s is the number of elements in the specified place contained in the path Pi; l is the enhancement coefficient of the path pheromone, and m is the number of elements of all the specified places;
and, the acquiring the supplementary path of each sampling vehicle to form the whole path of each sampling vehicle includes the following steps:
for each sampling vehicle, acquiring a location set of a supplementary path, wherein the location in the location set of the supplementary path is connected with a certain location and does not belong to the location in the initial path set;
enabling each sampling vehicle to move, and updating three kinds of pheromones;
judging whether each sampling vehicle reaches the last place of the place set of the supplementary path or not, wherein the last place is the last appointed place;
and if so, obtaining a sub-path from the last place to the end place of each sampling vehicle, thereby forming the whole path taken by the sampling vehicle.
2. The method of claim 1, wherein the sub-path between the last location to the end location reached by each sampling car is obtained by dijkstra's algorithm.
3. The method of claim 1, further comprising adding only a minimum of paths traversed by each sample vehicle to the final set of paths.
4. A system for obtaining the shortest path of sampling is characterized by comprising a composition module, an pheromone initialization module, an initial path obtaining module, a first judgment module, a final path obtaining module, a shortest path obtaining module and a supplementary path obtaining module;
the composition module is used for constructing a position map according to the specified positions and the non-specified positions of the sampling task;
the pheromone initialization module is used for initializing three pheromones of each place, wherein the three pheromones are a length pheromone L _ Pm _ ij, a place pheromone A _ Pm _ i and a path pheromone P _ Pm _ Pi;
the initial path obtaining module is used for obtaining an initial path set of all sampling vehicles;
the first judgment module is used for judging whether the conditions for finishing iteration are met, and the judgment conditions are whether all sampling vehicles pass through all designated places;
the supplementary path obtaining module is used for obtaining the supplementary path of each sampling vehicle under the condition that the condition of finishing iteration is not met, and forming the whole path of each sampling vehicle until the condition of finishing iteration is met;
the final path obtaining module is used for taking the set of the whole paths of all the sampling vehicles as a final path set;
the shortest path obtaining module is used for obtaining a shortest path from the final path set;
wherein the length information element L _ Pm _ ij is the distance d between two directly connected sitesijA derivative of (a);
the place information element a _ Pm _ i ═ w × L _ Pm _ ij
The path information element P _ Pm _ Pi is l × s/m
Wherein w is the attenuation coefficient of the location pheromone; s is the number of elements in the specified place contained in the path Pi; l is the enhancement coefficient of the path pheromone, and m is the number of elements of all the specified places;
the supplementary path obtaining module comprises a location set obtaining module, a moving module, a second judging module and a whole path obtaining module;
the location set obtaining module is used for obtaining a location set of a supplementary path of each sampling vehicle, and the location in the location set of the supplementary path is connected with a certain location and does not belong to the location in the initial path set;
the moving module is used for moving each sampling vehicle and updating three kinds of pheromones;
the second judging module is used for judging whether each sampling vehicle reaches the last place of the place set of the supplementary path or not, and the last place is the last appointed place;
the whole path obtaining module is used for obtaining a sub-path from the last place to the end place where each sampling vehicle arrives under the condition that the result of the second judging module is yes, so that the whole path which the sampling vehicle walks through is formed.
5. The system of claim 4, wherein the sub-path between the last location to the end location reached by each sampling car is obtained by Dijkstra's algorithm.
6. The system of claim 4, further comprising a candidate optimal path obtaining module, configured to obtain a minimum value of the path traveled by each sampling vehicle; and is
And the final path obtaining module is a set of minimum values of paths traveled by each sampling vehicle.
CN201910118412.8A 2019-02-15 2019-02-15 Method and system for acquiring shortest path of sampling Active CN109858703B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910118412.8A CN109858703B (en) 2019-02-15 2019-02-15 Method and system for acquiring shortest path of sampling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910118412.8A CN109858703B (en) 2019-02-15 2019-02-15 Method and system for acquiring shortest path of sampling

Publications (2)

Publication Number Publication Date
CN109858703A CN109858703A (en) 2019-06-07
CN109858703B true CN109858703B (en) 2021-04-27

Family

ID=66898070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910118412.8A Active CN109858703B (en) 2019-02-15 2019-02-15 Method and system for acquiring shortest path of sampling

Country Status (1)

Country Link
CN (1) CN109858703B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110243371A (en) * 2019-06-11 2019-09-17 五邑大学 A kind of the screwed lock paths planning method using ant group algorithm

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150223441A1 (en) * 2014-02-13 2015-08-13 The Regents Of The University Of California Development of pheromone-assisted techniques (pat) to improve efficacy of insecticide baits targeting urban pest ant species
CN105512169A (en) * 2016-03-10 2016-04-20 珠海市规划设计研究院 Shortest route searching method based on route and weight
CN106022531A (en) * 2016-05-27 2016-10-12 西安电子科技大学 Searching method of shortest path passing by necessary peak points
CN106295791A (en) * 2016-07-29 2017-01-04 西安电子科技大学 For the method finding travelling salesman's optimal path
CN107272679A (en) * 2017-06-15 2017-10-20 东南大学 Paths planning method based on improved ant group algorithm
CN107332770A (en) * 2017-08-18 2017-11-07 郑州云海信息技术有限公司 One kind must be through a routed path system of selection
CN108460485A (en) * 2018-03-05 2018-08-28 重庆邮电大学 A kind of traveling salesman problem method for solving based on improvement ant group algorithm
CN109214498A (en) * 2018-07-10 2019-01-15 昆明理工大学 Ant group algorithm optimization method based on search concentration degree and dynamic pheromone updating

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107122843A (en) * 2017-03-13 2017-09-01 华南理工大学 A kind of traveling salesman problem method for solving based on improved adaptive GA-IAGA
CN107622327B (en) * 2017-09-15 2020-11-03 哈尔滨工程大学 Multi-unmanned aerial vehicle flight path planning method based on culture ant colony search mechanism
CN108564163B (en) * 2018-03-27 2021-09-21 华南理工大学 Improved ant colony method for solving multi-target multi-traveler problem
CN109117993B (en) * 2018-07-27 2022-04-15 中山市武汉理工大学先进工程技术研究院 Processing method for optimizing vehicle path
CN109282815A (en) * 2018-09-13 2019-01-29 天津西青区瑞博生物科技有限公司 Method for planning path for mobile robot based on ant group algorithm under a kind of dynamic environment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150223441A1 (en) * 2014-02-13 2015-08-13 The Regents Of The University Of California Development of pheromone-assisted techniques (pat) to improve efficacy of insecticide baits targeting urban pest ant species
CN105512169A (en) * 2016-03-10 2016-04-20 珠海市规划设计研究院 Shortest route searching method based on route and weight
CN106022531A (en) * 2016-05-27 2016-10-12 西安电子科技大学 Searching method of shortest path passing by necessary peak points
CN106295791A (en) * 2016-07-29 2017-01-04 西安电子科技大学 For the method finding travelling salesman's optimal path
CN107272679A (en) * 2017-06-15 2017-10-20 东南大学 Paths planning method based on improved ant group algorithm
CN107332770A (en) * 2017-08-18 2017-11-07 郑州云海信息技术有限公司 One kind must be through a routed path system of selection
CN108460485A (en) * 2018-03-05 2018-08-28 重庆邮电大学 A kind of traveling salesman problem method for solving based on improvement ant group algorithm
CN109214498A (en) * 2018-07-10 2019-01-15 昆明理工大学 Ant group algorithm optimization method based on search concentration degree and dynamic pheromone updating

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A Modified Ant Colony Algorithm to Solve the Shortest Path Problem;Y.B. Yuan 等;《2014 International Conference on Cloud Computing and Internet of Things》;20141214;第148-151页 *
Modified Ant Colony Optimization with Pheromone Mutation for Travelling Salesman Problem;C. Ratanavilisagul;《2017 14th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON)》;20170630;第411-414页 *
必经点约束型最短路径问题的研究;王艳愉,李强;《软件与算法》;20171130;第36卷(第22期);第26-29页 *
改进的蚁群算法求解最短路径问题;吴虎发 等;《计算机仿真》;20120831;第29卷(第8期);第215-218页 *

Also Published As

Publication number Publication date
CN109858703A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
CN111080029B (en) Urban traffic road speed prediction method and system based on multi-path segment space-time correlation
Padmanaban et al. Development of a real-time bus arrival prediction system for Indian traffic conditions
US8180557B2 (en) Traffic state predicting apparatus
CN108021686B (en) Method for quickly matching bus routes and road networks in electronic map
Witt Trip-based public transit routing
CN109635914B (en) Optimized extreme learning machine trajectory prediction method based on hybrid intelligent genetic particle swarm
CN110245377B (en) Travel scheme recommendation method and recommendation system
CN110222912B (en) Railway travel route planning method and device based on time dependence model
US8532922B2 (en) Method for simplifying a description of a route of travel
CN110309962A (en) Railway stroke route method and device for planning based on time extended model
CN110889530A (en) Destination prediction method based on recurrent neural network and server
CN112556717B (en) Travel mode screening method and travel route recommending method and device
CN106055607A (en) User visiting prediction model establishment and user visiting prediction method and apparatus
CN109858703B (en) Method and system for acquiring shortest path of sampling
Noh et al. Hyperpaths in network based on transit schedules
CN111024079B (en) Method and system for matching with route according to multiple position points
CN107917716A (en) Fixed circuit air navigation aid, device, terminal and computer-readable recording medium
Caramia et al. Routing a fleet of vehicles for dynamic combined pick-up and deliveries services
CN108052743B (en) Method and system for determining step approach centrality
CN111947676A (en) Express delivery path planning method and device, electronic equipment and storage medium
Mainali et al. Optimal route of road networks by dynamic programming
CN107564289B (en) Road network preprocessing method for merging traffic nodes
Szwed et al. Map-matching in a real-time traffic monitoring service
Pan et al. Road Network Modeling with Layered Abstraction for Path Discovery in Vehicle Navigation Systems.
CN116558521B (en) Track positioning method, track positioning device and computer readable storage medium

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
GR01 Patent grant
GR01 Patent grant