Best-first Search
Best-First Search
Definition
Best-first search is a heuristic search technique in artificial intelligence that explores a graph by expanding the most promising node chosen according to a specified rule. It uses an evaluation function to rank nodes and select the best one to explore next.
Key Concepts
- Evaluation Function (f(n)): A function that assigns a value to each node ( n ) to estimate its desirability for exploration. The node with the best (lowest) evaluation is expanded first.
- Open List: A priority queue of nodes to be evaluated, sorted by their evaluation function values.
- Closed List: A set of nodes that have already been evaluated.
- Heuristic Function (h(n)): An estimate of the cost to reach the goal from node ( n ).
- Greedy Best-First Search: A variant that uses only the heuristic function ( h(n) ) to guide the search.
Detailed Explanation
- Procedure:
- Initialize the open list with the start node and the closed list as empty.
- While the open list is not empty:
- Remove the node ( n ) with the lowest ( f(n) ) from the open list.
- If ( n ) is the goal node, return the path from the start node to ( n ).
- Generate all successors of ( n ) and calculate their ( f ) values.
- For each successor:
- If the successor is not in the open list or the closed list, add it to the open list.
- If it is already in the open list but has a higher ( f ) value, update its ( f ) value and parent pointer.
- Move ( n ) to the closed list.
- Optimality: Best-first search is not guaranteed to find the shortest path, as it focuses on exploring the most promising nodes first, which may lead to suboptimal solutions.
- Efficiency: The performance depends heavily on the heuristic function. A well-designed heuristic can significantly reduce the number of nodes expanded.
Diagrams
- Best-First Search Process:

- Evaluation Function f(n):

Links to Resources
- Best-First Search Algorithm
- Heuristic Search Techniques: Best-First Search
- Understanding Best-First Search
- Best-First Search in AI
Notes and Annotations
-
Summary of key points:
- Best-first search uses an evaluation function to prioritize nodes, expanding the most promising node first.
- It is not guaranteed to find the shortest path but can be efficient with a good heuristic.
- The algorithm maintains open and closed lists to manage explored and unexplored nodes.
-
Personal annotations and insights:
- Best-first search is particularly useful in scenarios where finding any solution quickly is more critical than finding the optimal solution.
- It provides a foundation for understanding more sophisticated algorithms like A* which combine cost and heuristic estimates.
- The choice of evaluation function ( f(n) ) and heuristic ( h(n) ) are crucial in determining the algorithm's effectiveness.