A* incrementally searches all routes leading from the starting point until it finds the shortest path to a goal. Like all informed search algorithms, it searches first the routes that appear to be most likely to lead towards the goal. What sets A* apart from a greedy best-first search is that it also takes the distance already traveled into account (the g(x) part of the heuristic is the cost from the start, and not simply the local cost from the previously expanded node).
Starting with a given node, the algorithm expands the node with the lowest f(x) value—the node that has the lowest cost-per-benefit. A* maintains a set of partial solutions—unexpanded leaf nodes of expanded nodes—stored in a priority queue. The priority assigned to a path x is determined by the function f(x) = g(x) + h(x). The function continues until a goal has a lower f(x) value than any node in the queue (or until the tree is fully traversed). Multiple goals may be passed over if there is a path that may lead to a lower-cost goal.
The lower f(x), the higher the priority (so a min-heap could be used to implement the queue).
http://en.wikipedia.org/wiki/A%2A_search_algorithm
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment