Define Beam SearchBeam search is a heuristic search algorithm that explores a graph by expanding the most optimistic node in a limited set. Beam search is an optimization of bestfirst search that reduces its memory requirements. Bestfirst search is a graph search that orders all partial solutions according to some heuristic. But in beam search, only a predetermined number of best partial solutions are kept as candidates. Therefore, it is a greedy algorithm. Beam search uses breadthfirst search to build its search tree. At each level of the tree, it generates all successors of the states at the current level, sorting them in increasing order of heuristic cost. However, it only stores a predetermined number (β), of best states at each level called the beamwidth. Only those states are expanded next. The greater the beam width, the fewer states are pruned. No states are pruned with infinite beam width, and beam search is identical to breadthfirst search. The beamwidth bounds the memory required to perform the search. Since a goal state could potentially be pruned, beam search sacrifices completeness (the guarantee that an algorithm will terminate with a solution if one exists). Beam search is not optimal, which means there is no guarantee that it will find the best solution. In general, beam search returns the first solution found. Once reaching the configured maximum search depth (i.e., translation length), the algorithm will evaluate the solutions found during a search at various depths and return the best one that has the highest probability. The beam width can either be fixed or variable. One approach that uses a variable beam width starts with the width at a minimum. If no solution is found, the beam is widened, and the procedure is repeated. Components of Beam SearchA beam search takes three components as its input:
The problem is the problem to be solved, usually represented as a graph, and contains a set of nodes in which one or more of the nodes represents a goal. The set of heuristic rules are rules specific to the problem domain and prune unfavorable nodes from memory regarding the problem domain. The memory is where the "beam" is stored, memory is full, and a node is to be added to the beam, the most costly node will be deleted, such that the memory limit is not exceeded. Beam Search AlgorithmThe following algorithm for a beam search, as a modified bestfirst search, is adapted from Zhang's 1999: Uses of Beam SearchA beam search is most often used to maintain tractability in large systems with insufficient memory to store the entire search tree. For example,
Drawbacks of Beam SearchHere is a drawback of the Beam Search with an example:
For example, let's take the value of ß = 2 for the tree shown below. So, follow the following steps to find the goal node. Step 1: OPEN= {A} Step 2: OPEN= {B, C} Step 3: OPEN= {D, E} Step 4: OPEN= {E} Step 5: OPEN= { } The open set becomes empty without finding the goal node. NOTE: But with the value of ß = 3, the algorithm succeeds in finding the goal node.Beam Search OptimalityThe Beam Search algorithm is not complete in some cases. Therefore it is also not guaranteed to be optimal. It can happen because of these reasons:
For example, we have a tree with heuristic values shown below: Follow the following steps to find the path for the goal node. Step 1: OPEN= {A} Step 2: OPEN= {B, C} Step 3: OPEN= {C, E} Step 4: OPEN= {F, E} Step 5: OPEN= {G, E} Step 6: Found the goal node {G}, now stop. Path: A> C> F> G But the Optimal Path is A> D> G Time Complexity of Beam SearchThe time complexity of the Beam Search algorithm depends on the following things, such as:
B is the beam width, and m is the maximum depth of any path in the search tree. Space Complexity of Beam SearchThe space complexity of the Beam Search algorithm depends on the following things, such as:
B is the beam width, and m is the maximum depth of any path in the search tree.
Variants of Beam SearchBeam search has been made complete by combining it with depthfirst search, resulting in beam stack search and depthfirst beam search. With limited discrepancy search, beam search results in limited discrepancy backtracking (BULB). The resulting search algorithms are anytime algorithms that find reasonable but likely suboptimal solutions quickly, like beam search, then backtrack and continue to find improved solutions until convergence to an optimal solution. In the context of a local search, we call local beam search a specific algorithm that begins selecting β generated states. Then, for each level of the search tree, it always considers β new states among all the possible successors of the current ones until it reaches a goal. Since local beam search often ends up on local maxima, a standard solution is to choose the next β states in a random way, with a probability dependent on the heuristic evaluation of the states. This kind of search is called stochastic beam search. Other variants are flexible beam search and recovery beam search.
Next TopicPrism Formula
