1.225J 1.225J (ESD 225) Transportation Flow Systems Lecture 4 Introduction to Network Models and Shortest Paths Profs. Ismail Chabini and Amedeo Odoni Lecture 4 Outline Conceptual Networks: Definitions Representation of an Urban Road Network (Supply) Shortest Paths (Reading: pp. 359-367, 6.2.3 and 6.2.4 of R6) • Introduction • Dijkstra’s algorithm: example • Dijkstra’s algorithm: statement • Observations Extensions to Classical Shortest Path Problems All-or-nothing traffic assignment Zoning and Analysis Periods (Demand) Motivation for more advanced traffic assignment models Summary 1.225, 11/07/02 Lecture 4, Page 2 1 Conceptual Networks: Definitions A network is: • a set of nodes N and a set of links A • nodes are also called vertices or points • links are also called arcs or edges Examples: Net 2 Net 1 1 2 1 2 3 4 3 4 5 Directed networks: all links are directed Path: a sequence of links from one node to another node (i.e., (5,4)-(4,3)-(3,2)) A network is connected if there is at least one path from one node to another node (Net1 is connected whereas Net2 is not) 1.225, 11/07/02 Lecture 4, Page 3 Representation of an Urban Road Network Physical Intersections Streets Zones Conceptual Nodes Links Centroids Simple node representation 1.225, 11/07/02 Lecture 4, Page 4 2 Intersection Representations Simple node representation: • no direction differenciation • no conflicting movement Subnetwork representation: • explicit direction representation • conflicting turns in an intersection are captured by internal links and their impedances Conceptual representation is not unique and depends on: • type of analysis • data availability to build, validate, and apply model • accuracy vs. computation time trade-off 1.225, 11/07/02 Lecture 4, Page 5 Shortest Path Problems Basic problem: find a shortest path and the shortest distance between two nodes Basic problem is called the one-to-one shortest path problem Types of shortest path problems: • One-to-one • One-to-all: find shortest paths from one node to all nodes • All-to-one: find shortest paths from all nodes to one node • Many-to-many: find shortest paths from many nodes to many other nodes • All-to-all: find shortest paths from all node pairs “Shortest” also denotes minimum general cost There are hundreds of shortest path algorithms, but they are similar Some algorithms work for non-negative costs only 1.225, 11/07/02 Lecture 4, Page 6 3 Dijkstra’ Dijkstra’s Shortest Paths Algorithm: Example 7 b Mixed network f 6 5 5 3 h 5 2 1 a c 8 e 8 j 1 5 i d Directed network 7 6 f 5 5 a c h 5 j 1 6 6 2 2 1 e 8 8 5 4 g 4 b 3 6 6 2 i d g 4 1.225, 11/07/02 4 Lecture 4, Page 7 First Shortest Path Algorithm (Dijkstra (Dijkstra’’s Algorithm) Notation: • s: source node • d(j): length of shortest path from s to j discovered so far • p(j): immediate predecessor to node j on shortest path from s to j discovered so far • k: last node selected by algorithm Step 1: Initialization • d(s) = 0, p(s) = * • d(j) = ∝, p(j) = -, for all other nodes j ≠ s • k=s 1.225, 11/07/02 Lecture 4, Page 8 4 Dijkstra’ Dijkstra’s Shortest Paths Algorithm: Example (3,a)+ 1st iteration 3 (∝,-) f 7 b 5 5 6 (∝,-) h 5 (∝,-) (0,*)+ a c d (5,-) 1 g (∝,-) 4 6 5 5 i (∝,-) 4 (10,-) f 7 (3,a)+ b 3 j (∝,-) 6 2 5 2nd iteration e 8 (8,-) 8 6 (∝,-) h 5 (∝,-) (0,*)+ a c (8,-) 8 d (5,a)+ 1.225, 11/07/02 j (∝,-) 1 6 6 4 g (∝,-) 2 1 e 8 2 5 2 1 4 i (∝,-) Lecture 4, Page 9 First Shortest Path Algorithm (Dijkstra (Dijkstra’’s Algorithm) Step 2: Update labels of neighbors in open state • For all (k, j), if j is open do: If d(j) < d(k) + l(k, j) then d(j) = d(k) + l(k, j) p(j) = k Step 3 • Find a open state node i such that d(i) = min{d(j), j is an open node)} Step 4 • Find a closed state node j* such that d(i) = d(j*) + l(j*,i) Step 5 • Node i is closed. If no node in open state , STOP. Otherwise k = i, return to Step 2 1.225, 11/07/02 Lecture 4, Page 10 5 Shortest Paths Algorithm: Example 3 (10,-) f 7 (3,a)+ b 3rd iteration 6 5 5 (∝,-) h 5 (∝,-) (0,*)+ a c 8 d (5,a)+ 1 g (9,-) 4 6 5 5 i (∝,-) 4 (10,-) f 7 (3,a)+ b 3 j (∝,-) 6 2 5 4th iteration e 8 (7,d)+ 6 (∝,-) h 5 (15,-) (0,*)+ a c 2 1 e 8 (7,d)+ 8 j (∝,-) 1 6 6 2 5 2 1 d g (9,d)+ 4 (5,a)+ i (∝,-) 4 1.225, 11/07/02 Lecture 4, Page 11 Shortest Paths Algorithm: Example 3 (10,b)+ f 7 (3,a)+ b 5th iteration 6 5 5 (∝,-) h 5 (15,-) (0,*)+ a c 8 d (5,a)+ 1 g (9,d)+ 4 6 5 5 i (13,-) 4 (10,b)+ f 7 (3,a)+ b 3 j (∝,-) 6 2 5 6th iteration e 8 (7,d)+ 6 (16,-) h 5 (15,-) (0,*)+ a c (7,d)+ 8 1.225, 11/07/02 j (∝,-) 1 6 6 d (5,a)+ 4 g (9,d)+ 2 1 e 8 2 5 2 1 4 i (13,g)+ Lecture 4, Page 12 6 Shortest Paths Algorithm: Example 3 (0,*)+ 5 a c (14,i)+ e 8 (7,d)+ g (9,d)+ 6 5 5 c 6 5 (15,e)+ h (14,i)+ 2 1 e 8 (7,d)+ 8 i (13,g)+ 4 (10,b)+ f 7 (3,a)+ b j (∝,-) 1 6 6 2 5 j (19,-) 1 4 a 2 1 6 d (5,a)+ 3 (16,-) h 5 2 5 8th iteration 6 5 8 (0,*)+ (10,b)+ f 7 (3,a)+ b 7th iteration d g (9,d)+ 4 (5,a)+ i (13,g)+ 4 1.225, 11/07/02 Lecture 4, Page 13 Shortest Paths Algorithm: Example 3 (0,*)+ 5 5 a c 8 (7,d)+ 6 5 (15,e)+ h (14,i)+ j (17,h)+ 1 6 6 d (5,a)+ 4 4 (10,b)+ f 7 (3,a)+ b g (9,d)+ i (13,g)+ (15,e)+ h 3 (14,i)+ (0,*)+ a c 1 e (7,d)+ d (5,a)+ 1.225, 11/07/02 4 2 j (17,h)+ 1 2 5 2 1 e 8 2 5 Shortest-path tree (10,b)+ f 7 (3,a)+ b 9th iteration g (9,d)+ 4 i (13,g)+ Lecture 4, Page 14 7 Observations about Dijkstra’ Dijkstra’s Algorithm Dijkstra’s algorithm is in general not valid if some l(i, j) < 0 Shortest paths form a tree The algorithm can also solve the all-to-one problem If you solve for a one-to-many problem, stop the algorithm when all destination nodes are closed Shortest path problem is an LP problem, but it is more efficient and intuitive to look at it as a network problem as we did in class 1.225, 11/07/02 Lecture 4, Page 15 Extensions of Shortest Path Problem There is a huge number of potential extensions of the classical shortest path problem Problems on dynamic networks (link lengths change over time) Problems on probabilistic networks (link lengths are random variables assuming discrete values or a continuous range of values) Combinations thereof Solutions to these problems depend on the assumptions regarding the state of knowledge and on the relative magnitude of the parameters involved The meaning of “shortest path” is also an issue in some cases 1.225, 11/07/02 Lecture 4, Page 16 8 A Traffic Assignment Problem 2 2 1 1 4 8 1 4 5 4 2 3 6 3 1 2 3 4 5 1 - 30 35 40 15 2 10 - 15 12 10 3 50 40 - 35 20 4 25 30 35 - 40 5 45 30 35 40 - 1.225, 11/07/02 Lecture 4, Page 17 “AllAll-oror-nothing” nothing” Traffic Assignment 130 47 85 2 115 130 52 120 235 127 130 4 1 130 150 85 50 180 170 35 3 120 1.225, 11/07/02 5 145 Does this make sense? Lecture 4, Page 18 9 Traffic Assignment Models Conceptual definition: Supply (input) (input) Supply/Demand Interaction • Network representation of transportation network • Link performance functions Demand • Origin-destination flows • Zoning output Flows and Travel Times Principles of assignment to represent the interaction • User Optimal (U.O.): O-D flows are assigned to paths with minimum travel time • System Optimal (S.O.): O-D flows are assigned such that total travel time on the network is minimum 1.225, 11/07/02 Lecture 4, Page 19 Zoning Physical zones 10 Zone-to-zone Flows 11 Zone 1 13 12 Zone 2 15 14 Zone 3 16 Zone 4 17 18 Zone 1 Zone 2 Zone 3 Zone 4 Centroid nodes and Connectors 10 11 13 1.225, 11/07/02 15 4 3 16 12 14 17 Zone 2 90 0 180 70 Zone 3 120 60 0 150 Zone 4 80 130 50 0 O/D Flows 2 1 Zone 1 0 100 120 40 18 1 2 3 4 1 0 100 120 40 2 90 0 180 70 3 120 60 0 150 4 80 130 50 0 Lecture 4, Page 20 10 Analysis Periods flows Morning-peak period Midday period time of day Evening-peak period Over an analysis period, flows are assumed constant in order for steadystate analysis to apply The duration of a period is longer than a trip Typical analysis periods: morning-peak, midday, evening-peak 1.225, 11/07/02 Lecture 4, Page 21 Lecture 4 Summary Conceptual Networks: Definitions Representation of an Urban Road Network (Supply) Shortest Paths (Reading: pp. 359-367, 6.2.3 and 6.2.4 of R6) • Introduction • Dijkstra’s algorithm: example • Dijkstra’s algorithm: statement • Observations Extensions to Classical Shortest Path Problems All-or-nothing traffic assignment Zoning and Analysis Periods (Demand) Motivation for more advanced traffic assignment models 1.225, 11/07/02 Lecture 4, Page 22 11