In computer science, A * (pronounced as "A star") is a computer algorithm that is widely used in line making and graph traversal, which is the process of plotting efficiently directed paths between multiple points, called "node". It enjoys widespread use because of its performance and accuracy. However, in practical travel-routing systems, it is generally outperformed by algorithms that can pre-process the graph to achieve better performance, although other work has found A * superior to other approaches.
Peter Hart, Nils Nilsson and Bertram Raphael of the Stanford Research Institute (now SRI International) first published the algorithm in 1968. This is an extension of the 1959 Edsger Dijkstra algorithm. A * achieves better performance by using heuristics to guide its search.
Video A* search algorithm
History
In 1968, AI researcher Nils Nilsson tried to improve the road planning by Shakey the Robot, a prototype robot that could navigate through an obstacle space. This search path algorithm, called Nilsson A1, is a faster version of the then best known method, Dijkstra's algorithm, to find the shortest path in the graph. Bertram Raphael suggested some significant improvements to this algorithm, calling the revised version A2. Then Peter E. Hart introduced the argument that makes A2, with only a few changes, to be the best algorithm to find the shortest path. Hart, Nilsson and Raphael then jointly developed evidence that the revised A2 algorithm is optimal to find the shortest path under certain well-defined conditions.
Maps A* search algorithm
Description
A * is the information search algorithm, or the first best search, which means that it solves the problem by searching among all possible paths to the solution (destination) for the one that incurs the smallest cost (least mileage, shortest time, etc.) , and among these paths, first consider the people who appear to lead the fastest to the solution. It is formulated in the form of a weighted graph: starting from a certain node of a graph, it builds a path tree from that node, extending the path one step at a time, until one of its paths ends at the specified destination node.
Each set of the iterasi will be used as a drop, A * perlu menentukan jalur partial mana yang akan diperluas menjadi satu atau lebih jalur yang lebih panjang. Itu melakukannya berdasarkan perkiraan biaya (total berat) masih pergi that node instantaneously. Secara khusus, A * memilih jalur yang diminimalkan
-
where n is the last node in the path, g ( n ) is the path cost from the start node to n , and h ( n ) is the heuristic that estimates the cheapest path cost from n to target. Heuristics are a special issue. In order for the algorithm to find the actual shortest path, the heuristic function must be acceptable, meaning that it never exaggerates the actual cost of reaching the nearest destination node.
A typical implementation of A * uses a priority queue to make repeated selections from the minimum cost node (estimated) to expand. This priority queue is known as open set or bangs . At each step of the algorithm, the node with the lowest value is f ( x ) removed from the queue, f and g the value of its neighbor is updated accordingly, and this neighbor is added to the queue. The algorithm continues until the destination node has a lower f value than any node in the queue (or until the queue is empty). The f value of the destination is the shortest path length, since h on the destination is zero in acceptable heuristics.
The algorithm described so far gives us only the shortest path length. To find the actual sequence of steps, the algorithm can be easily revised so that each node in the path tracks its predecessor. After this algorithm is executed, the final node will point to its predecessor, and so on, until the predecessor of some nodes is the initial node.
For example, when searching for the shortest route on the map, h ( x ) may represent a straight line distance to the destination, because it is physically the smallest possible distance between two points.
If the heuristic h meets the additional conditions h ( x ) <= d ( x , y ) h ( y ) for each side ( x , y ) of the graph (where d shows the length of that edge), then h is called monotonic, or consistent. In such a case, A * can be implemented more efficiently - speaking roughly, no nodes need to be processed more than once (see closed set below) - and A * is equivalent to running Dijkstra's algorithm with cost reduction d ' ( x , y ) = d ( x , y ) h ( y ) - h ( x ) .
Pseudocode
The following pseudocode describes the algorithm:
Description: The above pseudocode assumes that the heuristic function is monotonic (or consistent, see below), which often occurs in many practical issues, such as the Shortest Distance Path in the network path. However, if the assumption is incorrect, the node in the closed set can be rediscovered and the cost increases. In other words, closed sets can be omitted (generating tree search algorithms) if a solution is guaranteed to exist, or if the algorithm is adapted so that new nodes are added to the open set only if they have lower f values ââthan on iterations previous.
Example
An example of an A * algorithm in an action where a node is a city connected by a path and h (x) is a straight line distance to the target point:
Lock: green: start; blue: purpose; orange: visited
The A * algorithm also has real-world applications. In this example, the edges are rail and h (x) is a large-circle distance (the shortest distance possible on the ball) to the target. The algorithm is looking for a path between Washington, D.C. and Los Angeles.
src: 3.bp.blogspot.com
Properties
Seperti pencarian lebar-pertama, A * adalah lengkap dan akan selalu menemukan solusi jika ada yang menyediakan untuk fixed .
If the heuristic function is h accepted, it means never to overestimate the actual minimum cost to achieve the goal, then A * itself is acceptable (or optimal ) if we do not use the set closed. If a closed set is used, then h must also be monotonic (or consistent) for A * to be optimal. This means that for each pair of adjacent vertices x and y , where shows the length of the edge between them, we must have:
-
Dette sikrer di untuk meningkatkan bane X dari node awal ke x :
-
where L is a function indicating path length, and Y is an extended X path to include y >>. In other words, it is not possible to decrease (the total distance so far estimated by the remaining distance) by extending the path to include adjacent nodes. (This is analogous to the limitations for nonnegative edge weights in the Dijkstra algorithm.) Monotonicity implies acceptable when the heuristic estimation at each destination node itself is zero, since (let P = ( f v 2 ,..., v n , g ) becomes the shortest path from any node f to nearby destination g ):
-
A * is also efficiently optimized for each heuristic h , meaning that no optimal algorithm that uses the same heuristic will expand the node less than A *, except when there are some partial solutions where h precisely predicts optimal path cost. Even in this case, for each graph there are several sequence breaks in the priority queue such that A * checks the least node.
Custom case
Algoritma Dijkstra, sebagai contoh lain dari algoritma pencarian biaya seragam, dapat dilihat sebagai kasus khusus A * di mana untuk semua x . Pencarian kedalaman-pertama secara umum dapat diimplementasikan menggunakan A * dengan mempertimbangkan bahwa ada penghitung global C yang diinisialisasi dengan nilai yang sangat besar. Setiap kali kami memproses node, kami menetapkan C ke semua tetangganya yang baru ditemukan. Setelah setiap penugasan tunggal, kami mengurangi penghitung C demi satu. Jadi, sebelumnya sebuah node ditemukan, semakin tinggi . Algoritma Dijkstra dan pencarian depth-first dapat diimplementasikan lebih efisien tanpa menyertakan di setiap node.
Detail implementasi
There are a number of simple optimizations or implementation details that can significantly affect the performance of A * implementations. The first detail to note is how the priority queue handling relationships can have a significant effect on performance in some situations. If the bond is broken so the queue behaves LIFO, A * will behave like a first-depth search among the same cost paths (avoid exploring more than one equally optimal solution).
When a path is required at the end of a search, it's common to stick with each reference node to the parent's node. At the end of the search this reference can be used to restore the optimal path. If this reference is stored then it can be important that the same node does not appear in the priority queue more than once (each entry corresponds to a different path to the node, and each with a different charge). The standard approach here is to check if a point to be added has appeared in the priority queue. If yes, then the priority and the parent pointer are changed to fit the lower cost path. Priority queues based on standard binaries do not directly support search operations for any of its elements, but can be added with hash tables that map elements to their positions on the heap, allowing this priority drop operation to be performed at logarithmic times. Alternatively, the Fibonacci heap can perform the same priority drop operation in a constant amortized time.
src: i.ytimg.com
Admissibility A * is acceptable and considers fewer nodes than other acceptable search algorithms with the same heuristics. This is because A * uses an "optimistic" estimate of the cost path through each node it considers - optimistic that the true cost of the path through the node to the destination will be at least as large as the forecast. But, critically, as far as A * "knows," optimistic estimates are possible.
To prove the acceptance of A *, the solution path returned by the algorithm is used as follows:
When A * terminates its search, it has found its actual cost path lower than the estimated cost of any path through each open node. But since the forecast is optimistic, A * can safely ignore the knots. In other words, A * will never ignore the possibility of a lower cost path and so is acceptable.
Suppose now that some other B search algorithm stops its search with a path that does not actually cost less than the estimated cost of the path through multiple open nodes. Based on the heuristic information it possesses, Algorithm B can not rule out the possibility that the path through the node has a lower cost. So while B might consider fewer nodes than A *, that's unacceptable. Thus, A * considers the fewest nodes of an acceptable search algorithm.
This only applies if both:
- A * uses acceptable heuristics. Otherwise, A * is not guaranteed to extend fewer nodes than other search algorithms with the same heuristics.
- A * only solves one search problem from a series of similar search issues. Otherwise, A * is not guaranteed to extend fewer nodes than additional heuristics search algorithms.
Bounded relaxation
While the acceptable criteria guarantee the optimal solution path, it also means that A * should check all the same paths to serve the optimal path. To calculate the shortest path estimates, it is possible to expedite the search at the expense of optimality by loosening the acceptance criteria. Often we want to tie this relaxation, so we can guarantee that the solution path is no worse than (1 ? ) times the optimal solution path. This new guarantee is referred to as ? -confirmed.
The time complexity of A * depends on the heuristics. In the worst case of unlimited search space, the number of expanded nodes is exponential in the depth of the solution (shortest path) d : O ( b d ) , where b is a branching factor (the average number of successors per state). This assumes that the destination country exists at all, and is reachable from the initial state; if not, and the status space is unlimited, the algorithm will not stop.
Heuristic functions have a major influence on the practical performance of A * searches, because good heuristics allow A * to trim many b d nodes so incomplete search will develop. The quality can be expressed in terms of the effective branching factor b * , which can be empirically determined for example problems by measuring the number of expanded nodes, N , and the depth of the solution, then solved
-
Good heuristics are those that have a low effective bifurcation factor (optimal b * = 1 ).
Kerumitan waktu adalah polinomial ketika ruang pencarian adalah pohon, ada satu negara tuj, dan fungsi heuristik h memenuhi ketentuan berikut:
-
where h * is the optimal heuristic, the exact cost to get from x to the goal. In other words, the h error will not grow faster than the "perfect heuristic" logarithm h * actually from x to destination.
src: i1.wp.com
Apps
A * is commonly used for common pathfinding problems in applications such as games, but was originally designed as a general traversal graph algorithm. He found applications for a variety of issues, including parsing problems using stochastic grammar in NLP. Other cases include searching information with online learning.
src: i.ytimg.com
Relation to other algorithms
What sets A * apart from the first greedy search algorithm is that it takes the cost/distance it has traveled, g ( n ) , taking into account.
Beberapa varian umum dari algoritma Dijkstra dapat dilihat sebagai kasus khusus A * di mana heuristik untuk semua node; pada gilirannya, baik Dijkstra dan A * adalah kasus khusus dari pemrograman dinamis. A * sendiri adalah kasus khusus dari generalisasi cabang dan terikat dan dapat diturunkan dari algoritma primal-dual untuk pemrograman linier.
src: thumbs.dreamstime.com
Varian
- Pencarian heuristik tambahan
- Kapan Saja Memperbaiki A * (ARA *)
- Blokir A *
- D *
- Bidang D *
- Pinggiran
- Fringe Saving A * (FSA *)
- Generalized Adaptive A * (GAA *)
- IDA *
- Pencarian informasi
- Pencarian titik lompat
- Perencanaan Seumur Hidup A * (LPA *)
- Memori Sederhana dibatasi A * (SMA *)
- Theta *
- Kapan saja * *
- Waktu Nyata A *
- Kapan Saja Dinamis A *
- Time-Bounded A * (TBA *)
A * can also be adapted to a two-way search algorithm. Particular care must be taken for discontinuing criteria.
src: i.ytimg.com
See also
- Pathfinding
- Breadth-first Search
- First search
- Planning any corner path, look for unlimited paths to move along the edges of the graph but can take any angle
src: slideplayer.com
Note
src: i.ytimg.com
References
src: www.cs.bham.ac.uk
Further reading
- Hart, P. E.; Nilsson, N. J.; Raphael, B. (1972). "Correction of" Formal Heuristic Determination of the Minimum Cost Line "". SIGART Newsletter . 37 : 28-29. doi: 10.1145/1056777.1056779.
- Nilsson, N. J. (1980). Principles of Artificial Intelligence . Palo Alto, California: Tioga Publishing Company. ISBN: 0-935382-01-1.
src: i.ytimg.com
External links
- A clear visual explanation A *, with suggestions and thoughts on finding a path
- Variations in A * are called Hierarchical Path-Finding A * (HPA *)
Source of the article : Wikipedia