Train Schedule, Where to stop?

Raul Pires

Introduction .......................................................................................................................................... 3 1.1.

2.

Problem reformulation ......................................................................................................................... 4 2.1.

3.

Overview of existing network and operation ............................................................................... 3

Assumptions and simplifications .................................................................................................. 5

Mathematical formulation .................................................................................................................... 6 3.1.

Variables and Parameters ............................................................................................................. 6

3.1.1.

Decision Variables ................................................................................................................. 7

3.2.

Objective Function ........................................................................................................................ 7

3.3.

Constrains (Subject to) .................................................................................................................. 8

3.3.1.

Actualizing the O/D matrix for each period .......................................................................... 8

3.3.2. The total number of passengers to be carried must be equal to the total of passengers that come to the stations...................................................................................................................... 9 3.3.3.

4.

3.4.

Degree of difficulty of this problem ............................................................................................ 10

3.5.

Implementing the mathematical formulation .................................................................................... 11 4.1.

Software choice........................................................................................................................... 11

4.2.

Excel Solver ................................................................................................................................. 12

4.2.1. 4.3.

5.

6.

The train cannot carry more than a given number of passengers (capacity limits) ........... 10

Representation.................................................................................................................... 12

Solutions and optimizations........................................................................................................ 15

4.3.1.

Unsuccessful runs ............................................................................................................... 15

4.3.2.

Solutions found ................................................................................................................... 15

4.3.3.

Random generation of O/D matrixes for every period ....................................................... 20

Questions that require further study .................................................................................................. 23 5.1.

Logistical and operational questions .......................................................................................... 23

5.2.

Passengers waiting and travel times ........................................................................................... 25

5.3.

Variable Frequencies for the Trains ............................................................................................ 25

5.4.

Using Genetic Algorithms............................................................................................................ 25

Conclusion ........................................................................................................................................... 26

2

1. Introduction ntroduction The base idea for our project came from the fact that the trains that run on the Sintra Urban Railway Line (Figure Figure 1) still take around 45 minutes to get from Sintra to Lisbon, more specifically to the Entrecampos station. Our initial goal was bold, we wanted to devise a schedule that would reduce the travel time between those stations in the peak hour and still satisfy the existing demand for that period by reducing the number of stops. stops

Figure 1 - Sintra railway line

1.1. Overview of existing network and operation1 This railway line is used every day by thousands of people to commute between their homes and Lisbon, where most of the jobs are located. The line is currently divided in two sets of trips made by trains, trains, where a set runs between tween MiraMira Sintra/Meleças /Meleças and Alverca and the other set runs between Sintra and Lisbon. There are no exceptions to this rule during peak hours at least. This means that currently, a person living in the stations of Sintra, Sintra, Portela, Algueirão, Mercês and Rio de Mouro that wants to go to Sete Rios or Entrecampos has has to exchange trains in one of the stations between (inclusive) Cacém and Benfica. It is also guaranteed that in peak hours, every 1

For our initial analysis we only consider the stations until Entrecampos

3

train that goes to Rossio is followed, with a waiting period around 3 minutes, by a train that goes to Alverca in every station between CacĂŠm and Benfica. Every train stops in every station and the train frequency is always 10 minutes, independently of the destination of the train. Just to give an overview of travel times, a train takes 40 minutes between Sintra and Rossio and 32 minutes from Mira Sintra to Roma but a person leaving from Sintra takes about 45 minutes to get to Roma. The infrastructure in place, i.e., number of lines, is represented in Figure 1.

Figure 2 - Sintra railway line infrastructure

2. Problem reformulation After a first analysis to the original problem we wanted to address and after the suggestions made by the professors, we decided to simplify the problem so that it would be feasible to formulate it mathematically and also so that we could, by using an optimization tool, test different optimizations and arrive at a set of solutions we could compare and analyze. From this base we could have a starting point for future enhancements.

4

2.1.Assumptions and simplifications

The problem was simplified by assuming the following conditions: •

Trains headed in the direction from Sintra to Lisbon.

There would only be one line where trains circulated.

Trains can overtake others at any point in the line with no physical constraints

Only one hour of peak, from 8am to 9am

Only 6 stations - for this assumption we considered that a train would circulate between Sintra and Queluz/Belas and would stop in every station, picking up every passenger in all those stations and drop them in Queluz/Belas. So for our problem the optimization of time would be between Queluz/Belas and Sete Rios.

O/D matrix somehow similar to reality

Time travel between stations and time of stops in stations is fixed

No constraints in end station, which means no “parking” problems for the trains that end in a station.

Our initial problem was reformulated and consisted now in the following scheme:

1

2

3

4

5

6

Where station 1 is Queluz/Belas and station 6 is Sete Rios. Our efforts were now devoted to answer the following problem: In the peak hour between 8am to 9am, with a periodic generation of an O/D matrix, which stations should the trains stop in order to transport all passengers to their destination stations in the shortest time possible with a limited capacity (number of passengers per train) for the trains.

5

3. Mathematical formulation 3.1.Variables and Parameters To solve our problem we will use the fallowing variables, parameters and notation: • •

a = 1…n – number of periods in an hour in which new passengers come to the station; b = 1…n – number of trains that in that 1 hour period that carry passengers in this line;

In the problem we implemented we assumed that a=b, and that a=b=12, which is the same as saying each 5 minutes a new train starts its journey, and each 5 minutes new passengers came to the station. • •

i=1…6 - Stations were passengers are originated (origins); j=1…6 - Stations were passengers are going (destinations);

Every station is both origin and destination, except the first (1) that is only origin, and the final station (6) that is only destination. •

Pija = 0…n – Number of passengers that are in station i and want to go to station j in period a (if we assume a=b), if a≠b, then we will use Pijb. These are the passengers that are in station i and need to be carried. P´ija = 0…n – Number of passengers that arrive in station i and want to go to station j in period a (the notation is the same in both situations). This are the passengers that are generated in each period a in station i.

Bellow we present the O/D Matrix we used as generation, each cell is equivalent to a P´ija in the a=1 period, Pija = P´ija

O/D

Origins –i

1 2 3 4 5 6

1 0 0 0 0 0 0

Destinations - J 2 3 200 200 0 50 0 0 0 0 0 0 0 0

4 200 50 40 0 0 0

5 400 100 80 140 0 0

6 1000 300 280 560 300 0

Xja = 1 or 0, it´s a binary variable and assumes value 1 if the train stops in the j destination in the a period, and 0 otherwise. If a≠b we will use Xjb ;

Xia = 1 or 0, it´s a binary variable and assumes value 1 if the train stops in the i origin in the a period, and 0 otherwise. If a≠b we will use Xib ; 6

Xja = Xia , because station of origin i is also a destination j (even with first and last, the difference is in the O/D matrix so no users will use 6 as an origin and station 1 as a destination);

K = [ 1, 2, 3, 4, 5, 6 ], it´s an auxiliary parameter(it´s an array) to help calculate the time spent between stations in travel for each different train (in the situation that they don´t leave from the first or arrive at the last station);

Pxa

=

1..n – It´s the number of passengers each train carries when leaving station x in

period a. . If a≠b we will use Pxb; •

αia = 0…1, it´s a real number from 0 to 1, we didn´t use it in the model we implemented, but it allows that in station i not all passengers that go to different j´s get all in (if we have a capacity constrain in the train). If a≠b we will use αib;

c=2 – It´s the fixed time a trains spends in every stop (we could also vary this according to each station, but to simplify the problem we assume it´s always the same);

d=3 – It´s the fixed time a trains spends from one station to the immediately next (we could also vary this, but to simplify the problem we assume it´s always the same);

Q = n – It´s the capacity that each train as (maximum number of passengers it can carry).

3.1.1. Decision Variables

In the problem we want to solve Xja is our decision variable (it could also be Xia , since they are equal, one is like a clone of the other), it will be an array of 6 values (0 or 1) for each a period. So if we have 12 periods, it will be a matrix with 6 columns and 12 lines (72 values in total). This answers the question, for each trip in what station will the train stop? And it can start or end in any station. If we are addressing the capacity issue then our decision variable will be Q.

3.2.Objective Function

Our objective is to carry all passengers in an hour in the minimum time as possible so to optimize the stops that each train makes in each trip, so our objective function will be:

7





   2              





This is when we have a=b=12 (if aâ&#x2030; b we would simply substitute in the formula a by b). The formula for each period a adds all the stations where the train stops (less two, that is the first and last) and multiplies it by the time the train spends in each stop (itÂ´s always the same, c). Also for each period a we multiply the array (solution vector) Xja and the array K, we get an array with six new numbers, and we take the maximum and the minimum, subtract it (this way we get the number of â&#x20AC;&#x153;arcsâ&#x20AC;? the train went threw) and multiply by d the time the trains spends between each station. For example we if we get the following Xja = [0, 1, 0, 0, 0, 1] our result would be (Remember, K = [ 1, 2, 3, 4, 5, 6 ]):

Xja Ă&#x2014; K = [ 0, 2, 0, 0, 0, 6] => Max-Min = 6-2 = 4 Ă&#x2014; 3 = 12, 12 minutes spent in travel. â&#x2C6;&#x2018;  2   => (2-2)Ă&#x2014;2 = 0, 0 minutes spent in stops.

Now, we will add the Total time=Travel time + Stops Time for each period, and get the total time for that a given array (6Ă&#x2014;12) Xja. And the best solution is the Xja that minimizes the total time.

3.3.Constrains (Subject to) 3.3.1. Actualizing the O/D matrix for each period

For each a (or b if aâ&#x2030; b) we will have the passengers waiting in station i that want to go to station j, this will be equal to the passengers that are generated (that come to the station i) in the interval of time between the last train as come to that station, plus the passengers that were not carried in the previous period a-1 by the train. This is the expression when a=b:

Â´   " #\$  " #\$   " #\$   " #\$

The first term is the passengers that were generated in this period, the rest is the passengers that were not carried in the previous period the train made a trip. 8

This would be the expression if aâ&#x2030; b:

Â´& ' " ( \$)(%%

%



&*" ( \$+(%"%#\$

Â´   "%#\$  "%#\$   "%#\$   "%#\$

The difference is that in this last situation the number of passengers that come to i are all that were generated between period b when the train passes and the previous train b-1. Fb and Fa stands for the frequencies of the trains and passengers generation (so for 12 trains in an hour Fb=5 minutes, and for 6 generations Fa=10 minutes).

3.3.2. The total number of passengers to be carried must be equal to the total of passengers that come to the stations

So, the total passengers to be carried in trains between stations must be equal to the total number of passengers originated. The total number of passengers originated will be the sum of all the cells in the O/D matrix (if each period the number of passengers originated is the same, that was an assumption we made) times a. For a=b=12, we get this expression: 





   P-./ x-/ x./ / - .







   PÂ´-./ / - .

Were the first sum is the total number of passengers carried and the second is the total number of passengers generated. For aâ&#x2030; b, with nb being a variable number of trains making the trip in one hour and na being a variable number of periods in an hour were passengers are generated we will get: 21





   P-.1 x-1 x.1

1 - .

2/





   PÂ´-./ / - .

9

3.3.3. The train cannot carry more than a given number of passengers (capacity limits)

So when we have a=b=12, the passengers the train carries when leaving a station x must be less then Q (the given capacity), we used this expression: '

3



3# 3

  P-./ x-/ x./   P-./ x-/ x./ 4 5 - .

- .

For aâ&#x2030; b we would just substitute a by b. We should say that all this variables and parameters have to be positive.

3.4.Degree of difficulty of this problem This is a very hard problem for a=b=12, and with 6 stations (the problem we implemented) we will have 72 binary variables (6 positions Ă&#x2014; 12 periods), so we will have 272 = 4,72237Ă&#x2014;1021 possible solutions, the number of feasible solutions will be less since we have some restrictions, but those restrictions also add complexity to the problem since they enter with the time dimension and for each trip the train makes is related with ones he made before, so there are many possible solutions and great interdependency between all the decision variables to choose. If we tried to have b also as a free variable, the degree of complexity would increase greatly, and as you will see even solving the problem for a=b=12 is already a challenge for the software and hardware at our disposal.

3.5.Addressing Capacity We already used capacity as a constrain, we could also make it our objective function. For this we would fix a maximum amount of total time for the trains to spend in an hour, and try to minimize the capacity. We should add here the issue that if a train as a limited capacity available it might not be able to carry all Pija that are in station i and want to go to j, even if he stops in i and j, that is Xia=Xja=1, but he may be able to carry ÎąiaĂ&#x2014;XiaĂ&#x2014;Pija. So we would get (For a=b=12):

10

Min (Q), s.t., â&#x20AC;˘

 â&#x2C6;&#x2018; / 6â&#x2C6;&#x2018;.x ./ 2  c  Max x ./  K Min x./  K   d> 4 ?,

with

T

being a fixed given time;

â&#x20AC;˘ â&#x20AC;˘

P-./

PÂ´-./  P-."/#\$ x ."/#\$  x -"/#\$  Îą -"/#\$  P-."/#\$ , actualize the matrix;

  â&#x2C6;&#x2018; / â&#x2C6;&#x2018;- â&#x2C6;&#x2018;. P-./ x -/ x ./ Îą -/

carried;

â&#x20AC;˘

P3/

  â&#x2C6;&#x2018; / â&#x2C6;&#x2018;- â&#x2C6;&#x2018;. PÂ´-./ , all passengers generated are

3 â&#x2C6;&#x2018;3- â&#x2C6;&#x2018;. P-./ x-/ x./ Îą -/ â&#x2C6;&#x2018;3# - â&#x2C6;&#x2018;. P-./ x -/ x ./ 4 5, Passengers carried by the train

must not exceed Q.

We could use Îąia in the previous formulation, in order to minimize the total travel time, but the problem was very hard as it was and if we added this additional option it would be even more complex.

4. Implementing the mathematical formulation From our mathematical formulation we had the base that allowed us to experiment and implement solutions.

4.1.Software choice Our initial approach consisted in creating an Excel spreadsheet with a very simple case that tried to maximize the number of passengers carried in the smallest time possible with a fixed capacity for that single train, given an O/D matrix for the 6 stations. This small exercise gave us some insight on how to implement the mathematical model in Excel and what kind of problems we could try to search for a solution. The biggest challenge we faced while trying to implement the model was how to represent the constant update of the O/D matrix after every train left the station. We wanted to implement this time dimension where we had an O/D matrix that was constant in every period, i.e., if a train 11

left a station with all the passengers of that station on board then for the next train we would have the same O/D matrix to carry. But in case some passengers were not carried, then they would be summed to that O/D matrix which meant that the O/D matrix was dynamically changing in every period and thus adding a greater complexity to the problem. We tried to implement the model in Xpress software since it is more reliable and effective but we could not solve the problem of the time dimension to update the O/D matrix in every period. We were stuck with this difficulty for some time and after some tries we decided to stop trying and moved to Excel since we had already had a small successful test in Excel, so we decided to use it as our optimization tool.

4.2. Excel Solver As said before, we wanted to find a set of solutions for the peak hour period. We decided to adopt the following assumptions for the problem: • • • •

Fixed set of 12 periods for peak hour This meant that a new train would run every 5 minutes Every train starts at station 1 and ends in stations 6 Time between stations is 3 minutes and 2 minutes for stops. This means that a train that starts in station 1 (no stop time here) and stops in 3 and 5 and then ends in 6 (no stop time here) would take: 3+3+2+3+3+2+3 = 19.

4.2.1. Representation

Every of the 12 period would be represented with the same structure and the principal feature would be the actualization of the O/D matrix from period to period. Every period would have the binary Xj decision variables that represented the stations where the train in that period would stop. As it is shown in Figure 4, for the Period 2 there is an O/D matrix that would dynamically change as the Excel Solver was trying to find a solution for the problem based on the previous period result of the decision variables. We also have some auxiliary fields that help us calculate how many passengers leave/enter in each of the stations where the train stops as well as the total passengers carried by the train in that period independently of the station where they left the train and we also have a column name “Pax” that represents how many people are inside the train

12

when it leaves a station. This column would be a restriction for the solver as this value could not exceed the predefined train capacity. With this information for all the periods we were able to build a “program” that the Solver could run (Figure 4): •

• •

Parameters: 1. The O/D Matrix of each period (dynamic) 2. Time between stations 3. Time taken in stops 4. Capacity Q of trains (equal for all of them) Decision variables: 1. All Xj for each period Constraints 1. All periods Xj binary 2. All periods X1 and X6 (start and end station) are equal to 1. 3. For all periods, each row of the “Pax” column cannot exceed the parameter Capacity Q. 4. Total number of passengers carried to their destinations equals the original O/D matrix times 12. Objective function: Minimize the sum of the total time cell for each period.

Figure 3 - Objective function and constraints

13

â&#x20AC;˘

Figure 4 - Excel representation for one period

14

4.3.Solutions and optimizations Although we have stated that we set the restriction for every train to start in station 1 and end in station 6, initially this was not the case. 4.3.1. Unsuccessful runs

We tried several times to run Solver by removing this restriction and thus allowing it to try to find solutions that could incorporate cases where, for instance, a train in a period would start in station 2 and end in station 5. But although we tried this, Solver would run indefinitely (more than 1 day!) and if we tried to set a time frame for it to run the solutions it presented were never acceptable because some of the decision variables (where train stops) would be real numbers between 0 and 1 which distorted completely the results. This could be due to several reasons like: (1) our model was not well represented, (2) problem to complex or (3) Solver algorithm not adjusted for this type of problems. 4.3.2. Solutions found

As said, we had to use the restriction for every train to start and end in stations 1 and 6, respectively so all the solutions we found were sub problems of this one. 4.3.2.1. Trains stopping in every station every 20 minutes with capacity 3750

Here we used the restrictions described before but also restricted Solver by setting all Xj decision variables of periods 4, 8 and 12 to be the binary 1. We ran this solution to see if it would be possible to guarantee that all passengers in every station could be transported every 20 minutes to their destinations (see the table with information of all periods in Excel file, sheet Results). And Solver was able to find a solution (Figure 6) that guarantee this and at the same time minimizes the time. Figure 5 summarizes the results we got in this run. We also calculated the average number of passengers waiting in each station to have an idea of the number of people that would be somehow unhappy with the solution and to have some client satisfaction measure of comparison. Other interest result given by solver was that, although we set the maximum capacity to 3750, the maximum number of passengers in a train at a time in all the 12 periods was 3700.

15

num total stops Capacity Total time max pax in 1 train Pass Transp avg pax left station 1 avg pax left station 2 avg pax left station 3 avg pax left station 4 avg pax left station 5 avg pax left station 6 avg total pax left stations

53 3750 238 3700 46800 433,333 375 240 373,333 75 0 299,333

Figure 5 - Results for every 20 minutes

We can see in the following figure that, during the periods between the â&#x20AC;&#x153;sweepingâ&#x20AC;? trains there are always options that minimize the travel time, even if only by one less stop than those trains. There are very good trains for people that leave from station 1, with the direct trains a1 and a9. For each Periods Were Trains Stop (each 20 minutes stops in all stations, starting at 4)

Periods

1

1,5

2

2,5

3

3,5

Stations

4

4,5

5

5,5

6

1

a=1

2

a=2

3

a=3

4

a=4

5

a=5

6

a=6

7

a=7

8

a=8

9

a=9

10

a=10

11

a=11

12

a=12 Figure 6 - Trains stopping in every station every 20 minutes (Q=3750)

16

4.3.2.2. Trains stopping in every station every 15 minutes with capacity 3750

Here, all Xj decision variables were set to 1 in the periods 3, 6, 9 and 12. This test minimized the previous by trying to stop having trains stopping in every station every 15 minutes and thus improve the waiting time of passengers. Again Solver was able to find a solution (Figure 7). num total stops Capacity Total time max pax in 1 train Pass Transp avg pax left station 1 avg pax left station 2 avg pax left station 3 avg pax left station 4 avg pax left station 5 avg pax left station 6 avg total pax left stations

56 3750 244 3660 46800 333,333 425 200 233,333 0 0 238,333

Figure 7 - Results for every 15 minutes

Here we also confirm that the most beneficiaries of this solution would be the passenger that were in station one and that are in fact the ones that should have the most benefit because they are coming from further way. For each Periods Were Trains Stop (each 15 minutes stops in all, starting in 3)

Periods

1

1,5

2

2,5

3

3,5 Stations

4

4,5

5

5,5

6

1

a=1

2

a=2

3

a=3

4

a=4

5

a=5

6

a=6

7

a=7

8

a=8

9

a=9

10

a=10

11

a=11

12

a=12 Figure 8 - Stops for every 15 minutes

17

4.3.2.3. Trains stopping in every odd period (every 10 minutes) with capacity 3750

Here, all Xj decision variables were set to 1 in the periods 1, 3, 5, 7, 9, 11 and 12 (Figure 10). This of course was a solution that couldnâ&#x20AC;&#x2122;t minimize our objective to a great extent but nevertheless it should be considered in the analysis as it is interesting from the point of view of carrying more people every 10 minutes. num total stops Capacity Total time max pax in 1 train Pass Transp avg pax left station 1 avg pax left station 2 avg pax left station 3 avg pax left station 4 avg pax left station 5 avg pax left station 6 avg total pax left stations

62 3750 256 3620 46800 166,667 208,333 166,667 1,7E-10 3,7E-10 0 108,333

Figure 9 - Stops every 10 minutes

Even in this case there would some interesting gains to people in station 1 every other even period. For each Periods Were Trains Stop (each 10 minutes stops in all, odds stations)

Periods

1

2

3

Stations

4

5

6

1

a=1

2

a=2

3

a=3

4

a=4

5

a=5

6

a=6

7

a=7

8

a=8

9

a=9

10

a=10

11

a=11

12

a=12

Figure 10 - Stops every odd period

18

4.3.2.4. No restrictions, capacity 3800

This was the most interest run because there were no restrictions beside the base one, i.e., only start in station 1 and end in station 6 (Figure 11). num total stops Capacity Total time max pax in 1 train Pass Transp avg pax left station 1 avg pax left station 2 avg pax left station 3 avg pax left station 4 avg pax left station 5 avg pax left station 6 avg total pax left stations

47 3800 226 3620 46800 833,333 875 580 595 150 0 606,667

As we can see the total number of stops reduces drastically as well as the total time travel for all trains. But there is a huge downside for this solution: the average passengers

waiting

in

stations

grow

enormously. Nevertheless it is a solution and it has a interest value in the capacity, which resembles the values resulted in the other solutions

presented

here.

For each Periods Were Trains Stop (1st e 6st) 1

2

3

Stations

4

5

6

a=1

2

a=2

3

a=3

4

a=4

5

a=5

6

a=6

7

a=7

8

a=8

9

a=9

Periods

1

10

a=10

11

a=11

12

a=12

Figure 11 - No restrictions besides start 1 and end 6

Only the last train stops in every station, â&#x20AC;&#x153;sweepingâ&#x20AC;? all the remaining passengers that were left in the stations. This solution was the best one we found and the only relevant problem for it is, as 19

said before, the passengers waiting in stations, more specifically stations 2 and 3 which can have periods of 20 to 25 minutes of waiting.

4.3.3. Random generation of O/D matrixes for every period

To test the robustness of our solutions we implemented a simulation mechanism where we randomly generated the O/D matrixes in every period, having the base period matrix as its base. To calculate the random matrixes we generated, for each cell of the matrix, a number between the value of cell in the base O/D matrix minus that value divided by 3 and the value of the cell plus that value divided by 3. For example, a cell with value 200 in the base matrix could originate values between [200-(200/3), 200+(200/3)] (Figure 12).

1 2 3 4 5 6

1 2 3 4 5 6

1 0 0 0 0 0 0

Base Matrix 2 3 200 200 0 50 0 0 0 0 0 0 0 0

4 200 50 40 0 0 0

5 400 100 80 140 0 0

6 1000 300 280 560 300 0

1 0 0 0 0 0 0

Random Matrix 2 3 208 251 0 66 0 0 0 0 0 0 0 0

4 265 57 40 0 0 0

5 455 126 77 134 0 0

6 1214 400 230 717 321 0

Figure 12 - O/D matrix random generation

The idea here was to see if the capacity would be enough in case the demand changed in some degree (33% in our simulations). We could also see how it affected the passengers waiting in each station compared with the initial solution.

20

We ran 5 random solutions for each of the 4 solutions we described previously and in the following sections we compare the results of the original result with the compiled 5 random results for that solution. 4.3.3.1. Trains stopping in every station every 20 minutes with capacity 3750

5 Randoms final results max pax in 1 train 4253 average Capacity 3919,8 avg pax left station 1 419,5667 avg pax left station 2 373,4833 avg pax left station 3 242,2333 avg pax left station 4 377,1167 avg pax left station 5 72,83333 avg pax left station 6 0 avg total pax left stations 297,0467 Capacity 3750 Total time 238 num total stops 53

Original Values max pax in 1 train 3700 Pass Transp 46800 avg pax left station 1 433,3333333 avg pax left station 2 375 avg pax left station 3 240 avg pax left station 4 373,3333333 avg pax left station 5 75 avg pax left station 6 0 avg total pax left stations 299,3333333 Capacity 3750 Total time 238 num total stops 53

Figure 13 - Comparison of random generation with original values

4.3.3.2. Trains stopping in every station every 15 minutes with capacity 3750

5 Randoms final results max pax in 1 train 4017 average Capacity 3921,6 avg pax left station 1 342,7667 avg pax left station 2 443,85 avg pax left station 3 198,1667 avg pax left station 4 229,05 avg pax left station 5 0 avg pax left station 6 0 avg total pax left stations 242,7667 Capacity 3750 Total time 244 num total stops 56

Original Values max pax in 1 train 3660 Pass Transp 46800 avg pax left station 1 333,3333333 avg pax left station 2 425 avg pax left station 3 200 avg pax left station 4 233,3333333 avg pax left station 5 0 avg pax left station 6 0 avg total pax left stations 238,3333333 Capacity 3750 Total time 244 num total stops 56

Figure 14 - Comparison of random generation with original values

21

4.3.3.3. Trains stopping in every station every 10 minutes with capacity 3750

5 Randoms final results max pax in 1 train 4022 average Capacity 3920,8 avg pax left station 1 169,7333 avg pax left station 2 212,55 avg pax left station 3 158,7667 avg pax left station 4 0 avg pax left station 5 0 avg pax left station 6 0 avg total pax left stations 108,21 num total stops 62 Capacity 3750 Total time 256

Original Values max pax in 1 train Pass Transp avg pax left station 1 avg pax left station 2 avg pax left station 3 avg pax left station 4 avg pax left station 5 avg pax left station 6 avg total pax left stations num total stops Capacity Total time

3620 46800 166,6666667 208,3333333 166,6666667 1,7252E-10 3,69686E-10 0 108,3333333 62 3750 256

Figure 15 - Comparison of random generation with original values

4.3.3.4. No restrictions, capacity 3800

5 Randoms final results max pax in 1 train 4040 average Capacity 3751,6 avg pax left station 1 855,3 avg pax left station 2 874,4167 avg pax left station 3 592,2 avg pax left station 4 598,25 avg pax left station 5 161,7 avg pax left station 6 0 avg total pax left stations 616,3733 num total stops 47 Capacity 3800 Total time 226

Original Values max pax in 1 train 3620 Pass Transp 46800 avg pax left station 1 833,3333333 avg pax left station 2 875 avg pax left station 3 580 avg pax left station 4 595 avg pax left station 5 150 avg pax left station 6 0 avg total pax left stations 606,6666667 num total stops 47 Capacity 3800 Total time 226

Figure 16 - Comparison of random generation with original values

The results show that the number of passengers left in station does not change substantially and the values remain somehow stable. The problem that emerge from this 22

simulation concerns the capacity of the trains, since in all the simulations the maximum capacity for the trains was exceed, in some cases a bit more than others, in the interval of 3% to 8%. This can indicate that the solutions we presented run close to capacity in some cases, which can indicate a bad level of service regarding on-train comfort. These results also show that if the demand changes by 30% the current capacity will not be sufficient. In our opinion this simulation or sensitive analysis is a very important indicator to consider if when planning for the future.

5. Questions that require further study 5.1.Logistical and operational questions Bellow we show the March diagrams from two of the solutions we got.

Figure 17 - Train stops 1st and last station

23

Figure 18 - Train 3,6,9 and 12 stop in every station

As we can see in one of the solutions the trains coincide and some are overtaken by others, this can only happen if we have more than one track in the line for the trains. This could also create problems in the stations (if they have only one dock in each way). Besides that we didnÂ´t study the problem for the two ways, and there is the additional question that the trains must be available to start the trip in a given station (one solution, and that is what happens in the real commuter line we based our selves, is that the time tables are equal in both ways).

24

5.2.Passengers waiting and travel times Other set of questions have to do with minimizing the waiting time and travel time, the problem we solved already gives a good answer for the last question, but for the first we didnÂ´t implement a specific constrain. When we forced the trains to stop in all the stations we were in a way addressing this problem, but this is a very crude constriction, and we should use a more sophisticated approach. Since, for computational issues, we were not able to get a solution were the train can start and stop is trip in any station (and not just start at the first and end at the last) we didnÂ´t address explicitly the question of minimizing the number of transfers a passenger as to do, or just the possibility of having transfers, like one passenger can get from station i to j, but wait there to get to another j station. So, although the waiting times and number of transfers are not a big issue with the solutions we get, we would have to address them better in a Model that allows more degrees of freedom.

5.3.Variable Frequencies for the Trains As we stated before, it would be of interests not only to know were the train should start, stop, and end is trip, but also to find the best frequency (of course this would be constrained by the mentioned operational problems, like we have to have a minimum headway between trains) for the trips. This will bring the additional question to tackle of having trains starting from different stations, so the headways could be flexible depending were the next train will start is journey. We formulated mathematically a way for the number of train trips (the frequency of the trains) to be an answer of the model, but the question stated in the previous paragraph is not addressed. With the time and software we add it was impossible to implement this formulation, but it would give additional information for decision making. 5.4. Using Genetic Algorithms Given the complexity of the problem we addressed, using a genetic algorithm to solve this problem seems a good option. The Solver in Excel uses the Simplex method, and Branch and 25

bound, but for the number of possible solution we have, and even more if we wanted to study a line with more stations and a longer period of time (more than one hour), these algorithms are not suitable. We could use a genetic algorithm to solve the problem we implemented in Excel like this: -

-

Cross over between the three best solutions and one randomly picked, then we apply a mutation rule to one of the three best solutions;

-

We should get 8 new solutions from this operations (we first must test if they are feasible according to our constrains);

-

Take the 4 best of this 8, plus 2 from the “fathers” of this solution and generate 2 randomly and with this new “generation” perform the cross over and mutation operations;

-

Repeat the last step until we reach a point were after 10E6 iterations we cannot get a better solution.

A problem with using an algorithm like this would be that we would have to check the “feasibility” of each solution and with the kind of constrains we have this can become a bit tricky.

6. Conclusion First thing we should say is that trying to express this problem in a mathematical way really sheds light to the question at hand, and all the issues that need to be addressed in as systematic way. The problem we set to solve was very hard, and like we already stated it´s not fully addressed, still we were able to implement a model that gave us some reasonable solutions and a lot of information about the performance of each solution. We also did some simple simulations to perform some sensibility analysis to each solution. So we were able to reach solutions that takes considerable less time to carry all the passengers (from the simple stop in all stations solution) to their destinations, that give us the minimum capacity the trains should have, and information about the number of passengers that have to 26

wait more than five minutes to get a train. So in face of the problem we set to solve in the beginning we answered the questions we formulated. Still, we feel that this is just a good starting point to explore more this issue. This approach can be very useful not only in suburban commuting train lines, but also in other similar situations (like with intercity and regional train lines, or buses). With further study and better computing tools some of the faults we identify can be addressed relatively easily, like optimizing the frequencies as well as the stops each train makes. Also the Branch and Bound algorithms donÂ´t seem the more adequate to solve this problem, we gave an overview of a simple example of one possible genetic algorithm to apply to this problem. So to get further and better solutions, with more variables and parameters, this would have to be definitely a further study subject.

27

Train Timetables, were to stop?

Linha de Sintra, que paragens deve o comboio fazer para optimizar o serviço aos passageiros?

Train Timetables, were to stop?

Linha de Sintra, que paragens deve o comboio fazer para optimizar o serviço aos passageiros?