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

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


当前回答

全对最短路径算法将计算图中所有顶点之间的最短路径。这将允许预先计算路径,而不需要每次寻找源和目的地之间的最短路径时都计算路径。Floyd-Warshall算法是一种全对最短路径算法。

其他回答

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.

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

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

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

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

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

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

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

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

全对最短路径算法将计算图中所有顶点之间的最短路径。这将允许预先计算路径,而不需要每次寻找源和目的地之间的最短路径时都计算路径。Floyd-Warshall算法是一种全对最短路径算法。

像Dijkstra算法这样的图算法将无法工作,因为图是巨大的。

这个论点并不一定成立,因为Dijkstra通常不会查看完整的图,而只是一个非常小的子集(图的互联性越好,这个子集就越小)。

对于行为良好的图,Dijkstra实际上可能表现得相当好。另一方面,通过仔细的参数化,A*总是表现得一样好,甚至更好。您是否已经尝试过它对数据的处理方式?

也就是说,我也很有兴趣听听其他人的经历。当然,像谷歌Map搜索这样的突出例子是特别有趣的。我可以想象类似于有向近邻启发式的东西。