I’m spending most of my December break stuck behind a PC, about 16 hours a day (4-5 hours’ sleep is enough). I’m working on a public transit project, which at most is a lot of frustration, and some of those ‘wow’ moments.
Today I was working on permutations and combinations, specifically on the Gautrain.
Did you know that among the ten stations, there are combinations of 64 possible routes?
Of course a lot of them aren’t routes I’d expect one to take (e.g. a few km trip from Rhodesfield into the OR Tambo International is about R105.00. I’d rather walk, right?) The interesting thing for me that the combination of n=10;r=2 is supposed to be 45 (think: 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) [This is only possible because r=2]. This is not the case with the Gautrain, because there are three nodes connecting to each other (as opposed to a single node above).
When I calculated the combination, it was a bit tricky so I got my neighbor to help me out (he’s got a Masters in Actuarial Sciences and Math Stats). I normally do it manually when it’s not a series on a single node, which is normally a mess on paper :).
Anyways, I was surprised that he didn’t dismiss me at the door when I came to ask him. He showed me something quite interesting on how to calculate the combination, I can’t yet explain it because I’m still going to try simulate it and try derive a formula to calculate the probabilities on multiple nodes, but I found the numbers interesting.
Of course there’s already a way of doing it (which is what my neighbor showed me), but I am interested in representing it in either a single formula, or by programming a heuristic algorithm that calculates the combinations by just assessing the number of nodes and the lengths of the points on each of the nodes.
This will come in handy when I take a look at the Rea Vaya bus network, as it’s much more complex than the Gautrain one. Hopefully I’ll be able to generate the combinations on the route network automagically (it’s relatively easy to calculate the combinations, but not to generate them). I once crashed my PC trying to generate the 13’983’816 different combinations in the lottery, not an easy one to do.
Anyways, this was the ‘most’ exciting thing for me today 🙂