A* Search Algorithm

后端 未结 2 1707
一向
一向 2021-02-13 15:36

I would like to have something clarified with regards to the following A* Search example:

\"A*

相关标签:
2条回答
  • 2021-02-13 15:54

    This is taking the current best item, removing it, and replacing it with the expansion (inserting the new items into appropriate positions in the list). Think of it like this:

    Expand S:

    • {S,A} f = 1+5 = 6
    • {S,B} f = 2+6 = 8

    Expand A:

    • {S,A} f = 1+5 = 6
    • {S,B} f = 2+6 = 8
    • {S,A,X} f = (1+4)+5 = 10
    • {S,A,Y} f = (1+7)+8 = 16

    Expand B:

    • {S,B} f = 2+6 = 8
    • {S,A,X} f = (1+4)+5 = 10
    • {S,B,C} f = (2+7)+4 = 13
    • {S,A,Y} f = (1+7)+8 = 16
    • {S,B,D} f = (2+1)+15 = 18
    0 讨论(0)
  • 2021-02-13 16:03

    The paths are not duplicated, they simply remain as paths that the algorithm hasn't explored yet. A* works by maintaining an open set, it is the collection of nodes the algorithm knows already how to reach (and by what cost), but it hasn't tried expanding them yet.

    At each iteration the algorithm chooses a node to expand from the open set (the one with the lowest f function - the f function is the sum of the cost the algorithm already knows it takes to get to the node (g) and the the algorithm's estimate of how much it will cost to get from the node to the goal (h, the heuristic).

    http://en.wikipedia.org/wiki/A*_search_algorithm

    look at the pseudo-code there, as you can see the open set is used. So bottom line - it's not that the algorithm works by duplicating\copying\moving paths or nodes from one iteration to another - it simply does its work on the same collection of nodes (of course nodes do get added and removed from the collection).

    Hope this helps...

    0 讨论(0)
提交回复
热议问题