 best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule. judea pearl described best-first search as estimating the promise of node n by a "heuristic evaluation function f(n) which, in general, may depend on the description of n, the description of the goal, the information gathered by the search up to that point, and most important, on any extra knowledge about the problem domain."pearl, j. heuristics: intelligent search strategies for computer problem solving. addison-wesley, 1984. p. 48.. pp. 94 and 95 (note 3). some authors have used "best-first search" to refer specifically to a search with a heuristic that attempts to predict how close the end of a path is to a solution, so that paths which are judged to be closer to a solution are extended first. this specific type of search is called greedy best-first search. efficient selection of the current best candidate for extension is typically implemented using a priority queue. the a* search algorithm is an example of best-first search, as is b*. best-first algorithms are often used for path finding in combinatorial search. (note that neither a* nor b* is a greedy best-first search as they incorporate the distance from start in addition to estimated distances to the goal.) == algorithm == an algorithm implementing best-first search follows.http://www.macs.hw.ac.uk/~alison/ai3notes/subsubsection2_6_2_3_2.html best first search open = [initial state] while open is not empty or until a goal is found do 1. remove the best node from open, call it n. 2. if n is the goal state, backtrace path to n (through recorded parents) and return path. 3. create n's successors. 4. evaluate each successor, add it to open, and record its parent. done note that this version of the algorithm is not complete, i.e. it does not always find a possible path between two nodes, even if there is one. for example, it gets stuck in a loop if it arrives at a dead end, that is a node with the only successor being its parent. it would then go back to its parent, add the dead-end successor to the open list again, and so on. the following version extends the algorithm to use an additional closed list, containing all nodes that have been evaluated and will not be looked at again. as this will avoid any node being evaluated twice, it is not subject to infinite loops. open = [initial state] closed = [] while open is not empty do 1. remove the best node from open, call it n, add it to closed. 2. if n is the goal state, backtrace path to n (through recorded parents) and return path. 3. create n's successors. 4. for each successor do: a. if it is not in closed and it is not in open: evaluate it, add it to open, and record its p
Search_algorithms