I live in Split,Croatia, and a city bus company recently accuired a new piece of software, and what it does is this: if I am a passenger and am awaiting a bus on a bus station, there is a huge monitor on which I can see the bus code and the time it will take for him to get to my station. The problem is, that in two years of having the software, not once have I seen that the time of the arrival is even remotley accurate. I am aware that GPS data can be inaccurate but this.... And that makes me so frustrated, that I decided that I will try to write a similar application for my final exam in CS in college. The problem is that I searched the web extensively in the last few days, and I cannot find good starting points. So my question is: have you ever been involved in such a project, and if so could you give me some pointers be it tutorials, or books regarding the subject? I appreciate any kind of input. If I made a mistake regarding the question itself feel free to close it. Thanks!

有帮助吗?

解决方案

You will probably have:

  • Vehicle object containing each vehicles position, assigned route, direction of travel on route, and next scheduled stop, previous scheduled stop, arrival time at previous scheduled stop
  • Array of routes which comprises a list of stops and a data structure holding historic transit times between stops on each route

Now, updates to a vehicle's location push to the vehicle's object.

When you want to update a display at a station, find all routes passing through that station and for each route display the estimated arrival time of the next vehicle on that route.

The estimated arrival time structure is at the heart of this. Seed it by assuming some distance between stops and an average travel speed.

Now, every time a vehicle arrives at a stop, calculate the real time it took to get there from its last stop and use this to update an average transit time binned by half-hour increments (or what have you), you could also bin by season and/or day of week. The purpose of the binning is to implicitly account for varying traffic congestion by time of day, day of week, and/or season. Assuming otherwise homogeneous conditions, you'll eventually converge on a decent estimate of the transit time between each station.

You may find it useful to employ a Kalman filter.

Estimates of travel times between more distant stations may be more accurate than travel times between adjacent stations, if you feel like looking into that. Higher-order Markov chains may also help describe the underlying statistics of transit times.

Just ideas.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top