dr Jolanta Koszelew Katedra Informatyki Teoretycznej Wydział Informatyki Politechnika Białostocka Approximation Method to Route Generation in Public Transportation Network Abstract This paper presents a new approximation method to optimal route generation in time-dependent public transportation network. The method determines the set of routes with quasi-optimal travel time and is based on special matrices and label-setting schema. Some illustrative examples are provided and several conclusions about time-complexity and quality of approximation of the method are also described. Keywords: transportation network, bi-modal graph, route optimization, label-setting schema. 1. Introduction There are many economic and ecological arguments for using public transport in modern cities. Therefore portals with journey planners are very popular. The user of such system determines original and destination point of the travel, the start time, preferences and gets information about optimal routes. In practice, public transport users preferences may be various. We consider the most important of them: a minimal travel time. Standard shortest path algorithms 1 find the shortest paths in networks with static and deterministic links, meanwhile algorithms for a scheduled transportation network are timedependent. The graph in our model has two types of edges: directed links which represent connections between bus-stops and undirected edges corresponding to the travel between each pair of neighbor nodes (bus-stops) on foot. Each node in the graphs that represent the transportation network includes detail information about timetables, coordinates of bus-stops, etc. These three differences between graphs in standard shortest paths problem and public transportation networks cause that the time complexity of algorithms which solves routing 1 Dijkstra E.: A note on two problems in connection with graphs, Mumerische Mathematik 1, 1959, pp. 269-271
problem is very high. Special approximation methods have to compile for the construction of paths with optimal travel time in such models. Author presents a new approximation schema for optimal routes generation problem. Our method is based on transfer matrix, minimal distance matrix 2 and certain kind of label-setting algorithm 3 which is the solution of k - shortest paths problem. Before the presentation of the algorithm in sections 3 and 4, the author defines the network model in section 2. 2. Network model and problem definition A public transportation network is represented as a weighted graph G = V, E, t, where V is a set of nodes, E is a set of edges and t is a function of the weights. Each node in G corresponds to a certain transport station. We assume, for simplification, that there is only one kind of public transportation the bus, so each node corresponds to a bus-stop. We also assume that bus-stops are represented with numbers from 1 to n. The directed edge ( i j) E, is an element of the set E, if at least one bus direct connection exists between the bus-stop number i as a source point and the bus-stop number j as a destination. One directed edge corresponds to one possibility (busline) of the connection between two bus-stops. Therefore, graph G includes parallel directed edges. Each edge has a weight t ij which is equal to the travel time (in minutes) between nodes i and j which can be determined on the base of timetables. A set of edges is bi-modal because it includes, besides directed bus-links, undirected walk-links. We assume, that there exists walklink {i, j} between two bus-stops i and j, if the time which is needed to walk from bus-stop i to j is less than m minutes, where m is the user s preference. The t ij value for undirected edge {i, j} is equal to walk time between i and j bus-stops. We assume, for simplification, that a walk time is determine as an Euclidian distance between bus-stops 4. A graph representation of public transportation network is shown in Fig. 1. It is a very simple example of the network which 2 Koszelew J.: The Theoretical Framework of Optimization of Public Transport Travel, 6th International Conference on Computer Information Systems and Industrial Management Applications, IEEE-CISIM 07, Elk, Poland, eds. Khalid Saeed, Ajith Abraham, Romuald Mosdorf;[org.] Bialystok Technical University [et al.], 2007, pp. 65-70 3 WU Q., Hartley J.K.: Accommodating User Preferences in the Optimization of Public Transport Travel, International Journal of Simulation Systems, Science & Technology: Applied Modeling & Simulation, 2004, pp. 12-25. 4 Chabini I.: Discrete dynamic shortest path problem in transportation applications: Complexity and algorithms with optimal run time, Transportation Research Records, 1645, 1998, pp. 170-175.
includes only nine bus-stops. In the real world the number of nodes is equal to 1500 for the city with 250 ts. citizens. Formal definition of our problem is the following: At the input we have: G str structure of the transportation network (graph G without weights), timetables times of departures for each bus-stops and each bus-line, s source point of the travel, t destination point of the travel, t start start time of the travel, k number of the resulting paths, maxt maximum number of transfers (from bus to bus, from bus to walk and from walk to bus). At the output we want to have: Paths st set of the resulting routes, which start at s, ends at t, contains at most k quasi-optimal paths with at most maxt transfers. walk-link bus-links Fig. 1. Representation of a simple transportation network There are many algorithms for the shortest path problem in its classical version, Dijkstra s method for example. However, Dijkstra s algorithm does not allow for time-dependent links. Our method of generating optimal paths consists of three phases. First, we determine the transfer matrix Q maxt and the minimal distance matrix D for the given network structure G str. It is very important that we can construct these matrices only one time for all users queries because they are independent of t start parameter. Next, we use Q maxt matrix to generate routes with optimal number of transfers, which are probably the routes with the minimal travel time. Second matrix D is used as an heuristic in the third phase of our algorithm to generating other routes with quasioptimal travel time. Finally algorithm chooses the best routes which are generated during two first steps of the method.
3. Minimal transfer and minimal distances matrices The transfer matrix Q maxt = [q ij ] i, j=1..n is a two-dimensional matrix. The value q ij is equal to the minimal number of parts in travel on the path from i to j. The value q ij -1 is the minimal number of transfers on this path. If there is no path from i to j with at last maxt transfers, then q ij is equal to 0. For example, if s = 1 and t = 9, for the network in Fig. 1, then q 19 = 2, because there is a path from 1 to 9 with one transfer: walk-link from 1 to 8, next bus-link from 8 to 9. We can determine the transfer matrix on the base of network structure G str, using standard breath first search algorithm and the matrix T = [t ij ] i,j=1 n. The value t ij is equal to 0, when there is no direct (without transfers) route between i and j nodes, otherwise this element is equal to 1. The Q maxt matrix is determine on the base of successive powers T l (l = 1 maxt) of the matrix T. The element q ij is equal to the smallest l such that t l-1 ij = 0 and t l ij 0. The elements (i, i) of all transfer matrix is equal to 0, because we assume that s t. We also assume that we are interesting in the simple paths only (all nodes of the same path are different). The second matrix, denoted by D = [d ij ] i,j=1 n and named a minimal distance matrix, saves the minimal distance between two nodes: d ij = 0 for i = j, d ij = if there is no path from i to j and d ij is equal to the length of the shortest path from i to j, otherwise. The length of path is equal to the number of edges. We can determine the minimal distance matrix using standard breath-firstsearch algorithm. A minimal distance matrix, like transfer matrix, is determined only one time, because it is time-independent. Example 1: T, Q maxt and D matrix for the network in Fig. 1 and maxt = 3 T Q maxt D 0 1 1 0 1 0 0 1 0 0 1 1 0 1 2 2 1 2 0 1 2 3 4 2 1 2 0 0 1 0 1 0 1 1 1 2 0 1 0 1 2 1 1 1 2 0 1 1 3 1 1 2 0 0 0 0 1 0 1 0 1 3 2 0 0 1 2 1 2 1 3 2 0 1 2 1 2 2 0 0 1 0 0 0 1 0 1 3 2 1 0 2 3 1 2 1 4 3 1 0 2 3 2 3 3 0 0 0 0 0 1 0 0 0 3 3 4 0 0 1 2 2 2 4 3 4 0 1 2 2 3 0 0 0 0 1 0 1 1 1 2 2 3 0 1 0 1 1 1 3 2 3 1 0 1 2 2 0 1 0 0 0 0 0 1 1 2 1 2 0 3 2 0 1 1 2 1 2 3 4 0 1 1 1 0 0 0 0 0 0 0 1 1 2 2 0 2 3 3 0 1 1 2 3 4 5 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In practice, transfer and minimal distances matrices has a big size, but the algorithm, which calculates these matrices, runs only one time before first using of the journey planner. Therefore, the execution time of this part of algorithm has no influence on the time complexity of the main algorithm, which determines paths. 4. Generation of paths with quasi-optimal travel time The next step of the method is the generation paths with minimal number of transfers. We can determine all such paths for the given s and t points, using transfer matrix Q maxt. For example, there are three path templates (sequence of transfer nodes) for the network in Fig.1. and input parameters: s = 1, t = 9, maxt =3: 1-8-9, 1-2-9, 1-3-9. We can generate these templates on the base of Q maxt matrix. Next, we can establish detail information about numbers of lines and departure time for each transfer node in the path, on the base of templates, timetables, walk-links and t start parameter. We denote the set of all paths which we generate from path templates by Paths tr st. For the network in Fig 1. and input parameters: s = 1, t = 9, maxt = 3, the set Paths tr 19 includes the following paths: 1 8 9 (15 min. or 25 min.), 1 2 9 (25 min.), 1 3 9 (20 min) The next step of the method determines another set of paths which we denotes by Paths k st. This set includes k paths with the quasi-optimal travel time and is generated by the label-setting method of the shortest paths generation 5. In each step of this phase of the algorithm we find the closest node u, with exact to the given ε value minimal travel time from the start point s to node u. If there is more than one such node, we choose nodes with a minimal number of bus-stops to the end of travel. The label of the closest node u is increasing at that moment. Next, we add to the graph G new arcs: from s to each node w on the list of incidences of node u. The algorithm stops, when the label of the end node t is equal to k.. We have exactly k paths from s to t in Paths k st set at that moment. For the network in Fig. 1. there are two links from s to j with exact to the minimal travel time (s = 1, t = 9, k = 3, ε =5): (1, 8) and (1, 2), but we choose node 8 because d 89 <d 29 add new links. Next, we choose node 2 because et(2)=0 and t 12 is minimal (with exact to ε) and add new links. 5 Chabini I.: Discrete dynamic shortest path problem in transportation applications: Complexity and algorithms with optimal run time, Transportation Research Records, 1645, 1998, pp. 170-175.
et(1)=3 1 1 25 et(1)=3 10 5 9 5 15 25 8 15 10 et(9)=2 5 2 2 8 9 9 2 et(8)=0 et(2)=0 9 et(2)=0 et(8)=1 d 89 = 1 et(9)=2 et(2)=1 d 29 = 2 a) b) c) 1 10 3 20 10 et(3)=0 8 7 d 39 = 2 et(8)=1 et(7)=0 Fig. 2. Steps the realization of the label-setting schema (s = 1, t = 9, k = 3, ε =5, et(v) the label of v node): a) the closest node 8, b) the closest node 2, c) the closest node 7. d 79 = 1 There are two links from s to j such that et(j) and t sj is minimal (with exact to ε) now: (1, 7) and (1, 3), but we choose node 7, because d 79 < d 39. Finally, the set of paths Paths 3 19 is the following: 1 8 9 (15 min. or 25 min.), 1 2 7 9 (15 min.). Definitivly, the set of result paths Path st consists of the first k paths from the sum: Path k st Path tr st, sorted according to travel time. In our example Paths 19 set includes the following: 1 8 9 (15 min.), 1 2 7 9 (15 min.), 1 3 9 (20 min.). A minimal distance matrix is used as an approximation technique to decrease the number of possibilities of generating paths in both methods. The quality of this approximation depends on coefficient ε, because if ε is bigger than less possibilities for next nodes are checking. This important factor should be established experimentally, for the concrete transportation network. 5. Results of experimental implementation of the algorithm Author carried out many experiments on really public transport networks for ten Polish cities. These networks have different sizes (from 554 bus-stops for Bialystok to 3536 bus-stops for Warsaw) and density (number of edges from 106 916 for Bialystok to 12 503 296 edges for Warsaw). We assume that ε is equal to 5 minutes in all tests. We can formulate three general conclusions about our methods on the base of the results of these tests: For short routes (d st < 15) in dense networks (minimum 8 million of edges), the second algorithm has lower execution time (about 120 milliseconds) than first (about 2 seconds), but bigger error of approximation (10-15 minutes for the second algorithm, 7 10 minutes for first).
For longer routes (d st > 26) in weak networks (maximum 0,5 million of edges) the execution time of first algorithm is lower (about 160 milliseconds) than for second (almost 10 seconds). Both algorithms had comparable error of approximation for such kind of networks (5 8 minutes). For special routes in very dense networks (over 10 million of edges), where source and destination bus-stops were situated in peripheral regions of the city, the execution time of each algorithm is sometimes too long and is equal to 5 minutes. 6. Conclusions and future work This paper presents some of the approaches to solving of the shortest paths problem in a time-dependent scheduled transportation network with bi-modal links. Algorithms described in the paper were tested on realistic data and has a satisfactory time complexity and approximation error apart from special routes in very crowded traffic. The next step of the research will be testing the author s algorithms for different values of ε coefficient, which may have a big influence on the time complexity and quality of approximation of both algorithms. We will also work on new heuristics for our algorithms, inspired by genetic or probabilistic methods 6. These heuristics are needed to decrease time complexity of the algorithms in special cases of routes, described in this work. The aim of next investigations is to develop a new hybrid algorithm, which realizes an automatic recognition of network characteristics first and then chooses an appropriate set of heuristics. This hybrid algorithm could be used in a full functional system with a geographic interface, to help travellers to find optimal routes in many different cities. If we add data with information about trains, airplanes and long-distance bus connections to this system, then we will be able to create a global intelligent journey planner 7. 6 Chen H.K., Feng G.: Heuristics for the dynamic user-optimal route choice problem, European Journal of Operational Research, 126, 2000, pp. 13-30. 7 Elkins P.J.: Service management systems for public transport the German approach, Proceedings of the IEE Colloquium on Vehicle Location and Fleet Management Systems, 1993, pp. 401-410.
Acknowledgement This paper was supported by the Rector of Bialystok Technical University (grant no. W/WI/10/08) References 1. Chabini I.: Discrete dynamic shortest path problem in transportation applications: Complexity and algorithms with optimal run time, Transportation Research Records, 1645, 1998, pages 170-175. 2. Chen H.K., Feng G.: Heuristics for the dynamic user-optimal route choice problem, European Journal of Operational Research, 126, 2000, pages 13-30. 3. Dijkstra E.: A note on two problems in connection with graphs, Mumerische Mathematik, 1, 1959, pages 269-271 4. Dreyfus S.E.: An Appraisal of Some Shortest-path Algorithms, Operations Research, 17, 1969, pages 395-412. 5. Elkins P.J.: Service management systems for public transport the German approach, Proceedings of the IEE Colloquium on Vehicle Location and Fleet Management Systems, 1993, pages 401-410. 6. Jing N., Huang Y.W., Rundensteiner E.A.: Hierarchical encoded path views for path query processing: An optimal model and its performance evaluation, IEEE Transaction on Knowledge and Data Engineering, 10(3), 1998, pages 409-432 7. Koszelew J.: The Theoretical Framework of Optimization of Public Transport Travel, 6th International Conference on Computer Information Systems and Industrial Management Applications, IEEE-CISIM 07, Elk, Poland, eds. Khalid Saeed, Ajith Abraham, Romuald Mosdorf;[org.] Bialystok Technical University [et al.], 2007, pages 65-70 8. Wellman M. P., Ford M., Larson K.: Path planning under time-dependent uncertainty, Proceedings of the Eleventh Conference on Uncertainty in Artificial Intelligence, 1995, pages 532 539. 9. WU Q., Hartley J.K.: Accommodating User Preferences in the Optimization of Public Transport Travel, International Journal of Simulation Systems, Science & Technology: Applied Modeling & Simulation, 2004, pages 12-25.