日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2023/12/4 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 再译《A *路径搜索入门》之四 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

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方塊。我將此作當前方

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

  • ?

    b) 到關列表。

  • 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.

    ?

    (待續)


    轉載于:https://my.oschina.net/dubenju/blog/464443

    總結

    以上是生活随笔為你收集整理的再译《A *路径搜索入门》之四的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。