不知道从&QUOT最近对启发式;算法设计手册" [英] Don't understand closest pair heuristic from "The Algorithm Design Manual "

查看:344
本文介绍了不知道从&QUOT最近对启发式;算法设计手册"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有几乎一模一样的<一个href="http://stackoverflow.com/questions/7216755/what-is-the-meaning-of-from-distinct-vertex-chains-in-this-nearest-neighbor-al/7216814#comment15114654_7216814">question.但我还是不明白,这是怎么启发式工作以及以何种顺序顶点通过。也有是在一本书的图片:

There is almost exactly the same question. But I still don't understand, how is this heuristic working and in what sequence vertexes are passed through. Also there is a picture in a book:

这表明最近-neghbor启发式的比较,我相信这是一个最接近,对启发。从图像I可以假设在顶部图像,0点是第一次选择,但在底部的图片有被选为最左边或最右边的之一。因为没有什么说一下第一点选择(也最接近,对启发式没有做任何动作)有,我可以假设,任何算法结果再好它不会给你底部的图片,如果它不考虑入手点什么。

That shows comparison of nearest-neghbor heuristic and what I believe is a closest-pair heuristic. From the picture I may assume that on the top picture, 0 point was selected first, but on the bottom picture there was selected the leftmost or the rightmost one. Because there is nothing said about first point selection (also the closest-pair heuristic doesn't do any actions in that), I may assume that any algorithm results however good it is won't give you the bottom picture if it doesn't consider, what point to start with.

现在我只是想知道,有什么步骤最接近,对启发式品牌。类似的底部之一,数字与随解释每次迭代相关联的画面将AP preciated。

For now I just want to know, what steps closest-pair heuristic makes. A picture similar to the bottom one with numbers associated with each iteration along with explanation would be appreciated.

下面是链接这本书从后拍摄。

Here is the link to the book taken from that post.

推荐答案

我没有书,但它示出了最近邻启发式,以该数据的最佳解决方案的比较。这里显示的数据是(-21,-5,-1,0,1,3,11)。

I don't have the book, but it is showing a comparison of the nearest neighbor heuristic to the optimal solution for this data. The data shown here is (-21, -5, -1, 0, 1, 3, 11).

这种混乱可能是局部的贪心算法和一个全球性的贪心算法(因为缺乏更好的词)之间。上面显示的最近的邻居是严格的地方。的机器人从0开始,并选择去1,因为它是最接近的路径。机器人为1,并发现下一个最接近的点是-1。然后,机器人位于-1和下一个最接近的点是3,等等。

The confusion may be between a "local" greedy algorithm and a "global" greedy algorithm (for lack of better word). The nearest neighbor shown above is strictly local. The "robot" starts at 0 and chooses to go to 1, because it is the closest path. The robot is at 1, and finds the next closest point is -1. Then the robot is at -1 and the next closest point is 3, and so on.

最近对更加全球化。它看着都最佳的边缘一次。所以,该算法起始于0,发现4是恰好1单元相距(0,1),(1,0),(-1,0)和(0,-1)。这将增加两个不同的对创建图表(-1,0,1)。这可以被任一定向或非定向

The closest pair is more global. It is looking at all optimal edges at once. So, the algorithm starts at 0 and finds four that are exactly 1 unit apart (0, 1), (1, 0), (-1, 0), and (0, -1). It would add two distinct pairs creating the graph (-1, 0, 1). This could be either directed or non-directed.

然后,它会重复,并注意(1,3)是下一个最小边缘,依此类推,直到其到达的最优解。

Then it would repeat, and notice that (1, 3) is the next smallest edge, and so on, until it arrives at the optimal solution.

不同的是,在最近的邻居的情况下,机器人只能看那里它当前所在的邻居。在最近的一对的情况下,你可以看看所有边缘选择最小的一个。

The difference is that in the nearest neighbor case, the robot can only look at the neighbors of where it is currently located. In the closest pair case, you can look at all edges to choose the smallest one.

这篇关于不知道从&QUOT最近对启发式;算法设计手册&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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