Sunday, October 21, 2007

Why is the bus so often late?

How long should a bus driver wait for someone who's running to the stop? Well, we've got this nice little tool called Total Cost to Society(TCS) that we can use.

Let's lay down the variables:
t: amount of time(in seconds) before the next bus
p: number of people in the bus
w: amount of time(in seconds) to wait for the running passenger

Considering that the driver has no information about the passengers, we can assume that everyone's time is worth the same.

Let's first see the two decisions and what their respective TCS are:
1. The bus driver wait
Consequence: Everyone in the bus has to wait for w seconds.
TCS = w * p

2. The bus driver doesn't wait
Consequence: The running passenger has to wait until the next bus
TCS = t

So for it to be valuable to wait, we need:
t > w * p
With a slight transformation we now have the magic formula of

w < t / p


Let's look at an example. There is a bus every 10 minutes (600 seconds) and that bus now contains 30 passengers.
w < t / p
w < 600 / 30
w < 20

We learn that in this case, the TCS of waiting will be lower as long as the wait is less than 20 seconds.

(Photo by dennis)

4 comments:

Élise said...

Bien vu (si seulement le temps des autres n'était pas toujours plus important que le nôtre).

Ton concept me fait penser à celui de personnes-temps en épidémiologie :
le risque d'une population = le nombre de personnes à risque x la période de temps à risque (vive les cours de toxico).

Ceci dit, les bus les plus ponctuels que j'aie vus jusqu'à maintenant sont à Paris.

À bientôt,

Ta cousine

L.S.C. said...

That looks interesting. However, I do think your model neglects some important things. First, waiting w for the runner causes not only the people in the bus to lose time, but also all other eventual passengers on the bus ride. Indeed, after waiting for the runner, the bus will be w seconds late.

Suppose we number the bus stops along the ride by 1, 2, ..., N. We set X_i to be the number of passengers in the bus between stop i-1 and stop i. Let Y_i be the number of people waiting for the bus at stop i. Then, if the runner is at stop k we have the following TCS if we wait for the runner:

TCS = w * (sum{Y_i, i > k} + X_k)

Then, for it to be valuable to wait, we need:

t > w * (sum{Y_i, i > k} + X_k)

Second, it would be very unfair to wait for the runner at stop k but not for other runners. Thus, if we want to be fair, we need either to wait for all runners along the ride or for none of them.

Let w_i be the time to wait for the runner at stop i. This time can be zero if no runner is present at stop i. Then, if we do not wait for them, the TCS is:

TCS = (N - 1) * t

If we do wait, we get:

TCS = sum{w_k * (sum{Y_i, i > k} + X_k), k = 1, 2, ..., N - 1}

Now, it is unreasonable to suppose we already know all X_i and Y_i. We should treat them as random variables with a given distribution (which can be found by sampling the commuters). Then we can make the calculation with the expectation of the TCS for waiting.

As you see, I really like your TCS idea! Sounds like a lot of fun!

Simon F. said...

Wow, great job on that L.C.S.! You know, it doesn't surprise me one bit that you're the one who wrote that! ;)

Of course my model was greatly simplified. The objective is to be able to quickly do the calculations in your head.

Your model is very good except for a very important assumption. If the bus is already late w seconds at stop i, then we have to account for every runner at stop i+1 who are (or will be I guess) less than w late. I'm way too lazy to try to figure that out now, but I'm sure you could.

We could then use a Monte Carlo simulator to approximate every variable.


Another important thing I haven't talked about is the long term effect. This whole analysis implies only takes into account the short-term effect. If the bus is so often late, then maybe people will be so fed up with it that they'll start using different mode of transportation which might have a bigger overall TCS (say, if someone uses his car he'll contribute to traffic and he might use a parking spot where they are scarce).

L.S.C. said...

Ok, I just realized I made an important mistake. If we do not wait for the runners, then the TCS is not necessarily (N - 1) * t. It is so if there is a runner at each bus stop. A more realistic TCS is given by
TCS = M * t
where M is the number of runners.

And the point you made is very important indeed, Simon. We need to define what "time" means in this context. If we consider an absolute time, then a "runner" at stop i+1 that arrives w_{i+1} seconds late will not cause any problem if the bus has already more than that much time late. However, considering this is much more complicated.

In my comment, I used a "relative" time, meaning that the w_k were times measured relative to the arrival of the bus at stop k. Similarly, I made the not so realistic assumption that the time between buses is alwats t. So even if a bus is already late the runner that did not pick the bus will wait t, not t minus the amount of time the preceding bus was late...

I think it is possible to formulate this problem in a more convenient way. Something like
minimize TCS
s.t. some constraints
To do this, we need to find an expression for the TCS that includes both cases (waiting and not waiting). Then we could set the w_k as variables an try to find what values give an optimal solution to that problem. I still need to figure how to do that. As soon as I found something, I will post it here.