Beam Search is a heuristic search algorithm used in Artificial Intelligence to efficiently explore large search spaces by selecting only the most promising nodes at each level. Instead of expanding every possible path like Breadth-First Search, it keeps a limited number of best nodes based on heuristic values, making the search faster and more memory-efficient.
Uses a fixed beam width to limit node expansion
Balances efficiency and solution quality
Widely used in NLP, speech recognition, and pathfinding tasks
Characteristics
Width of the Beam (W): This parameter defines the number of nodes considered at each level. The beam width W directly influences the number of nodes evaluated and hence the breadth of the search.
Branching Factor (B): If B is the branching factor, the algorithm evaluates nodes at every depth but selects only W for further expansion.
Completeness and Optimality: The restrictive nature of beam search, due to a limited beam width, can compromise its ability to find the best solution as it may prune potentially optimal paths.
Memory Efficiency: The beam width bounds the memory required for the search, making beam search suitable for resource-constrained environments.
Working
Beam Search works by selecting only a limited number of the best nodes at each level based on heuristic values. Suppose the beam width , which means only the 2 most promising nodes are selected for further expansion at every level.