地图提供商(如谷歌或Yahoo!地图)指示方向?

I mean, they probably have real-world data in some form, certainly including distances but also perhaps things like driving speeds, presence of sidewalks, train schedules, etc. But suppose the data were in a simpler format, say a very large directed graph with edge weights reflecting distances. I want to be able to quickly compute directions from one arbitrary point to another. Sometimes these points will be close together (within one city) while sometimes they will be far apart (cross-country).

Graph algorithms like Dijkstra's algorithm will not work because the graph is enormous. Luckily, heuristic algorithms like A* will probably work. However, our data is very structured, and perhaps some kind of tiered approach might work? (For example, store precomputed directions between certain "key" points far apart, as well as some local directions. Then directions for two far-away points will involve local directions to a key points, global directions to another key point, and then local directions again.)

实践中实际使用的算法是什么?

PS:这个问题的动机是发现在线地图方向的怪癖。与三角形不等式相反,有时谷歌Maps认为X-Z比使用中间点(如X-Y-Z)花费的时间更长,距离更远。但也许他们的行走方向也会优化另一个参数?

pp。这是对三角不等式的另一个违反,这表明(对我来说)他们使用了某种分层方法:X-Z vs X-Y-Z。前者似乎使用了著名的塞瓦斯托波尔大道(Boulevard de Sebastopol),尽管它有点偏僻。

编辑:这两个例子似乎都不起作用了,但在最初的帖子发布时都起作用了。


当前回答

我已经在路由方面工作了几年,最近由于客户的需求而引起了大量的活动,我发现a *很容易就足够快了;真的没有必要去寻找优化或更复杂的算法。在一个巨大的图上路由不是问题。

但是速度取决于整个路由网络,我指的是在内存中分别表示路由段和节点的有向图。主要的时间开销是创建这个网络所花费的时间。基于一台运行Windows系统的普通笔记本电脑,并在整个西班牙进行路由的一些粗略数字:创建网络所需时间:10-15秒;计算路线所花费的时间:太短而无法测量。

The other important thing is to be able to re-use the network for as many routing calculations as you like. If your algorithm has marked the nodes in some way to record the best route (total cost to current node, and best arc to it) - as it has to in A* - you have to reset or clear out this old information. Rather than going through hundreds of thousands of nodes, it's easier to use a generation number system. Mark each node with the generation number of its data; increment the generation number when you calculate a new route; any node with an older generation number is stale and its information can be ignored.

其他回答

我对此有了更多的想法:

1)记住地图代表一个实体组织。存储每个交叉口的经纬度。除了目标方向上的点以外,你不需要检查太多。只有当你发现自己受阻时,你才需要超越这一点。如果你储存了大量的高级连接,你就可以进一步限制它们——通常情况下,你永远不会以偏离最终目的地的方式穿过其中任何一个连接。

2)根据有限的连通性将世界划分为一系列区域,定义区域之间的所有连通性点。找出您的源和目标所在的区域,从您的位置到每个连接点的起始和结束区域路由,以及连接点之间的区域映射。(我怀疑后者在很大程度上是事先计算好的。)

请注意,区域可以比大都市区域小。任何具有地形特征的城市(比如一条河)都是多个区域。

我已经在路由方面工作了几年,最近由于客户的需求而引起了大量的活动,我发现a *很容易就足够快了;真的没有必要去寻找优化或更复杂的算法。在一个巨大的图上路由不是问题。

但是速度取决于整个路由网络,我指的是在内存中分别表示路由段和节点的有向图。主要的时间开销是创建这个网络所花费的时间。基于一台运行Windows系统的普通笔记本电脑,并在整个西班牙进行路由的一些粗略数字:创建网络所需时间:10-15秒;计算路线所花费的时间:太短而无法测量。

The other important thing is to be able to re-use the network for as many routing calculations as you like. If your algorithm has marked the nodes in some way to record the best route (total cost to current node, and best arc to it) - as it has to in A* - you have to reset or clear out this old information. Rather than going through hundreds of thousands of nodes, it's easier to use a generation number system. Mark each node with the generation number of its data; increment the generation number when you calculate a new route; any node with an older generation number is stale and its information can be ignored.

就静态道路网络的查询时间而言,目前最先进的技术是Abraham等人提出的Hub标签算法http://link.springer.com/chapter/10.1007/978-3-642-20662-7_20。最近,微软技术报告http://research.microsoft.com/pubs/207102/MSR-TR-2014-4.pdf发布了一份关于该领域的全面而出色的调查报告。

简短的说法是……

Hub标签算法为静态道路网络提供了最快的查询,但需要大量ram来运行(18 GiB)。

传输节点路由稍慢,不过它只需要大约2 GiB的内存,并且有更快的预处理时间。

收缩层次结构在快速预处理时间、低空间需求(0.4 GiB)和快速查询时间之间提供了一个很好的平衡。

没有一种算法是完全占主导地位的……

彼得·桑德斯的谷歌科技演讲可能会让你感兴趣

https://www.youtube.com/watch?v=-0ErpE8tQbw

还有Andrew Goldberg的演讲

https://www.youtube.com/watch?v=WPrkc78XLhw

压缩层次结构的开源实现可从KIT的Peter Sanders研究小组网站获得。http://algo2.iti.kit.edu/english/routeplanning.php

还有一篇微软写的关于CRP算法用法的博客文章…http://blogs.bing.com/maps/2012/01/05/bing-maps-new-routing-engine/

我知道OP里的地图是怎么回事了:

用指定的中间点来观察路线:由于那条路不直,这条路线略微向后走。

如果他们的算法不会回溯,它就看不到更短的路线。

以下是世界上最快的路由算法的比较和正确性:

http://algo2.iti.uka.de/schultes/hwy/schultes_diss.pdf

下面是谷歌关于这个主题的技术演讲:

http://www.youtube.com/watch?v=-0ErpE8tQbw

以下是schultes所讨论的高速公路层次算法的实现(目前仅在柏林,我正在编写界面,移动版本也正在开发中):

http://tom.mapsforge.org/