Algorithm Analysis of Traffic Interchange and Transportation system

I went to back SH and stay home for 3 days now, well, the vacation is kinda long for me and prety enjoyable.
When I was In BJ, I need to check online whenever I went out for visisting coz my place is quite long way from the places of interests.
There is a very good website named GJBJ which can tell u the shortest way and the least interchange times to get to the destination from the start location you specify.

Personally, I was quite surprised for the speed of the calculation of the system due to the comflexity of traffic system in BJ.
Then, I start the think about how to solve the problem of transportation and interchange system with shortest way and least intechange times.

And I came up with a draft idea:
1, store all the stops and stations of the entire traffice system in a list or array.
2, travel through all the metro and buses lines stations and add the number(identity number) to the specific location like this: 王府井[0] = Line1.
3, let say if from A to B, first check wheather there is a certain line to get from A to B directly. If it is , return line with the least station number.
   If not, check the traffic lines list in A and B stations, check from the line in A[i] ( i= 0), whether there is B[0] ~B[n-1] lines in A[i+1] ~A[n] if there is mark the result as "can get there by interchange".
4, for the least interchange times, we need to apply dynamic programming algoriythm here.

To be continue...

posted on 2007-10-03 16:57  SigEric  阅读(345)  评论(0编辑  收藏  举报

导航