Lecture 5, Beam Search & A Estrick
Lecture 5, Beam Search & A Estrick
Node H(n)
A→G 40
B→G 32
C→G 25
D→G 35
E→G 19
F→G 17
G→G 0
H→G 10
Beam Search
• Greedy Algorithm
• Beam search is an optimization of best-first search that reduces its memory
requirements.
• Only the most promising nodes (instead of all nodes) at each step of the search
are retained for further branching.
• Beam Search was developed in an attempt to achieve the optimal (or sub-
optimal) solution without consuming too much memory.
• Explore a Graph by expanding the most promising node in a limited set.
• What is Limited Set?
• Beam Value is also called Beta or Beam Width refers to the number of
nodes to be expand. ( Value is Given)
Beam Search Algorithm
OPEN = {initial state}
while OPEN is not empty do
1. Remove the best node from OPEN, call it n.
2. If n is the goal state, return path.
3. Create n's successors.
4. Evaluate each successor, add it to OPEN, and record its
parent.
5. If |OPEN| > ß , take the best ß nodes (according to
heuristic) and remove the others from the OPEN.
Done
Completeness of Beam Search
• In general, the Beam Search Algorithm is not
complete.
• Even given unlimited time and memory, it is
possible for the Algorithm to miss the goal
node
• A more accurate heuristic function and a larger
beam width can improve Beam Search's
chances of finding the goal. Steps
1. OPEN= {A}
• Clearly, open set becomes empty without 2. OPEN= {B,C}
3. OPEN={D,E}
finding goal node . 4. OPEN={E}
5. OPEN={}
Optimality In Beam Search
Heuristic Value of
Estimated Cost of Each Node to
Cheapest Solution Reach Goal Node
• At each point in the search space, only those node is expanded which have the
lowest value of f(n), and the algorithm terminates when the goal node is
A* Search Algorithm
Advantages:
• A* search algorithm is the best algorithm than other search algorithms.
• A* search algorithm is optimal and complete.
• This algorithm can solve very complex problems.
Disadvantages:
• It does not always produce the shortest path as it mostly based on heuristics and
approximation.
• A* search algorithm has some complexity issues.
• The main drawback of A* is memory requirement as it keeps all generated
nodes in the memory, so it is not practical for various large-scale problems.
A* Search Algorithm (Example)
• Traverse the given graph using the A*
algorithm.
• The heuristic value of all states is given
in the below table so calculate the f(n) of
each state using the formula