使用公交车在城市公共交通 [英] Public Transportation using Buses in City

查看:113
本文介绍了使用公交车在城市公共交通的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个旅程规划网站。有几件事情是简单的在这种情况下,目前即现在的网站只能够规划公交线路,公交车的定时是当前不可用。因此,这意味着我们只有存储在数据库中的巴士路线,自总线时序不是可用,因此等待时间旅行者是不相关的,以及。什么是可用的是覆盖两站之间为单个总线的时间和距离。

I am developing a Journey Planner website. There are few things that are simple in this case currently i.e. Right now the website will only be able to plan bus routes, the timings of buses are not currently available. So this means we only have bus routes stored in the db and since bus timings are not available so waiting times for traveler are not relevant as well. What is available is the time and distance covered between two stops for an individual bus.

我觉得用一个无向加权图存储每一个巴士站,每一个专用总线的时间和距离成本将要走的路。然后我可以使用Dijkstra算法来计算基于时间或距离的每用户preference由用户输入的两个位置之间的最短路径。我想找出是否两个或三个总线,通过简单的C#功能所需,如果公交线路相交于停止,然后使用这些路口站的旅客要改变总线。但将有一个单独的曲线图,用于每个总线。另一种方法(不知道这是正确的)的方法是使用含城市的每一个巴士站为节点,然后使用这种技术来找出两站之间旅行的方式图。这是正确的做法?我应该使用A *算法到位的Dijkstra算法中的?

I think that using an undirected weighted graph storing the time and distance costs of each bus stop for each individual bus would be the way to go. Then I could use Dijkstra algorithm to calculate the shortest path between two locations entered by the user based on either time or distance as per user preference. I would find out whether two or three buses are required through simple C# functions if the bus routes intersect at stops and then using those intersection stops for the traveler to change the bus. But there would be an individual graph for each bus. An alternative (not sure if this is correct) way would be to use a graph containing every bus stop of city as nodes and then using this technique to find out the way to travel between two stops. Which is the correct approach? Should I use A* algorithm in place of Dijkstra algo?

在设计中的几个基本点:我想该应用可扩展的,所以我可以添加其他交通方式后,当有需要时。此外,该公交车时间也可以以后如果有可能增加不发生重大变化的网站。我看到这里不少专家谁已经在交通比较复杂的项目工作。所以,请帮助我走出了最具扩展性,模块化和可扩展的方式来实现这种功能的最佳途径。

A few general points for the design: I would like the app to be extensible so I could add other transportation means later when the need arises. Moreover the bus times could also be added later if possible without major changes to the website. I have seen quite a few experts here who have worked on much complex projects of transportation. So please help me out with the best way to implement this functionality in the most scalable, modular and extensible fashion.

推荐答案

我开始了一个类似的应用去年夏天永远不会结束,但我确实有一些建议这个图,以及如何构建数据。

I started a similar application last summer and never finished it, but I do have some advice on this graph, and how to structure your data.

我的计划是有各停止作为节点,并为每一次每这些节点之间的路径的总线经历。例如,如果一个总线超过6小时的时间内停止了每半小时,然后将有两个节点12之间的路径。时间是背后的主要驱动器的路径的成本,因此通常最快路径将是一个选择。

My plan was to have each stop as a node, and a path between each of these nodes for every time a bus went through. For example, if a bus stopped every half hour over a 6 hour period, then there would be 12 paths between the two nodes. Time was the main driver behind "cost" of the path, so typically the soonest path would be the one chosen.

启动应用程序会查询数据库,在未来5小时*路径之前(调整如适用)。然后,它将紧缩与Dijkstra算法。

Before starting the application would query the database for all paths in the next 5 hours (adjust as appropriate). It would then crunch with Dijkstra's algorithm.

其他的事情以要素成本的途径,转移支付(及其成本)的实际资金成本,没有屋顶停止(如果你倾向于有恶劣的天气),等等。

Other things to factor in cost are the actual money cost of the route, transfers (and their cost), stops with no roofs (if you tend to have bad weather), etc.

该计划的工作很适合我。我住在一个地区有3总线系统。

This plan worked well for me. I live in an area with 3 bus systems.

最后,可能你一些很好的构造类似的方式将数据给的谷歌公交Feed规范,因为许多机构产生这种类型的,你可以导入数据。

Finally, it may do you some good to structure your data in a similar way to the Google Transit Feed Specification, as many agencies produce this type of data that you could import.

这篇关于使用公交车在城市公共交通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆