Applying Path Planning Algorithms to Train Schedules

Applying Path Planning Algorithms to Train Schedules

Applying Path Planning Algorithms to Train Schedules Tim Soethout 3117901 Universiteit Utrecht February 1, 2012 < Shl, −2, a, 12 : 44 > < Shl, −2, d, 12 : 43 > 0 0 < Shl, −2, d, 12 : 44 > < Shl, −2, d, 12 : 42 >0 8 <0 Shl, 3545, d, 12 : 44 > 8 < Shl, −2, a, 12 : 34 > < Asdz, 3545, a, 12 : 52 > 1 < Shl, −2, a, 12 : 33 > 1 < Asdz, 3545, d, 12 : 53 > 0 5 < Shl, −2, a, 12 : 32 > < Asb, 3545, a, 12 : 58 > 5 1 < Shl, 2649, a, 12 : 27 > < Asb, 3545, d, 12 : 59 > 6 < Asdl, 2649, d, 12 : 21 > 17 < Ut, 3545, a, 13 : 16 > 0 < Asdl, 2649, a, 12 : 21 > 1 0 < Ass, −2, a, 12 : 36 > 1 4 0 1 < Ass, −2, a, 12 : 37 > < Ass, −2, d, 12 : 35 > 0 3 3 0 < Ut, −4, a, 14 : 00 > 5 < Ass, 2649, d, 12 : 17 > < Ass, −2, a, 12 : 323 > 5 5 < Ass, −2, d, 12 : 43 > 0 1 1 1 000 0 0 0 0 0 0 0 0 < Ass, 3045, d, 12 : 43 > 1 < Ass, −2, d, 12 : 31 > < Ass, 2649, a, 12 : 16 > 5 1 < Ut, 3045, a, 13 : 19 > 6 6 6 1 1 19 < Ass, −2, a, 12 : 20 > 51 < Ass, − , a, > < Asd, 3045, a, 12 : 49 > 5 1 2 12 : 21 < Ass, −2, a, 12 : 29 > 19 19 19 5 3 33 19 < Ass, 2249, a, 12 : 15 > 5 5 5 3 1 19 19 3 3 19 19 < Ass, −2, a, 12 : 24 > 3 1 1 1 1 1 7 5 5 < Asd, 2649, d, 12 : 11 > 1 1 < Ass, −2, d, 12 : 25 > 2 < Asa, 3045, d, 13 : 00 > 1 1 1 7 < Asd, 3045, d, 12 : 52 > < Asd, 2249, d, 12 : 10 > 1 2 22 1 0 5 7 77 0 5 2 < Ass, −2, d, 12 : 28 > 1 < Asa, 3045, a, 12 : 59 > < Ass, 3034, a, 12 : 19 > 7 2 0 0 1 0 1 0 0 0 00 00 1 < Asd, −2, d, 12 : 10 > 11 1 1 1 7 0 0 11 1 < Asd, − , d, > 0 2 12 : 11 < Asa, −2, d, 13 : 00 > < Asd, −2, d, 12 : 52 > 1 0 1 1 < Ass, 845, d, 12 : 28 > 1 0 < Asd, −2, a, 12 : 09 > 11 6 0 1 1 1 7 6 0 < Asd, −2, a, 12 : 08 > 0 1 1 11 1 66 < Asd, −2, d, 12 : 07 > 1 1 0 < Asd,1 3034, d, 12 : 12 > 6 11 11 6 00 00 6 6 6 6 6 0 0 1 < Asd, 845, a, 12 : 34 > < Asd, −2, a, 12 : 06 > 0 0 1 5 5 11 5 0 < Asa, −2, a, 12 : 49 > 6 0 < Asd, −2, d, 120 : 12 >0 < Asd, −3, d, 12 : 00 > 0 6 < Asa, −2, a, 12 : 49 > < Asd, −2, a, 12 : 46 > 2 < Asd, −2, a, 12 : 39 > 1 6 2 1 1 2 < Asa, −2, d, 12 : 45 > 3 1 < Asd, −2, d, 12 : 40 > 0 0 00 1 1 0 1 1 5 < Asd, −2, a, 12 : 14 > 0 8 < Asd, −2, d, 12 : 41 > < Asd, −2, d, 12 : 45 > < Asa, −2, d, 12 : 45 > 1 0 2 0 0 0 8 8 < Asa, 845, a, 12 : 44 > 8 1 2 < Asd, −2, a, 12 : 44 > 1 1 < Asd, −2, d, 12 : 22 > 0 2 < Asa, −2, a, 12 : 36 > < Asd, −2, d, 12 : 42 > < Asd, −2, a, 12 : 38 > 2 < Asd, 3043, d, 12 : 22 > 7 7 2 5 < Asa, −2, a, 12 : 341> < Asd, 845, d, 12 : 37 > 2 < Asa, 3043, a, 12 : 29 > 1 < Asd, −2, d, 12 : 370> < Asd, −2, a, 12 : 24 > 0 0 0 0 < Asd, −2, a, 12 : 36 > < Asd, −2, d, 12 : 25 > 0 2 2 0 < Asd, −2, d, 12 : 34 > < Asd, −2, a, 12 : 25 > 4 1 4 1 < Asd, −2, d, 12 : 29 > < Asd, −2, a, 12 : 27 > 0 0 0 < Asd, −2, a, 12 :1 27 > 1 < Asd, −2, d, 12 : 27 > 0 Bachelor’s thesis Cognitive Artificial Intelligence (15 ECTS) Supervisor: dhr. prof. dr. Vincent van Oostrom Contents 1 Introduction 3 2 Representation 3 2.1 Formal...............................................3 2.1.1 Basic vertices and edges.................................3 2.1.2 Costs...........................................4 2.1.3 Station Lines.......................................5 2.1.4 Departure and Arrival vertices.............................6 2.1.5 Possible extensions....................................7 2.2 Correct/usable?.........................................7 2.2.1 Pruning..........................................7 3 Shortest Path Problem7 3.1 Introduction............................................7 3.2 Algorithms............................................7 3.2.1 Dijkstra’s Algorithm...................................7 3.2.2 Bellman-Ford.......................................8 3.2.3 k Shortest Paths.....................................9 4 Implementation 12 4.1 General.............................................. 12 4.2 Representation.......................................... 14 4.2.1 Data Set.......................................... 14 4.2.2 Implementation...................................... 15 4.2.3 Time Complexity..................................... 17 4.2.4 Performance....................................... 17 4.3 Algorithms............................................ 17 4.3.1 Dijkstra’s Algorithm................................... 17 4.3.2 Bellman-Ford....................................... 19 4.3.3 k Shortest Paths..................................... 19 4.4 Visualisation........................................... 20 4.5 Performance............................................ 20 5 Conclusion 22 6 Future Work 23 6.1 Graph Representation...................................... 23 6.2 Algorithm............................................. 23 A Source files 25 A.1 Station Abbreviations source file................................ 25 A.2 Made up time table source file................................. 28 2 1 Introduction This bachelor’s thesis for Cognitive Artificial Intelligence began with an idea to do something with trains. Of course it had something to do with one or more of the foundations of the study of cognitive artificial intelligence. It soon became clear the emphasis would be on logic and computer science. This rather broad subject had soon to become more defined than this vague notion of combining trains, logic and computers. There are many possibilities spreading from an artificial intelligence for building the perfect train transportation systems in game like environments like the classic computer game Transport Tycoon to giving the best travel advice to a person to get from A to B or generating a train time schedule from scratch. As every enthusiastic student I set out to do as much as possible, but quickly limited my view to the shortest path problem. This is the problem of getting from A to B in the cheapest way. It soon became clear that to tackle this problem much more comes to the surface than simply running a shortest path algorithm such as the well known Dijkstra’s algorithm. The first step is to figure out a way to represent the train time table into a graph model on which the algorithms can be run. It all began with a very simple representation and all seemed trivial at first, but a lot more had to be done to really grasp all the features of the train time table. Also extensibility and generality had to be kept in mind. The second step was to study some algorithms to generate the correct travel advise. This could be done with shortest path algorithms. The obvious Dijkstra’s algorithm is of course described. But more interesting was the k shortest path algorithm. Especially for its relevance for this application to give alternative travel advise. The main focus lies on Eppstein’s version of the k shortest path algorithm. This thesis is divided in three main parts. The first part is the logic, theoretic part of the representation of the time table graph and can be found in section2. The second part is a study into the shortest path problem and the different shortest path algorithm and is found in section3. The third and biggest part is the implementation of the representation and the shortest path algorithms and found in section4. The accompanying source code of the implementation is attached. Before I start off with the content I would like to thank the following people for their support: Vincent van Oostrom for supervising me for this extended period of time, Jochem Bongaerts for constantly being available for discussions to re-order my mind on the subject and many more people for constantly reminding me to finish my bachelors thesis already. It is here at last. 2 Representation 2.1 Formal 2.1.1 Basic vertices and edges We represent a time table of a train as a graph over which the algorithms can generate their response. We start by defining a directed graph G containing vertices (V ) and edges (E). G = hV, Ei1 Each vertex is a set with the following properties: V = hS, R, K, T i + Where S is a station, R ∈ R ∪ {aa, ad, st} where the numbers denote a route number or the arrival (aa) or departure (ad) vertex for an algorithm or station line (st), K ∈ {d, a} indicates a departure or an arrival and T is the corresponding time. S is denoted with an abbreviation for a specific station, mapping can be found in the Appendix on page 25. A vertex can be seen on figure1. Transitions (edges) are of form: E = hV, W, V i The first V is the source vertex and the second V the target vertex. W ∈ {t, w} describes whether the transit is a real transfer or a wait in a train, this is important for the number of hops. In most cases W will be w, only when a transfer from station line into a train is done t will be used. This will become clear in section 2.1.3. An edge can be seen on figure2. Note that the ∆T is also displayed in the pictures 1The structure of the graph is inspired on the graphs used to create the dutch railways timetables[Sch08]. 3 Asd, 1, d, 13.30 Asd, 1, d, 13.30 Asd, 1, a, 13.30 Figure 1: Vertex represent- t, 20m w, 10m ing Amsterdam central station, route number 1 and departure at 13.30h.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    28 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us