AN ALGORITHM FOR FINDING SHORTEST ROUTES FROM ALL SOURCE NODES TO A GIVEN DESTINATION IN GENERAL NETWORKS*

Similar documents
Handout 4: Deterministic Systems and the Shortest Path Problem

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE

Dynamic Programming: An overview. 1 Preliminaries: The basic principle underlying dynamic programming

THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE

Introduction to Dynamic Programming

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE

Homework solutions, Chapter 8

Alain Hertz 1 and Sacha Varone 2. Introduction A NOTE ON TREE REALIZATIONS OF MATRICES. RAIRO Operations Research Will be set by the publisher

IEOR E4004: Introduction to OR: Deterministic Models

Sequential Decision Making

Dynamic Programming (DP) Massimo Paolucci University of Genova

Sum-Product: Message Passing Belief Propagation

Elif Özge Özdamar T Reinforcement Learning - Theory and Applications February 14, 2006

UNIT 2. Greedy Method GENERAL METHOD

Optimization Methods. Lecture 16: Dynamic Programming

Essays on Some Combinatorial Optimization Problems with Interval Data

Analyzing Pricing and Production Decisions with Capacity Constraints and Setup Costs

Markov Decision Processes: Making Decision in the Presence of Uncertainty. (some of) R&N R&N

CEC login. Student Details Name SOLUTIONS

Martingale Pricing Theory in Discrete-Time and Discrete-Space Models

Q1. [?? pts] Search Traces

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Chapter 15: Dynamic Programming

Lecture 17: More on Markov Decision Processes. Reinforcement learning

Lecture 6. 1 Polynomial-time algorithms for the global min-cut problem

The Probabilistic Method - Probabilistic Techniques. Lecture 7: Martingales

Sum-Product: Message Passing Belief Propagation

Family Vacation. c 1 = c n = 0. w: maximum number of miles the family may drive each day.

CS 188: Artificial Intelligence

Final Projects Introduction to Numerical Analysis Professor: Paul J. Atzberger

LEC 13 : Introduction to Dynamic Programming

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS

Yao s Minimax Principle

A Learning Theory of Ranking Aggregation

PARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES

Lecture 10: The knapsack problem

Advanced Operations Research Prof. G. Srinivasan Dept of Management Studies Indian Institute of Technology, Madras

Corrections to the Second Edition of Modeling and Analysis of Stochastic Systems

1) S = {s}; 2) for each u V {s} do 3) dist[u] = cost(s, u); 4) Insert u into a 2-3 tree Q with dist[u] as the key; 5) for i = 1 to n 1 do 6) Identify

Final Projects Introduction to Numerical Analysis atzberg/fall2006/index.html Professor: Paul J.

Sublinear Time Algorithms Oct 19, Lecture 1

Chapter wise Question bank

Price of Anarchy Smoothness Price of Stability. Price of Anarchy. Algorithmic Game Theory

ECE 586GT: Problem Set 1: Problems and Solutions Analysis of static games

Optimal energy management and stochastic decomposition

More Advanced Single Machine Models. University at Buffalo IE661 Scheduling Theory 1

SCALING ALGORITHMS FOR THE SHORTEST PATHS PROBLEM*

Optimal prepayment of Dutch mortgages*

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

CSE 473: Artificial Intelligence

Multiple State Models

Lecture outline W.B.Powell 1

The ruin probabilities of a multidimensional perturbed risk model

Chapter 21. Dynamic Programming CONTENTS 21.1 A SHORTEST-ROUTE PROBLEM 21.2 DYNAMIC PROGRAMMING NOTATION

Optimal rebalancing of portfolios with transaction costs assuming constant risk aversion

THE NON - STOCK EXCHANGE DEALS OPTIMIZATION USING NETFLOW METHOD. V.B.Gorsky, V.P.Stepanov. Saving Bank of Russian Federation,

Strong Subgraph k-connectivity of Digraphs

CS 188: Artificial Intelligence Spring Announcements

CS 174: Combinatorics and Discrete Probability Fall Homework 5. Due: Thursday, October 4, 2012 by 9:30am

February 2 Math 2335 sec 51 Spring 2016

91.420/543: Artificial Intelligence UMass Lowell CS Fall 2010

The Floyd-Warshall Algorithm for Shortest Paths

Roll No. :... Invigilator s Signature :.. CS/B.TECH(IT)/SEM-5/M(CS)-511/ OPERATIONS RESEARCH AND OPTIMIZATION TECHNIQUES

e-companion ONLY AVAILABLE IN ELECTRONIC FORM

6 -AL- ONE MACHINE SEQUENCING TO MINIMIZE MEAN FLOW TIME WITH MINIMUM NUMBER TARDY. Hamilton Emmons \,«* Technical Memorandum No. 2.

is a path in the graph from node i to node i k provided that each of(i i), (i i) through (i k; i k )isan arc in the graph. This path has k ; arcs in i

CS 188: Artificial Intelligence Fall 2011

OPTIMAL PORTFOLIO CONTROL WITH TRADING STRATEGIES OF FINITE

The Theory of Interest

The Limiting Distribution for the Number of Symbol Comparisons Used by QuickSort is Nondegenerate (Extended Abstract)

arxiv: v1 [q-fin.rm] 1 Jan 2017

CSEP 573: Artificial Intelligence

Chapter 5 Finite Difference Methods. Math6911 W07, HM Zhu

Finding optimal arbitrage opportunities using a quantum annealer

King s College London

So we turn now to many-to-one matching with money, which is generally seen as a model of firms hiring workers

Utility Indifference Pricing and Dynamic Programming Algorithm

Making Decisions. CS 3793 Artificial Intelligence Making Decisions 1

1 Online Problem Examples

The assignment game: Decentralized dynamics, rate of convergence, and equitable core selection

Recall: Data Flow Analysis. Data Flow Analysis Recall: Data Flow Equations. Forward Data Flow, Again

0/1 knapsack problem knapsack problem

PREPRINT 2007:3. Robust Portfolio Optimization CARL LINDBERG

Alain Hertz 1 and Sacha Varone 2

MDPs: Bellman Equations, Value Iteration

Probability in Options Pricing

Dynamic Programming cont. We repeat: The Dynamic Programming Template has three parts.

Allocation of Roadside Units for Certificate Update in Vehicular Ad Hoc Network Environments

Robust portfolio optimization

Stochastic Dual Dynamic integer Programming

Markov Decision Processes

CS 188: Artificial Intelligence

Failure and Rescue in an Interbank Network

Solutions of Bimatrix Coalitional Games

Notes, Comments, and Letters to the Editor. Cores and Competitive Equilibria with Indivisibilities and Lotteries

MATH 361: Financial Mathematics for Actuaries I

Deterministic Dynamic Programming

Bioinformatics - Lecture 7

TDT4171 Artificial Intelligence Methods

King s College London

Transcription:

526 AN ALGORITHM FOR FINDING SHORTEST ROUTES FROM ALL SOURCE NODES TO A GIVEN DESTINATION IN GENERAL NETWORKS* By JIN Y. YEN (University of California, Berkeley) Summary. This paper presents an algorithm for finding all shortest routes from all nodes to a given destination in iv-node general networks (in which the distances of arcs can be negative). If no negative loop exists, the algorithm requires \M(N 1) (N 2), 1 < M ^ JV 1, additions and comparisons. The existence of a negative loop, should one exist, is detected after \N{N \){N 2) additions and comparisons. 1. Introduction. All shortest routes from all nodes to a given destination in iv-node networks can be solved in two different fashions. When the distances of arcs are all positive the problem can easily be solved by an efficient algorithm proposed by Dijkstra [4] which requires roughly 27V2 additions and comparisons. But when the distances of some arcs are negative (yet no negative loop exists) the problem becomes harder and can only be solved by the relatively inefficient and sometimes complicated algorithms proposed by Ford [8], Moore [11], Bellman [1], Floyd [7], Murchland [12], Dantzig [3], Dantzig, Blattner and Rao [2], Hu [9], Dreyfus [5], and others in which as many as N3 additions and comparisons can be necessary. (For the algorithm of [2] the upper bound on calculations may be a little under N3 but well over 5N3. See Dreyfus [6] for reference.) The purpose of this paper is to present an algorithm for solving the problem in which the distances of some arcs are negative. The advantages of the new algorithm are that, if no negative loop exists, it requires at most (N l)(n 2), 1 < M i N 1, additions and comparisons; and, if there exists a negative loop, it is detected in (N 1)(N 2) additions and comparisons. Remark. Note that when the distances of arcs are all positive, Dijkstra's algorithm is superior to the new algorithm in most cases. Therefore, the new algorithm, in general, should be applied only when the distances of some arcs in the network are negative. 2. Notation. In an iy-node network, let (i), i = 1,2,, N, be the nodes where (N) is the destination, (i, j), i 5^ j, be the directed arcs from (1) to (j), (?')-(i)-"' --(N), i j 7^ N, be the route from (i) to (N) passing through (;),, ditj I 0, i j, be the distances of (i, j). If (i, j) exists, diti is a finite number; otherwise, di j is considered equal to infinity, 0 = [^i.j] be the distance matrix of the network, i 1, 2,, N, be the lengths of tentative shortest routes from (i) to (N) on the fctli iteration, fi,i= 1, 2,, N, be the lengths of shortest routes from (i) to (N). 3. Functional equations. By the principle of dynamic programming, /<, i = 1, 2,, N 1, are the set of values that satisfy the following system of equations: /, = min,vi [/, + d,.,]. Our algorithm computes these values by means of the following iterative procedure: Received July 21, 1968; revised version received December 4, 1968.

1970] NOTES 527 f" i = 1,2,,N, (1.1) = min + dt.t, /{»-"], i N 1, N 2,,1, /<2i~u = /r_2), (1.2) rr = min [/J2i) + d,..f., /{»-"],» = 2, 3,, AT, = /J""1', (1.3) 1 ^ J < * for fc = 1, 2,. The iterative procedure of the algorithm is to be terminated when j\2k) = /J2*-1', or /<2t+1> = /<">, t = 1, 2,, N. Then /<2t), or /<2i+1>, t = 1, 2,, N - 1, are the lengths of shortest routes from (i), i 1, 2,, N 1, to (AT). If by the Arth iteration convergence has not occurred, a negative loop must exist and the problem has no solution. 4. Proof. Suppose the shortest path from (i) to (N) passes through P nodes, 0 ^ P ^ N 2, enroute. Let it be ~(NP)-(N), where (Ni), i = 1,2,, P, are distinct nodes of the original network. The path can be divided into M homogeneous blocks, 1 ^ M ^ N 1, in which the numbers naming the nodes in each block either form a strictly increasing or decreasing sequence. We can depict the situation as follows: (AO > (ATj) > (N,) > 1st homogeneous block of size > (Nri) < (ATri + 1) < (ATri+2) <... < (NJ > 2nd homogeneous block of size r2 (Nr *-, + >) (*) A/th homogeneous block of size rm (2.0) For example, the path (l)-(3)-(5)-(4)-(2)-(6)-(7) consists of 3 homogeneous blocks (7) > (6) > (2) < (4) < (5) > (3) > (1). In the 1st homogeneous block, since (N) > (A\) > (N2) > > (ATri), the unique and optimal lengths from (Nt), (N2),, (NrJ to (N) as shown by Parikh [13] and others are as follows: = min [/, + d4.f] = min [j, + dt,,, diin], i = N,, N,,,NW,, (2.1) N j>i N>j>i which is contained in (1.2) for fc = 1 as follows: /<1; = min [fr + diti, /S0)], i = N - 1, N - 2,, 1, = fi?\ N>i>i Therefore, the unique and optimal lengths from (Ar1), (N2),, (Nri) to (N) are determined in Iteration 1. In the 2nd homogeneous block, since (a) /,, i = 2V\, N2, -, Nr,, are already determined in Iteration 1, and (b) (Nri) < (Nri+1) < (NTl+2) < < (NrJ, the unique and optimal lengths from (Nri+1), (Nri+2),, (AT,,) to (N) are as follows: = min ient,jv«[/,- + d4.,, i = Nrt + 1, Nrt + 2,, Ntm (2.2) 1 i <» which is contained in (1.3) for fc = 1 as follows: /,<2) = min [/:2> + dt.,, /.<"], i = 2, 3,, N, /,(2) = /,(1). 1SI<»

528 JIN Y. YEN [Vol. XXVII, No. 4 Therefore, the unique and optimal lengths from (Nri + 1), (TVri +2),, (TVr,) to (TV) are determined in Iteration 2. As shown by (2.0), since M, the number of homogeneous blocks, is bounded by TV 1, the successive approximation of the shortest lengths from (i), i = 1,2,, TV 1, to (TV) terminates in no more than TV 1 iterations. Therefore, the iterative procedure of the algorithm converges in finite steps and the solutions thus obtained is unique and optimal. Remark. Note that the necessary and sufficient condition for convergence is that no negative loop exist in the network. If the algorithm does not converge in TV iterations (i.e., /;'v~u 7^ j'f\ i = 1, 2,, N) it is because there exists at least a shortest route from some (i) to (TV) that has more than TV 1 arcs. In other words, the network contains at least a negative loop. In such case, no solution can be defined. 5. Illustration. Let a 5-node general network have the following D matrix. 1 2 3 4 5 Then the solution is to be obtained by applying the algorithm Iteration 0. Obtain / 0), i = 1, 2,, 5, as follows: /r = di,. = 2, /r = = 2, no) = d3,5 = -i, as follows: /i0) = d,.s = 3, no) = d... = o. Iteration 1. Starting from i 5 toward i 1 compute /"', i = 5, 4,, 1, as follows: H" = /r = 0, fi" = C = 3, /3'1> = min [/I1' + ds,4, /i0)] = min (3 + 1, 1) = -1, fi" = min [/<" + d2.4, 1 + d2.3, /D = min (3 + 2, -1 + 4, 2) = 2, fi ' = min [j") + d1:i, + d,,3, + d\,2, j\ ] = min (3 + 0, -1 + 3, 2 + 1, 2) = 2. Note that only the upper triangle elements enter into the computation in Iteration 1.

1970] NOTES 529 Iteration 2. Starting from i = 1 toward i = 5 compute /-2), i = 1,2,, 5, as follows: /;2) = />(1) = 2, U2) = min [/{2) + d2.i, /<1J] = min (2 + 2, 2) = 2, /f' = min [/{2) + d3, /r + 4.2, /s1'] = min (2_+ 1. 2,+ 0, -1) = -1, /i2' = min [/I2' + dia, fl2) + 4.2, /f = min (2 + 2, 2-1, -1 + 3, 3) = 1. 1 = 0. + 4.3, /«"'] Note that only the lower triangle elements enter into the computation in Iteration 2. Iteration 3. Similar to Iteration 1, f-3), i = 5, 4,, 1, are obtained as follows: /<3> = o, /«> = 1, /<3> = -1, /<» = 2, j[3) = 1. Iteration 4. Similar to Iteration 2, / 4), i = 1, 2,, 5, are obtained as follows: /:4> = i, n*' = 2, n4) = -l, = i, = o. Note that /-4) = /J3), i = 1, 2,,5. This implies that fiti= 1, 2,, 5, are determined in Iteration 3. Therefore, the algorithm terminates. Then the lengths of shortest routes from (i), i = 1, 2, 3, 4, to (5) are respectively equal to 1, 2, 1, 1. The shortest routes can be obtained from the optimal policy table recorded in the iterative process. They are as follows: Shortest route from (1) to (5) (1)-(4)-(2)-(5). Shortest route from (2) to (5) (2)-(5). Shortest route from (3) to (5) Shortest route from (4) to (5) (3) (5). (4) (2) (5). Acknowledgment. The author is very grateful to Professors Stuart E. Dreyfus and Jack D. Rogers for their reading of the manuscript and instructions. References 1. R. E. Bellman, On a routing problem, Quart. Appl. Math. 16, 87-90 (1958) 2. G. B. Dantzig, W. O. Blattner and M. R. Rao, All shortest routes from a fixed origin in a graph, Technical Report No. 66-2, Operations Research House, Stanford University, Nov. 1966 3. G. B. Dantzig, All shortest routes in a graph, Technical Report No. 66-3, Operations Research House, Stanford University, Nov. 1966 4. E. W. Dijkstra, A Note on two problems in connexion with graphs, Numer. Math. 1, 269-271 (1959) 5. S. E. Dreyfus, An appraisal of some shortest path algorithms, Memorandum RM-5433-PR, RAND Corp., Oct. 1967 6., An appraisal of some shortest path algorithms (revised), Memorandum RM-5433-1-PR, RAND Corp., Sept. 1968 7. R. W. Floyd, Algorithm 97, shortest path, Comm. ACM (6) 5, 345 (1962) 8. L. R. Ford, Jr., Network flow theory, RAND Corp., P-923, Aug. 1956 9. T. C. Hu, Revised matrix algorithms for shortest paths, SIAM J. Appl. Math. (1) 15, 207-218 (1967) 10. T. C. Hu, A decomposition algorithm for shortest paths in a network, Operations Res. (1) 16, 91-102 (1968) 11. E. F. Moore, The shortest path through a maze, Proc. Internat. Sympos. on the Theory of Switching, II, April, 1957 12. J. D. Murchland, A new method for finding all elementary paths in a complete directed graph, London School of Economics, Report LSE-TNT-22, 1965

530 JIN Y. YEN [Vol. XXVII, No. 4 13. A. C. Parikh, Some theorems and algorithms for finding optimal paths over graphs with engineering applications, Ph.D. thesis, Purdue University, 1960 14. J. Y. Yen, Some algorithms for finding the shortest routes through the general networks, Paper presented at the SIAM 2nd Internat. Conf. on Computation Methods on Optimization Problems, San Remo, Italy, Sept. 1968 15., A matrix algorithm for solving all shortest routes from a fixed origin in the non-negative networks, Paper presented at the TIMS 15th Internat. Meeting, Cleveland, Ohio, Sept. 1968