Bangkok Bus Route Planning API

Bangkok Bus Route Planning API

Available online at www.sciencedirect.com ScienceDirect Procedia Computer Science 86 (2016) 441 – 444 2016 International Electrical Engineering Cong...

267KB Sizes 20 Downloads 149 Views

Available online at www.sciencedirect.com

ScienceDirect Procedia Computer Science 86 (2016) 441 – 444

2016 International Electrical Engineering Congress, iEECON2016, 2-4 March 2016, Chiang Mai, Thailand

Bangkok Bus Route Planning API Nuengwong Tuaycharoen*, Adisorn Sakcharoen and Wuttiporn Cha-aim Department of Computer Engineering, Faculty of Engineering, Dhurakij Pundit University, 110/1-4 Prachachuen Rd., Laksi, Bangkok, Thailand 10210

Abstract Almost a million people commute by buses every day in Bangkok Metropolitan Area. However, many applications informing the bus transit system have many limitations, especially the route planning solution supporting bus transits and walking. This article introduces a route planning API for Bangkok Mass Transit networks. The API includes the BMTA bus database and a shortest path algorithm with bus transits and walking consideration. The experimental results show that the API takes only a few MB of memory and under 0.025s of processing time for 10,000 nodes. Including in an Android application, our application’s response times are under 4 seconds, which is acceptable for user experience, and performs as much as 3.62 times better than official Android application from BMTA. © 2016 2016 The TheAuthors. Authors.Published Published Elsevier by by Elsevier B.V.B.V. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/). Peer-review under responsibility of the Organizing Committee of iEECON2016. Peer-review under responsibility of the Organizing Committee of iEECON2016 Keywords: shortest paths, route planning, public transportation;

1. Introduction Every day, almost a million people use bus services of Bangkok Mass Transit Authority (BMTA). However, this number is declining due to inconvenience of the service. One of the reason is the bus transit information is inconvenient to obtained. Even though, many applications have been developed, including web-based and mobilebased applications, many of them lack of some important features. The lacking features include latest bus route information, accurate source and destination pinpoints, and route planning solution with bus transfers within walking distance. As a result, the users unsatisfying with those applications cause avoidance to use public

* Corresponding author. Tel.: (+66)02-954-7300; fax: (+66)02-954-8640. E-mail address: [email protected]

1877-0509 © 2016 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/). Peer-review under responsibility of the Organizing Committee of iEECON2016 doi:10.1016/j.procs.2016.05.075

442

Nuengwong Tuaycharoen et al. / Procedia Computer Science 86 (2016) 441 – 444

transportation. One way to offer users with better experience is to provide the application developers with an API with a full feature of route planning. This will allow the developers to concentrate on better user experience and lead to more users taking public transportation. Therefore, this article introduces an API to provide an optimal route planning solution for BMTA bus networks in Bangkok and allow any applications to call for. The API includes a database of bus routes, provided by SmartVC, a company with official BMTA transit information concession, and a bus route planning algorithm providing an optimal bus route for specified source and destination. 2. Related Works Route Planning is a problem that solves for an optimal route to travel from two geological locations. This problem can be solved by Dijkstra's algorithm1. However, solving route planning problem in public transportation networks is different from solving in road networks2. Unlike in road networks, not only travel times in public transportation networks but also number of transfers and costs should be considered. Since road networks expand over a large region, modern algorithms3,4,5,6,7 try to solve the problem with large-scale inputs with two stages: (1) an offline preprocessing and (2) a query in real time. For public transportation networks, many works focus on graph theory, in particular the time-expanded and the time-dependent approaches8,9,10. In spite of graph, RAPTOR11 introduces pruning and parallelizing with multiple cores. Web-based applications informing BMTA bus information include Siamtraffic.net and BMTA12,13, which have no map to identify the user’s current location. With maps, Google Transit is another popular web-based application. On the other hand, the mobile-based applications include Bangkok Buses, RoadMay, SaiRoadMay, JodPaina, Roddoysarn and BMTA14. They have limited solutions with minimum bus transfer and walking. Therefore, our API can fulfill with a better route planning solution for these applications. 3. The Route Planning API Our Route Planning API includes the following components: 3.1 The Database and the Shortest Path Algorithm Our API creates a directed graph using the busgraph entity in our MySQL database, and calls a Dijkstra's algorithm from OrientDB PHP Library15. Our graph is created with a bus station as a vertex and a bus travelling from one station to another station as an edge with the distance as the edge’s weight. Because there are only around 4,000 stations in BMTA system, a simple Dijkstra’s algorithm is fast enough for the problem. The Dijkstra method is called with the source and destination vertices as the method’s parameters, which are specified by the users. 3.2 The Walking Edge One of the key features in our application is suggesting walking as a part of the solution if walking is a better alternative, comparing with taking a bus. For example, in the case where the destination is on the opposite side of the road, instead of taking a bus going around to the opposite side, our application will suggest walking across the road. This can be possible by adding walking edges into our database. A walking edge represents a connection of two stations with less than 500m of distance. The edge will be added with a distance of 4x the actual distance to represent that walking is approximately four times slower than bus travelling time in Bangkok16. 3.3 The Bus Route Solution The Dijkstra algorithm returns a solution in terms of a list of bus stations. However, our solution requires a list of bus route names for user’s trip. Therefore, after receiving a result from the Dijkstra’s algorithm, our application must specify the bus route names in the solution with the lowest number of bus transfers. Additionally, the user must

Nuengwong Tuaycharoen et al. / Procedia Computer Science 86 (2016) 441 – 444

be able to choose any buses, which run on the same route. Our bus route algorithm process as described below: 1. At the source bus station, collect all bus route names passing this station into an array, buses. Then, move to the next bus station on the Dijkstra’s shortest path solution. 2. At any bus station on the result list, compare the bus route names passing that station with the buses array. If a bus route in the buses array does not pass that bus station, delete that bus route names from the buses array. As a result, the bus route names in the buses array are the bus routes that the user can take to commute between this bus station and the previous station. 3. If no bus route is left in the buses array, this means either the user must change to a new bus route or she must walk from the previous station to this station. Therefore, the buses array will be set to all bus route names in the previous bus station, which can include walking as one option. 4. Move to the next station on the shortest path solution and repeat item 2-3 until get to the destination bus station. 5. Output the buses array as the list of buses that the user can take from the source station to the destination station. The output will be in JSON format. 4. The Experimental Results We developed an Android application, called YAK, to test our API. We installed our API service in a web server. The application UIs are shown in Fig.1. The user can specify the source and the destination by choosing a bus station marker on the map around places specified in the textboxes. This can be done with Google Map and Google Place API17. Then, YAK will search for a shortest bus route and display the solution on the map. As shown in Fig.1(c), the route also includes walking and bus transfers.

(a)

(b)

(c)

Fig. 1. (a) YAK searching UI; (b) YAK’s search result, and (c) YAK’s result including walking and bus transfer.

Fig. 2. Memory Usage.

Fig.3. Processing Time

443

444

Nuengwong Tuaycharoen et al. / Procedia Computer Science 86 (2016) 441 – 444 Table 1. YAK and BMTA apps Response time in seconds. 9.30-11.30am #stops in solution

3-5pm

8.30-11pm

YAK

BMTA14

YAK

BMTA14

10

0.912

3.446

1.220

3.10

3.125

5.400

15

0.945

3.600

1.267

3.70

3.569

6.250

20

1.123

4.100

1.458

3.85

3.498

6.320

30

1.145

4.000

1.461

3.97

4.652

6.100

40

1.230

4.120

1.784

4.40

3.681

6.300

YAK

BMTA14

For the API efficiency, we conduct an experiment to measure the processing time and the memory usage on the server. The experimental results show in Fig.2-3. The results show that the API takes only a few MB of memory and under 0.025s of processing time, even though there are 10,000 nodes in the networks. Table 1 also shows the response time of YAK and official BMTA’s Android Application14. In the morning with low internet traffic, YAK performs 3.62 times on average better than BMTA, but the performance gap is closer when there is more internet traffic during other time of the day. Additionally, YAK’s response times mostly fall under 4 seconds, which are acceptable for user experience18. 5. Summary We have developed an API for bus route planning for BMTA transit networks. We also developed an Android application, YAK, to test our API performance. The experimental results show that our API takes only a few MB of memory and spends less than 0.025 seconds in processing time with 10,000 nodes. YAK’s response time is also under acceptable period of time and up to 3.62 times on average shorter than BMTA’s official Android application. Acknowledgements We would like to express our appreciation to SmartVC/YAK for its generous contribution for our bus data and the Android application user interface. References 1. E. W. Dijkstra,Numer. Math.1, 269 (1959). 2. H. Bast, et. al. Route Planning inTransportation Networks. Technical Report 3. I. Abraham, et. al. A Hub-Based Labeling Algorithm for ShortestPaths on Road Networks. In P. M. Pardalos and S. Rebennack, editors, Experimental Algorithms (SEA),vol. 6630 of LNCS, p230–241. Springer, 2011. 4. R. Geisberger, et. al. Exact Routing in Large Road Networks Using Contraction Hierarchies. Transportation Science, 46(3):388–404, 2012. 5. A. V. Goldberg, et. al. Reach for A*: Shortest Path Algorithms with Preprocessing.In C. Demetrescu, A. V. Goldberg, and D. S. Johnson, editors, The Shortest Path Problem: Ninth DIMACS Implementation Challenge, volume 74 of DIMACS Book, pages 93–139. AMS, 2009. 6. M. Hilger, et. al. Fast Point-to-Point Shortest Path Computations with Arc-Flags. In C. Demetrescu, A. V. Goldberg, and D. S. Johnson, editors, The Shortest Path Problem: Ninth DIMACS Implementation Challenge, volume 74 of DIMACS Book, pages 41–72. AMS, 2009. 7. H. Bast, et. al. Fast Routing in Road Networks with Transit Nodes.Science, 316(5824):566, 2007. 8. E. Pyrga, et. al. Efficient Models for Timetable Information in Public Transportation Systems. ACM J Exp Algor., 2007. 9. Delling, D., et. al. Parallel computation of best connections in public transportation networks. ACM J. Exp. Algor. 17, 4, Article 4.4, 2012. 10. Pyrga, E., et. al. 2007. Efficient models for timetable information in public transportation systems. ACM J. Exp. Algor. 12, Article 2.4 (2007). 11. D. Delling, et. al. Round-Based Public Transit Routing. In Algorithm Engineering and Experiments (ALENEX), pages 130–140. SIAM, 2012.12. SiamTraffic.NET [online]. available : http://www.siamtraffic.net (last accessed : June 5, 2015). 13. Bangkok Mass Transit Authority. Bus Lines [online]. available: http://www.bmta.co.th/?q=th/bus-lines. (last accessed : June 5, 2015). 14. Google Play Store [online]. Available: https://play.google.com/store. (last accessed : Dec 5, 2015). 15. OrientDB[online]. Available: https://github.com/doctrine/orientdb-odm. (last accessed : June 5, 2015). 16. Daily News (2012)[online]. Available: http://www.dailynews.co.th/Content/ regional/140023. (last accessed: March 1st,2013). 17. Google APIs for Android [online]. Available: https://developers.google.com/android/. (last accessed : June 5, 2015). 18. Kissmetrics,“How loading time affects your bottom line”. http://goo.gl/kosva