HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, fringe search is a graph search algorithm that finds the least-cost path from a given initial
node In general, a node is a localized swelling (a "knot") or a point of intersection (a vertex). Node may refer to: In mathematics * Vertex (graph theory), a vertex in a mathematical graph * Vertex (geometry), a point where two or more curves, line ...
to one
goal node In computer science, a goal node is a node in a graph that meets defined criteria for success or termination. Heuristical artificial intelligence algorithms, like A* and B*, attempt to reach such nodes in optimal time by defining the distance ...
. In essence, fringe search is a middle ground between A* and the iterative deepening A* variant (IDA*). If ''g''(''x'') is the cost of the search path from the first node to the current, and ''h''(''x'') is the
heuristic A heuristic (; ), or heuristic technique, is any approach to problem solving or self-discovery that employs a practical method that is not guaranteed to be optimal, perfect, or rational, but is nevertheless sufficient for reaching an immediat ...
estimate of the cost from the current node to the goal, then , and ''h''* is the actual path cost to the goal. Consider IDA*, which does a recursive left-to-right
depth-first search Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible alo ...
from the root node, stopping the recursion once the goal has been found or the nodes have reached a maximum value ''ƒ''. If no goal is found in the first threshold ''ƒ'', the threshold is then increased and the algorithm searches again. I.E. It iterates on the threshold. There are three major inefficiencies with IDA*. First, IDA* will repeat states when there are multiple (sometimes non-optimal) paths to a goal node - this is often solved by keeping a cache of visited states. IDA* thus altered is denoted as memory-enhanced IDA* (ME-IDA*), since it uses some storage. Furthermore, IDA* repeats all previous operations in a search when it iterates in a new threshold, which is necessary to operate with no storage. By storing the leaf nodes of a previous iteration and using them as the starting position of the next, IDA*'s efficiency is significantly improved (otherwise, in the last iteration it would always have to visit every node in the tree). Fringe search implements these improvements on IDA* by making use of a data structure that is more or less two
lists A ''list'' is any set of items in a row. List or lists may also refer to: People * List (surname) Organizations * List College, an undergraduate division of the Jewish Theological Seminary of America * SC Germania List, German rugby union ...
to iterate over the frontier or fringe of the search tree. One list ''now'', stores the current iteration, and the other list ''later'' stores the immediate next iteration. So from the root node of the search tree, ''now'' will be the root and ''later'' will be empty. Then the algorithm takes one of two actions: If is greater than the current threshold, remove ''head'' from ''now'' and append it to the end of ''later''; i.e. save ''head'' for the next iteration. Otherwise, if {{math, ''ƒ''(head) is less than or equal to the threshold, expand ''head'' and discard ''head'', consider its children, adding them to the beginning of ''now''. At the end of an iteration, the threshold is increased, the ''later'' list becomes the ''now'' list, and ''later'' is emptied. An important difference here between fringe and A* is that the contents of the lists in fringe do not necessarily have to be sorted - a significant gain over A*, which requires the often expensive maintenance of order in its open list. Unlike A*, however, fringe will have to visit the same nodes repeatedly, but the cost for each such visit is constant compared to the worst-case logarithmic time of sorting the list in A*.


Pseudocode

Implementing both lists in one doubly linked list, where nodes that precede the current node are the ''later'' portion and all else are the ''now'' list. Using an array of pre-allocated nodes in the list for each node in the grid, access time to nodes in the list is reduced to a constant. Similarly, a marker array allows lookup of a node in the list to be done in constant time. ''g'' is stored as a hash-table, and a last marker array is stored for constant-time lookup of whether or not a node has been visited before and if a cache entry is valid. init(start, goal) fringe F = s cache C
tart A tart is a baked dish consisting of a filling over a pastry base with an open top not covered with pastry. The pastry is usually shortcrust pastry; the filling may be sweet or savoury, though modern tarts are usually fruit-based, sometimes wit ...
= (0, null) flimit = h(start) found = false while (found

false) AND (F not empty) fmin = ∞ for node in F, from left to right (g, parent) = C ode f = g + h(node) if f > flimit fmin = min(f, fmin) continue if node

goal found = true break for child in children(node), from right to left g_child = g + cost(node, child) if C hild!= null (g_cached, parent) = C hild if g_child >= g_cached continue if child in F remove child from F insert child in F past node C hild= (g_child, node) remove node from F flimit = fmin if reachedgoal

true reverse_path(goal)
Reverse pseudo-code. reverse_path(node) (g, parent) = C ode if parent != null reverse_path(parent) print node


Experiments

When tested on grid-based environments typical of computer games including impassable obstacles, fringe outperformed A* by some 10 percent to 40 percent, depending on use of tiles or octiles. Possible further improvements include use of a data structure that lends itself more easily to caches.


References

* Björnsson, Yngvi; Enzenberger, Markus; Holte, Robert C.; Schaeffer, Johnathan. Fringe Search: Beating A* at Pathfinding on Game Maps. Proceedings of the 2005 IEEE Symposium on Computational Intelligence and Games (CIG05). Essex University, Colchester, Essex, UK, 4–6 April, 2005. IEEE 2005. https://web.archive.org/web/20090219220415/http://www.cs.ualberta.ca/~games/pathfind/publications/cig2005.pdf


External links

* Jesús Manuel Mager Hois's implementation of Fringe Search in C https://github.com/pywirrarika/fringesearch Graph algorithms Search algorithms