Mumbai Navigator“How to commute using delay prone buses”
Abhiram Ranade
Department of Comp Sc. & Engg.
I.I.T. Bombay
SpecificationInput: Origin, Destination (In Mumbai)
Output: Travel plan using public transport
(400 Bus routes, 100 train stations, 2500 Bus stops)
Time estimate (waiting + travelling)Claim: Fastest Plan is output
Least expected waiting + travel time. Under certain model.
Travel Planning in a Punctual World
ProgramOrigin = x
Destination = y
“6:17 bus from x to z.
6:32 train from z to w.
7:15 train from w to y.”
Bus/Train Schedules
Plan generated using shortest path algorithm.
Delay Prone World
• Bus schedules are not reliable.
• Arrival frequency is statistically reliable
• Travel time is statistically reliable.
Mumbai Problem:
• Terminus to terminus time estimate available. Stop-to-stop not available.
Mumbai Navigator Organization
• Preprocessing Phase: Given terminus-to-terminus times for each route, Guess stop-to-stop timing
• Main program:
Database input: Frequency of each route
+ Stop-to-stop time along route.
User Input: Origin, Destination
Output: Travel Plan, Time estimate.
Travel Plan Models
• Fixed/Sequential:
“Take bus B1 to x. From there train T1 to y. From there bus B2 to z”
• Adaptive:
“Take bus B3 or B4 whichever comes first.
If B3 then alight at w, then take either..
If B4 then alight at u, then take..”
• Adaptive better in delay prone world.
Plan Tree
Origin
w u
DestinationDestination DestinationDestination
DestinationDestination
B3B4
… … …
Chirqui-Robillard ’75
Model of Bus Arrival
• Poisson Distributed, independent among routes.
“Route 396 Ltd. Has 36 services in 18 hours.”
“Frequency” = once every 30 minutes : f = 1/30
Prob [ Bus arrives in next minute] = f =1/30
E[Waiting time] = 1/f
Problem Statement for Planner
• Database Input: Bus frequencies, stop-to-stop travel timing.
• On line Input: Origin, Destination
• Assumption: Bus arrivals are Poisson dist.
• Output: Plan tree having minimum average time … Next
Expected Time for a Plan
Origin
Destination
Origin
Destination Destination
B
B1 B2
1()()RBFB+
11221212()()()()1()()()()RBFBRBFBFBFBFBFB++++
Origin
SubPlan 1Expected time T1
Subplan 2Expected time T2
B1 B2
1112221212(){()}(){()}1()()()()FBRBTFBRBTFBFBFBFB++++++
Theorem
Optimal plan tree can be found in polynomial time.
• Optimal = minimum expected time• Brute force will not work: number of
possible plan trees: exponential
• 1 second for Mumbai
Algorithm (Dyn. Prog.)
• Form optimal plans without bus changes from every stop to destination.
• Form optimal plan with at most 1 change from every stop to destination.
• …• Form optimal plan with at most k changes from every stop to destination.Implementation uses k=3.
Plans without bus changes
Origin: BorivaliDestination: Mulund
Relevant Buses Running Time Frequency
398 120 min Every 5 min
L1 80 min Every 30 min
Possible Plans
Bor
Mul
Bor
Mul
398 L1
Bor
Mul Mul
398 L1
5 + 120 30 + 80111111112058030530530−−−−−−⋅+⋅+++
= 4.3 + 114.3 = 118.6
Key Observation
• Even if 398 arrives immediately, there is no point in getting into it, because
running (398) > running(L1)+ waiting(L1)
120 80 30
General Case: n buses
Algorithm:
1. Sort by running time:
2. Compute: Waiting time, running time for first i buses
3. Find j s.t.
4. Use buses 1..j
12...nRRR≤≤≤
**1,iiiiiiRFFRFF==∑∑∑
*1*1jjjRRF+>+
k change plans from k-1 change plans.
Special case: Only one bus B through origin stop S.
SS1
S2
S3
Start of route BCan only choose where to get off
S
S1
B
Optimal k-1Change planFrom S1 toDestination
S
S2
B
Optimal k-1Change planFrom S2 toDestination
S
St
B
Optimal k-1Change planFrom St toDestination
…
Evaluate all t plans, and pick best.
k change plans from k-1 change plans.
Special case: Only two buses B1,B2 at origin stop S.
SS11
S12
S13
Start of B1
Can wait for B1, get off at optimal stop.Can wait for B2, get off ..Can wait for either B1 or B2….
S21
S22
Sta
Start of B2
Plan Construction Summary
• Inductive construction of plans. Dynamic Programming.
• How to compose plans
• Data structures, computation order etc. to get high efficiency.
Problem Definition
• Input: End-to-end time for each route
• Output: Time between consecutive stops
Idea 1: Time between consecutive stopsEnd-to-end time for routeNumber of stops on route=
Example
• End-to-end-time for 398ltd. = 90 min• Number of stops = 45• Stop-to-stop time = 2 min
• End-to-end for 521ltd. = 180 min• Number of stops = 60• Stop to stop time = 3 min
• What if routes overlap?
Idea 2
• Let tij = running time from stop i to stop j (consecutive on some route)
• t15 + t56 + t69 + t93 + t34 = 90• Formulate for each route. Find consistent
solution.
1
5 69 3
4Route with end-to-end time = 90
Complications
• Standard solvers find solutions with many variables = 0.
Add inequalities: Tmin < tij < Tmax
• Fare stage = 2-3 stops. Stage length known.
• sij = speed of bus from stop i to stop j.
10 < sij < 120
• 1-5-6 = stage of length 8, then:
10t15 + 10t56 < 8, 120t15 + 120t56 > 8
Express Bus Problem
• Halts only at 1,9,4. Total time: 75 min.
• t19 + t94 = 75
• t19 < t15 + t56 + t69, t94 < t93 + t94
1
5 69 3
4Ordinary Route with end-to-end time = 90
Errors in Data
• What if end-to-end time is given as 900 because of typing mistake?
t15 + t56 + t69 + t93 + t34 + pR - nR= 900
pR, nR 0. Minimize pR + nR
If rest of the data is error free, and many routes overlap, 900 will not matter.
1
5 69 3
4Route R with end-to-end time = 90
Improving Preprocessing
• Geographical data can be used in preprocessing phase.
• If there are many optima in LP solution, can we find one with as few non-zeros as possible?
“Chebyshev points”, Interior Point methods,
Local Trains
• Estimate frequency from train timetable.
• Bus-Train connection: Walking
“Walk Bus” : Infinite Frequency, running time = time to walk.
Central, Western, Harbour line, included in Mumbai Navigator.
Minimum Fare
• Supported only in previous version.
• Construct matrix A
Aij = minimum fare for travel from i to j using any direct mode.
• Run shortest path algorithm using A as distance matrix.
Current Status
• Available at www.cse.iitb.ac.in/~navigator
• 100,000 hits per year, 250 per day.
• Plans appear to be generally good.
• Media exposure: Indian Express, Mumbai Doordarshan, Times of India, India Today.
• Very positive comments from site visitors.
Maps
• Google map, superimposed with stops.
• Stops can be selected from map, plans can be shown on map.
• Some problems: Google map API has not been stable
• Map loading time might be large