文档章节

再译《A *路径搜索入门》之四

如比如比
 如比如比
发布于 2015/06/09 05:31
字数 1258
阅读 66
收藏 6

A *方法总结

Summary of the A* Method

 

好了,在你通走了,奠定了一步一步的方法,在同一个地方:

Okay, now that you have gone through the explanation, let's lay out the step-by-step method all in one place:

 

添加开始方(或点)到开启列表。

Add the starting square (or node) to the open list.

 

重复以下操作

Repeat the following:

 

a) 找开启列表上最小F方块。我将此作当前方

  1. Look for the lowest F cost square on the open list. We refer to this as the current square

 

b) 到关列表。

  1. Switch it to the closed list.

 

c)  当前方块的8个方块的...

c) For each of the 8 squares adjacent to this current square …

 

如果不能走,或者如果它是关的名上,忽略它。否请执以下操作。

If it is not walkable or if it is on the closed list, ignore it. Otherwise do the following.

 

如果不在开启列表中,将其添加到开启列表。使当前方块成为这个方记录的方FGH

If it isn't on the open list, add it to the open list. Make the current square the parent of this square. Record the F, G, and H costs of the square.

 

如果开启列表了,检查,看看个路径,否是更好的,采用G衡量。更低的G意味着是一个更好的路径。如果是这样方格的父改当前方,并重新算方GF。如果你保持开启列表排序F由于这个化你可能需重存列表。

If it is on the open list already, check to see if this path to that square is better, using G cost as the measure. A lower G cost means that this is a better path. If so, change the parent of the square to the current square, and recalculate the G and F scores of the square. If you are keeping your open list sorted by F score, you may need to resort the list to account for the change.

 

d)当你停止:

d) Stop when you:

 

添加到关列表,在种情况下,路径已发现下面的注),或无法找到目,并且开启列表是空的。在种情况下,不存在路径。

Add the target square to the closed list, in which case the path has been found (see note below), or Fail to find the target square, and the open list is empty. In this case, there is no path.

 

保存路径。从目往回走,从每个方块移到其父,直到你到达开始是你的路径。

Save the path. Working backwards from the target square, go from each square to its parent square until you reach the starting square. That is your path.

 

注:在早期版本的文章中,有人建,当目(或点)已添加到开启列表,而不是关的列表,你可以停下来。这样做会更快,它几乎是会你的最短路径,但并非是如此。有些情况下,这样做可能产生差异当从第二移到最后一个点到最后的(目成本可能有明显 -例如,在河流交叉两个点之的情况下

Note: In earlier versions of this article, it was suggested that you can stop when the target square (or node) has been added to the open list, rather than the closed list. Doing this will be faster and it will almost always give you the shortest path, but not always. Situations where doing this could make a difference are when the movement cost to move from the second to the last node to the last (target) node can vary significantly -- as in the case of a river crossing between two nodes, for example.

 

小咆哮

Small Rant

 

我的,但得指出的是,当你在网上阅读A *路径搜索,并在各类论坛上的各种讨论时,你偶会看到有人提到某些代不是A *A *使用方法,你需要包含上面讨论到的元素 -- 是开放列表和关列表和路径采用FGH值。有很多其他的路径搜索算法,但是其它的通常被认为是最好的方法不是A *。在篇文章的末尾布莱恩斯托特讨论,包括他的一些利弊引用的文章很多。有替代品在某些情况下更好,但你应该明白你正在入。好了,爽了。回到话题

Forgive me for digressing, but it is worth pointing out that when you read various discussions of A* pathfinding on the web and in assorted forums, you will occasionally see someone refer to certain code as A* when it isn't. For the A* method to be used, you need to include the elements just discussed above -- specifically open and closed lists and path scoring using F, G, and H. There are lots of other pathfinding algorithms, but those other methods are not A*, which is generally considered to be the best of the lot. Bryan Stout discusses many of them in the article referenced at the end of this article, including some of their pros and cons. Sometimes alternatives are better under certain circumstances, but you should understand what you are getting into. Okay, enough ranting. Back to the article.

 

(待续)


© 著作权归作者所有

共有 人打赏支持
如比如比
粉丝 124
博文 178
码字总数 286951
作品 0
日本
程序员
《鸡啄米C++编程入门系列》系列技术文章整理收藏

《鸡啄米C++编程入门系列》系列技术文章整理收藏 收藏整理鸡啄米C++编程入门系列文章,供个人和网友学习C++时参考 1鸡啄米:C++编程入门系列之前言 2鸡啄米:C++编程入门系列之一(进制数) ...

开元中国2015
2015/05/26
132
0
《鸡啄米VS2010/MFC编程入门》系列技术文章整理收藏

《鸡啄米VS2010/MFC编程入门》系列技术文章整理收藏 1VS2010/MFC编程入门之前言 http://www.lai18.com/content/410337.html 2VS2010/MFC编程入门之二(利用MFC向导生成单文档应用程序框架) ...

开元中国2015
2015/06/27
267
0
《鸡啄米C++编程入门系列》系列技术文章整理收藏

《鸡啄米C++编程入门系列》系列技术文章整理收藏 1鸡啄米:C++编程入门系列之前言 http://www.lai18.com/content/410454.html 2鸡啄米:C++编程入门系列之一(进制数) http://www.lai18.com...

开元中国2015
2015/06/27
0
0
VS2010/MFC编程入门教程之目录和总结(鸡啄米)

鸡啄米的这套VS2010/MFC编程入门教程到此就全部完成了,虽然有些内容还未涉及到,但帮助大家进行VS2010/MFC的入门学习业已足够。以此教程的知识为基础,学习VS2010/MFC较为深入的内容已非难事...

weixin_40647819
05/23
0
0
再译《A *路径搜索入门》之五

■实施上的注意事项 Notes on Implementation 现在您了解了基本的方法,当你编写自己的程序时,有一些额外的事情要考虑。下面给出我用C ++和Blitz Basic编写的程序,用其他语言也同样有效。 ...

放个屁
2015/06/11
0
0

没有更多内容

加载失败,请刷新页面

加载更多

TypeScript基础入门之高级类型的可辨识联合(Discriminated Unions)

转发 TypeScript基础入门之高级类型的可辨识联合(Discriminated Unions) 高级类型 可辨识联合(Discriminated Unions) 你可以合并单例类型,联合类型,类型保护和类型别名来创建一个叫做 ...

durban
21分钟前
1
0
画图工具

目标是不要让我自己摆放,那样会打断我的思路。要自己会摆放,我写字就好。 纠结对齐的我在也不会因为一个像素的问题小心翼翼的移动鼠标了。因为它对不齐你也管不了。 Graphviz https://www...

郭大鹏
21分钟前
1
0
在Visual Studio中使用GitHub(使用篇)

上一篇中已经介绍了如何在windows下安装和配置Git,并且详细说明了如何和GitHub连接。 这里就详细的说明下如何在Visual Studio中使用GitHub。这里也是一个简单的Git教程。 注:非常非常简单的...

Jokeny
22分钟前
1
0
tomcat 在liunx系统中shutdown后进程仍然存在解决办法

这个在windows下没有碰到过,因为此前跑Tomcat都是以服务而不是命令脚本的形式跑的,而且已经换了一个项目,所以暂时不考察windows下是否存在该问题。 难道是Tomcat版本问题?或者用带内存泄...

乱舞
23分钟前
1
0
区块链10年了,还未落地,它失败了吗?

几乎每个人,甚至是对通证持怀疑态度的人,都对区块链的技术有积极的看法,因为它有可能改变世界。然而,区块链技术问世已经10年了,我们仍然没有真正的用上区块链技术。 有人说,比特币是建...

linux-tao
27分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部