地图提供商(如谷歌或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),尽管它有点偏僻。

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


当前回答

I was very curious about the heuristics used, when a while back we got routes from the same starting location near Santa Rosa, to two different campgrounds in Yosemite National Park. These different destinations produced quite different routes (via I-580 or CA-12) despite the fact that both routes converged for the last 100 miles (along CA-120) before diverging again by a few miles at the end. This was quite repeatable. The two routes were up to 50 miles apart for around 100 miles, but the distances/times were pretty close to each other as you would expect.

唉,我无法重现——算法肯定已经改变了。但这让我对算法很好奇。我所能推测的是,有一些方向修剪,恰好对从远处看的目的地之间的微小角度差异非常敏感,或者有不同的最终目的地选择的预先计算的片段。

其他回答

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

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

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

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

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

http://tom.mapsforge.org/

我已经在路由方面工作了几年,最近由于客户的需求而引起了大量的活动,我发现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.

我以前没有在谷歌或微软或雅虎地图工作过,所以我不能告诉你他们是如何工作的。

然而,我确实为一家能源公司设计了一个定制的供应链优化系统,其中包括为他们的卡车车队提供调度和路由应用程序。然而,我们对路线的标准远比建筑、交通减速或车道封闭的地方更具体。

我们采用了一种称为ACO(蚁群优化)的技术来调度和路线卡车。该技术是一种人工智能技术,应用于旅行推销员问题来解决路由问题。ACO的技巧是基于路由的已知事实构建错误计算,以便图求解模型知道何时退出(当错误足够小时)。

你可以谷歌ACO或TSP找到更多关于这个技术。然而,我没有使用过任何开源AI工具,所以不能推荐一个(尽管我听说SWARM非常全面)。

这纯粹是我的猜测,但我认为他们可能会使用覆盖有向图的影响图数据结构,以缩小搜索域。这将允许搜索算法在所需行程较长时将路径导向主要路线。

鉴于这是一个谷歌应用程序,我们也可以合理地假设,许多神奇的功能都是通过大量缓存完成的。如果缓存前5%最常见的谷歌地图路由请求,我不会感到惊讶(20%?50%?)的请求需要通过简单的查询来回答。

这个问题在过去几年中一直是一个活跃的研究领域。主要思想是对图进行一次预处理,以加快所有后续查询的速度。有了这些附加信息,行程可以很快计算出来。尽管如此,Dijkstra算法仍然是所有优化的基础。

Arachnid描述了双向搜索和基于层次信息的边缘修剪的用法。这些加速技术工作得很好,但最新的算法在任何方面都优于这些技术。使用目前的算法,在大陆公路网上计算最短路径的时间可大大少于1毫秒。快速实现未修改的Dijkstra算法大约需要10秒。

工程快速路线规划算法概述了该领域的研究进展。有关进一步信息,请参阅那篇论文的参考文献。

已知最快的算法不使用数据中关于道路层次状态的信息,即它是高速公路还是本地道路。相反,他们在预处理步骤中计算自己的层次结构,优化以加快路线规划。这种预计算可以用来精简搜索:在Dijkstra算法中,远离起点和目的地的缓慢道路不需要考虑。好处是非常好的性能和结果的正确性保证。

第一个优化的路线规划算法只处理静态道路网络,这意味着图中的边缘具有固定的成本值。这在实践中是不正确的,因为我们想要考虑交通堵塞或车辆相关限制等动态信息。最新的算法也可以处理这些问题,但仍有问题需要解决,研究还在继续。

如果您需要最短路径距离来计算TSP的解,那么您可能对包含源和目的地之间所有距离的矩阵感兴趣。为此,您可以考虑使用高速公路层次结构计算多对多最短路径。请注意,在过去的两年里,这已经通过更新的方法得到了改进。