01712818

download 01712818

of 6

Transcript of 01712818

  • 7/29/2019 01712818

    1/6

    A New Shortest Path Algorithm

    based on Heuristic StrategyChen Xi, Fei Qi and Li Wei

    Institute of System Engineering,

    Huazhong University of Science and Technology,

    Wuhan 430074, Peoples R China

    [email protected]

    Abstract- The paper presents a new dynamic direction restricted

    algorithm based on the Dijkstra algorithmGirection restrictedalgorithm and area restricted algorithm for computing shortest-

    path from one node to another node in traffic networks. This

    new algorithm can be combined with many other used heuristic

    algorithms. This new algorithm has been implemented in

    practice. The implementation performance of that new

    algorithm is compared to the Dijkstra algorithm, the A*

    algorithm, and so on. The results of comparison show that the

    new algorithm is efficient not only by itself but also by combining

    with other algorithms. For a network containing 5000 nodes and

    10000 arcs, the dynamic direction restricted algorithm led to

    almost a saving ratio of 50 in terms of both number of nodes

    selected and computation times, compared with the Dijkstra

    algorithm.

    Index Terms - Dijkstra algorithm, shortest path, heuristic strategy,

    the dynamic direction restricted algorithm

    I. INTRODUCTION

    The computation of shortest path in traffic networks is atthe heart of the computational needs of transportationapplications involving networks equipped with informationtechnologies. For instance, in the context of the Supply Chainapplications, the computation of shortest path is afundamental component in logistics system and in thedevelopment of solution algorithms for large-scale networkflow models; such models are useful for supporting effectiveSupply Chain decision-making. In such applications, there is

    usually a need to find a large number of shortest paths innetworks.Currently, there are many methods to solute the

    computation of shortest path. The most classical algorithm isDijkstra algorithm. The Dijkstra algorithm for large-scalenetwork needs large memory and much more computationtime, and the efficiency of algorithm can affect the wholesystems performance, so the reform and implementation ofthe algorithm becomes a research topic in the field ofcomputation science.

    This paper outlines a number of different algorithmsbased on Dijkstra algorithm and presents a new dynamicdirection restricted algorithm based on the Dijkstra algorithmfor computing shortest path. A brief discussion of thealgorithm performance on realistic data is given, and thesimulation and modeling results are presented.

    This paper is organized as follows. In Section 2, themain idea of Dijkstra shortest path finding algorithm isintroduced. In Section 3, these main shortest-path Finding

    Algorithms based on heuristic strategy are discussed. InSection 4, we propose a new dynamic direction restrictedalgorithm obtained by extending the Dijkstra algorithm.Section5 presents the results from an experimental study ofcomputer implementations of the new algorithm. Section 6gives the conclusion of this paper.

    II. DIJKSTRA SHORTEST-PATH FINDING ALGORITHM

    The Dijkstra algorithm [1]-[3], is a classical optimalLabel-Setting (LS) algorithm to solve the one-to-one shortest

    path problem in static networks. It is well-known in theliterature that the Dijkstra algorithm can find an optimal path.This algorithm searches for the minimum-cost path among all

    paths in order, beginning from the origin node, the searchregion expands concentrically. The graph-search strategy ofthis algorithm is all-directions searching strategy, which iscalled greedy searching strategy in artificial intelligence (AI),and is also the primary heuristic strategy.

    The shortest path problem is one of the mostfundamental and the most commonly encountered problems.It is modeled as finding shortest path between two nodes in aweighted and directed network. The network G = (N, A),consists of a finite set of nodes, N, and a finite set of arcs, A.All arcs are directed, so bi-directional roads are representedwith 2 arcs. We define cost [i , j]0 as the real length of thearc A between node i and node j. If the node i doesnt adjoin

    node j ,the value of cost[i , j] is . We define an assistant

    vector Dist (or Distance), and then Dist[i] means the totallength of shortest path from origin node to current node i(N[i]). S[j] is a flag (label) which means node j(N[i]) iswhether searched by the algorithm or not, and the defaultvalue is FALSE.

    The algorithm is shown below.Step 0: Mark the origin node i(N[i]).

    1-4244-0332-4/06/$20.00 2006 IEEE2531

    Proceedings of the 6th World Congress on Intelligent Control

    and Automation, June 21 - 23, 2006, Dalian, China

  • 7/29/2019 01712818

    2/6

    Step 1: Select node j (N[j]), whose label S[j] is FALSE,make sure the dist [j] is minimum. Mark the label S[j] asTRUE.

    Step 2: Calculate the movement cost (dist [k]) betweenthe origin node and each node which is connected to the N[j]and whose label S[k] is FALSE. Modify these relevantassistant vector dist[k]. If dist[j]+cost[j, k]

  • 7/29/2019 01712818

    3/6

    IV. THE DYNAMIC DIRECTION RESTRICTED ALGORITHM

    Combined with these algorithms above, we presented anew shortest path algorithm - dynamic direction restrictedalgorithm. This algorithm is based on restricted searchingdirection. People always think that the shortest-path is a set ofroads which follow or point towards the direction of the

    beeline from original node and destination node. Butsometimes this principle isnt right. As it is shown in Fig.1,the shortest path from node A to node B isnt the route setwhich includes arc 1, 2, 3, 4, 5, 6, 7, 8, but is the arc 9 and arc10. So we must allow some arcs to departure from the beelineAB, even allow some arcs point towards the reverse directionof the beeline AB, when we want to search for the shortest

    path. Then we start to think about a new direction restrictedalgorithm. Firstly, we consider using a line, which is

    perpendicular to the given beeline AB as the searching areasboundary, to judge whether the new candidate arc follows orpoints toward the beeline AB to extend. This directionrestricted condition is not enough, because the beginning arc,which belongs to the shortest path, maybe points toward thereverse direction of the beeline AB. Secondly, we prescribe

    that this direction restricted line must move along a distancePY from the original node A on the reverse direction of the

    beeline AB, such as the Fig.2 shows. So we can not only limitthe number of searching nodes and debase the complexity ofcomputation, but also solve the question of abnormaldistribution of the road net weight partly. Comparing thevalue of the beeline ABs function, we can judge whether thenew candidate arcs node locate at the direction restricted areaeasily. The extend node in direction restricted area can enterinto the Dijkstra algorithms step 2 in Section 2, the othernodes enter into the step 3. It is obvious that this method canreduce the works of calculation.

    Fig. 1 The shortest path from node A to node B

    Fig. 2 The direction restricted line and the PY

    This kind of direction restricted algorithm shows goodefficiency while the original node locates at the center ofnetworks. But when the original node locates at the edge ofnetwork, the algorithm will not be able to reduce the work ofcalculation commendably and continuously. Because thescope of searching for next node can only extend to the fixeddirection, the number of the nodes selected by the algorithmcan not be reduced largely. So the dynamic direction

    restricted algorithm is presented in this paper. In thisalgorithm, the direction restricted area isnt alwaysdetermined by the beeline from the original node to thedestination node, but by the beeline from the last extendednode in the algorithm to the destination node. Thus the scaleof searching isnt invariable, but changed by the process ofsearching. It can get rid of these nodes not being fitted for thesearch scope of direction restricted algorithm and can ensurethat the efficiency of the algorithm is improved dynamically.On the other hand, for the maturity of the algorithm, thesenodes not fitted for the condition of the dynamic directionrestricted searching are not eliminated completely, but just not

    being used to next computation loop. When the n-1 time

    computation loop is ended and the shortest path is not found,these nodes can be reused again. So we can not only use theprevious computation results, but also assure the success ratioof the algorithms searching.

    According to the above, the improved algorithm can be

    described below in the same condition as the classical

    Dijkstra algorithm.

    Step 1: Mark the origin node i(N[i]). Initialize thetemporary variable Vtemp as the origin node. Compute theinitial direction restricted searching beeline.

    Step 2: Select node j (N[j]), whose label S[j] is FALSE,make sure the dist [j] is minimum.

    Step 3: According to Vtemp, calculate the new direction

    restricted searching beeline. Judge whether the node j (N[j])satisfy the condition of direction restricted. If yes, mark thelabel S[j] as TRUE, set Vtemp as the node j (N[j]), and go tostep 4. If no, mark the label S[j] as MAYBE, and go to step5.

    Step 4: Calculate the movement cost (dist[k]) betweenthe origin node and each node which is connected to the N[j]and whose label S[k] is FALSE. Modify these relevantassistant vector dist[k]. If dist[j]+cost[j, k]

  • 7/29/2019 01712818

    4/6

    only two arcs, which are the longest arc A1 and the secondlongest arc A2, linked with the original node and the directionof each arc is the same as the direction of the beeline linkedwith the original node and the destination node. For

    preventing these tow arcs linked with the original node frombeing eliminated early, the value of PY can be set to thesummation of the distance of A1 and the distance of A2.Certainly, it is almost impossible that the kind of extreme

    networks exists. If we do like this, the search scale of thedirection restricted algorithm become wide. We know that theEuclidean distance is the beeline distance between two nodes,it must be less than or equal to the distance of arc. We can setthe value of PY to the summation of the Euclidean distance ofA1 and the Euclidean distance of A2. It can not only preventthese arcs linked with the original node from being eliminatedearly, but also keep the fitting search scale of the directionrestricted algorithm.

    The dynamic direction restricted algorithm discussedabove can also be combined with many other heuristicshortest path algorithms, such as A*, the restricted ellipse areaalgorithm and the restricted rectangle area algorithm, and so

    on. One instance out of those algorithms - the restrictedrectangle area algorithm is discussed here. The restrictedrectangle area can be determined by the four beelines: the firstone is the restricted line discussed in this section above; thesecond one is a parallel of the first beeline and it must movealong a distance PY from the destination node; the third

    beeline and the last one are respectively the parallels of thebeeline AB from two sides. They have the same distance-PYaway from the beeline AB. The last three beelines keep itsstatus in the computation process of the algorithm, while thefirst beeline does not. It will be changed with the lastextended node. Fig.3 shows the result and the restrictedrectangle area of the new algorithm combined with thedynamic direction restricted algorithm and the restrictedrectangle area algorithm. The first beeline in Fig.3 is one ofthe borderlines of the restricted rectangle area and it willmove along the beeline AB in the algorithm later (As these

    broken lines show.

    Fig. 3 The restricted rectangle area of the new algorithm

    V. COMPUTER IMPLEMENTATION AND

    EXPERIMENTAL EVALUATION

    The dynamic direction restricted algorithm discussed inthe previous section has been implemented for the purpose ofcomputational test. Dijkstra algorithm was implemented forcomparison purpose certainly. We refer to this implementation

    by DJ. The dynamic direction restricted algorithm was

    referred to as DD. Specially, the new algorithm discussed inthis article can be combined with other shortest path findingalgorithms such as the A* algorithm. So the A* algorithm wasalso implemented for comparison purposes. We refer to theA* algorithm by A*. We refer to the implementationcombined with the A* algorithm and the DD algorithm as DA.

    Note that all these algorithms will be stopped as soon as thedestination node is selected, at which time a shortest pathfrom the origin node to the destination node has beendetermined. In each iteration of these algorithms, a nodeneeds to be selected with the minimum label from the set ofcandidate nodes. This operation is implemented by using a

    binary heap data structure.In the literature, the performance of these algorithms

    above is usually characterized in terms of the number ofnodes selected. The number of nodes selected, however, may,

    by itself, not reflect the overall efficiency of this algorithm.Therefore, below we report not only the number of nodesselected by these algorithms, but also their computation times.

    All algorithms are implemented using the Cprogramming language and tested in a network containing5000 nodes and 10000 links. A network generator thatgenerates random networks was implemented using the C

    programming language. The user of this network generatorinputs the size of the network (number of nodes, number oflinks). All computational times are obtained by running thecodes on a PC, which is equipped with Windows 2000 Server

    OS, P4 2.0GHz CPU and 256M RAM. One actualimplementation interface is shown in Fig.4. (The beeline onthe top of Fig.4 is the searching areas boundary when this

    particular computation starts to search the first node. Thesearching areas boundary will be changed along with thecomputation process).

    To compare the result expediently, we choose ten ODpairs randomly with difference distance. Because thecomputation time of some of these algorithms is very fast, weneed to implement every algorithm 10 times for every OD

    pair and get the total time of 10 times for comparison.

    Fig. 4 One actual implementation

    2534

  • 7/29/2019 01712818

    5/6

    $Computer Implementation and AnalysisFirstly, we show the computational results of the number

    of nodes selected obtained using these four algorithms. Fig. 5shows that, almost for every OD pair, the number of nodesselected increases by degrees on the order of DA, A*, DD,and DJ (the result of the seventh OD pair is different, becauseof abnormal distribution of the road net weight). The resultsmean that the number of nodes selected by DD, A* and DA is

    less than the number of nodes selected by DJ, and the numberof nodes selected by DA which combined DD with A* candecrease the number of nodes selected much more. For thenetwork with 5000 nodes and 10000 links, the averagenumber of nodes selected by DJ is 2.04 times as much as theaverage number of nodes selected by DD, and the averagenumber of nodes selected by A* is 2.41 times as much as theaverage number of nodes selected by DA.

    0

    1000

    2000

    3000

    4000

    5000

    1 2 3 4 5 6 7 8 9 10OD pairs

    Fig. 5 The computational results of the number of

    nodes selected

    A*

    DA

    DDDJ

    Then the computation times of these four algorithms arecompared in Fig. 6. As Fig. 5 indicates, for every OD pair, thecomputation time is just in proportion to the number of nodesof these algorithms. The computation time of DD, A* and DA

    is less than the computation time of DJ. For this test network,the average computation time of DJ is 1.78 times the averagecomputation time of DD. The computation time of DA is alsoless than the computation time of A*. The averagecomputation time of DA is 2.41 times the averagecomputation time of A*.

    050100

    150200250300350400

    1 2 3 4 5 6 7 8 9 10OD pairs

    Fig. 6 The computation times of these four algorithms(10

    times)

    A*

    DA

    DD

    DJ

    From these computational results summarized above, weknow that the DD algorithm combined with other algorithmcan be more efficient than the DD algorithm itself.

    % Algorithms Approximate Result Analysis

    The dynamic direction restricted algorithm presented inthis article is very fast, but it can only solve the question ofabnormal distribution of the networks weight partly. So thesecomputational results sometimes are approximate results. In

    section 4, PY is presented to prevent the algorithm fromfinding an approximate result of route. We just need tocompare the results of DD and DJ to analyze the approximateresult of algorithm for every OD pair, because thecomputational result of DJ is a real result and that of DD may

    be an approximate result. To analyze algorithms approximateresult accurately, we must compute all shortest path for everyOD pairs in networks. Let us consider that the ratio of the sumlength of one certain DJs result route set to the sum length ofone certain DDs result route set is analysis standard, which isnot greater than 1. To analyze algorithms approximate resultclearly, one can define approximate degree (AD), which is the

    percentage of the total times of the ratio above is less than 1 to

    the total times of all OD pairs. As mentioned in Section 4, thechoice of PY is very important for the computational result, sothree types of the value of PY are selected. The first value ofPY is the Euclidean distance of the longest arc in the network.We refer to this type of PY by (PY: Max). The second value ofPY is the summation of the Euclidean distance of the longestarc and the Euclidean distance of the second Euclideanlongest arc. We refer to this type of PY by (PY: Max+Max1).The last value of PY is two times the Euclidean distance ofthe longest arc. We refer to this type of PY by (PY: 2*Max).

    Below we analyze approximate result using the same testplatform as that in this section. Fig 7 shows that ADs arenondecreasing functions of PY and the increase scaledecreases step by step. The AD of (PY: Max) is 98.05%. TheAD of (PY: Max+Max1) is 99.55%. The AD of (PY: 2*Max)is 99.81%. It seems that the AD increases with the length ofPY, but at different rate. As indicated in section 4, it is thecore of the DD algorithm to reduce the number of nodesselected by the algorithm. The longer the length of PY is, thehigher the number of nodes selected by the algorithmincreases. Under the conditions of three types of PY, thenumber of nodes selected by the DD algorithm is compared tosolve the largest scale shortest path-finding problem (We try

    our best to choose a longest route for the test.). Table , showsthat the rate of increase of PY is higher than the rate of theAD. The AD of (PY: Max+Max1) is 1.5% higher than TheAD of (PY: Max), but the number of nodes selected increases

    603 nodes. The AD of (PY: 2*Max) is 0.26% higher than TheAD of (PY: Max+Max1), but the number of nodes selectedincreases 307 nodes. It is obvious that priority should be givento the AD and the number of nodes selected at the same time,so a conclusion can be drawn that the best choice of this typeof PY is (PY: Max+Max1).

    Numbero

    fnodesselected

    Computationtimes(ms)

    2535

  • 7/29/2019 01712818

    6/6

    96

    98

    100

    Fi g. 7 Al gori t hm' s approxi mat e r esul t anal ysi s

    PY:Max PY:Max+Max1 PY: 2*Max

    TABLE.I

    ALGORITHMS APPROXIMATE RESULT ANALYSIS

    Value of PY AD

    Number

    of nodes

    selected

    Increase

    rate of

    AD

    Increase

    of nodes

    selected

    PYMax 98.05% 2956 0 0

    PY MaxMax1 99.55% 3559 1.50% 603

    PY2*Max 99.81% 3866 0.26% 307

    VI.CONCLUSION

    In this paper, a new shortest path finding algorithmbased on heuristic strategy for computing shortest pathbetween one origin node and one destination in trafficnetwork is presented. It exploits the knowledge that theshortest path always follows or points toward the direction ofa beeline from original node and destination node.Particularly, the new algorithm discussed in this article can becombined with other shortest path finding algorithms such asthe A* algorithm. The new algorithm was implemented andits computational performance was experimentally evaluatedand tested. The performance of the computer implementation

    of the dynamic direction restricted algorithm is compared toDijkstra algorithm, A*, and so on. Results using a networkcontaining 5000 nodes and 10000 links showed almost asaving ratio of 50, in terms of both number of nodes selectedand computation times, comparing with the Dijkstraalgorithm.

    The algorithm discussed in this article can also beoptimized. For example, the computational times can bedecreased with advanced data structures (quad-heap priorityqueue, or Fibonacci heap, etc). We will do further research inthese fields in the future.

    ACKNOWLEDGMENT

    The authors are grateful to all participators for theirvaluable comments and suggestions that have lead to theimprovements of this paper. The first author is also grateful tohis superior for supporting this research.

    REFERENCES

    [1] Lu Feng, Shortest Path Algorithms: Taxonomy and Advance inResearch, Acta Geodaetica et Cartographica Sinica, vol.30, no. 8, pp.269-275, 2001. (in Chinese).[2] Yan Weimin and Wu Weimin,Data Structure. Tsinghua University Press,1997, pp.186-187.[3] Tang Wenwu, SHI Xiaodong and ZHU Dakui, The Calculation of theShortest Path Using Modified Dijkstra Algorithm in GIS, Journal of Imageand Graphics, vol.5(A), no.12, pp.1019-1023, 2000. (in Chinese)[4] Lu Feng, Lu Dongmei and Cui Weihong, Improved Dijkstra's AlgorithmBased on Quad-heap Priority Queue and Inverse Adjacent Lists, Journal ofImage and Graphics, vol.4(A),no.12, 1999. (in Chinese).[5] Fredman M L and Tarjan R E, Fibonacci Heaps and Their Uses inImproved Network Optimization Algorithms, Journal of the Association forComputing Machinery, vol.34, no.3, pp. 596-615, 1987.[6] Stig Nordbeck and Bengt Rstedt, Computer Cartography Shortest routePrograms. Sweden: The Royal University of Lund,1969.[7] Lu Feng, Lu Dongmei and Cui Weihong, Time Shortest Path Algorithmfor Restricted Searching Area in Transportation Networks, Journal of Imageand Graphics, vol.4, no.10, 1999. (in Chinese).[8] Yan Hanbing and Liu Yingchun, A New Algorithm for Finding Shortcutin a City's Road Net Based on GIS Technology, Chinese Journal ofComputers, vol.23, no.2, 2000. (in Chinese).[9] E.P.Hart, N. J. Nilsson, and B. Raphael, A Formal Basis for the HeuristicDetermination of Minimum Cost Paths, IEEE Trans. Syst. Sci. Cybern., vol.4, no. 2, pp. 100107, 1968.

    [10] J. N. Nilsson, Problem-Solving Methods in Artificial Intelligence. NewYork: McGraw Hill, 1971.[11] I. Pohl, Heuristic Search Viewed as Path Finding in a Graph, Artif.Intell.,vol. 1, pp. 193204, 1970.[12] J. Pearl, Heuristic Intelligent Search Strategies for Computer ProblemSolving. Reading, MA: Addison-Wesley, 1984.[13] Xia Bing, Bao Yuanlv. Research on Shortest Path Problem of VectorMap. Microcomputer Development. 2001, Vol.5 (5) (in Chinese).[14] J. L. Bander and C. C. White, III, A New Route OptimizationAlgorithm for Rapid Decision Support, in Proc. SAE/IEEE-VTS VNIS,Detroit, MI, 1991, pp. 709728.[15] J. W. Lark, C. C. White, III, and K. Syverson, A Best-first SearchAlgorithm Guided by a Set-valued Heuristic, IEEE Trans. Syst., Man,Cybern., vol. 25, pp. 10971101, 1995.[16] Cui Weihong, Research on Spatial Data Structure. China Science andTechnology Press. 1995[17] Chen Xingxing and Cui Weihong, An Experimental Study of Rapid

    Reacting System of City, Remote Sensing of Environment China, vol.11,no.3, pp. 227-233, 1996.[18] Zhan F. B., Three Fastest Shortest Path Algorithms on Real Road

    Networks, Journal of Geographic Information and Decision Analysis, vol.1,no.1, pp.69-82, 1997.[19] Zhan F. B., NOON C.E., Shortest Path Algorithms: An EvaluationUsing Real Road Networks, Transportation Science, vol.32, no.1 pp. 65-73,1998.[20] Wang Chaorui, Graph Theory (Second Edition). Beijing Institute ofTechnology Press, 1997.[21] Hung M.S. and DivokyJJ.A., Computational Study of Efficient ShortestPath Algorithms, Computers and Operations Research, vol.15, pp. 567-576,1988.[22] Bertsekas D.P., A Simple and Fast Label Correcting Algorithm forShortest Paths, Networks, vol. 23, pp. 703-709, 1993.[23] Orda A. and Rom R., Shortest-path and Minimum-delay Algorithms in

    Networks with Time-dependent Edge-length, Journal of the Association forComputing Machinery, vol. 37,no. 3, pp. 607-625, 1990.[24] Cherkassky B.V., Goldberg A. V. and Radzik T., Shortest PathsAlgorithms: Theory and Experimental Evaluation, MathematicalProgramming, vol.73, pp. 129-174, 1996.[25] Fisher P.F., A Primer of Geographic Search Using ArtificialIntelligence, Computers & Geosciences, vol.16, no.6,pp. 753-776, 1990.

    Percent(%)

    2536