0% found this document useful (0 votes)
36 views9 pages

AI 2nd Unit Engineering

Heuristic search techniques are vital in AI for efficiently solving problems by finding optimal paths in various applications like navigation and game playing. Methods such as Hill Climbing, Best First Search, and Beam Search utilize heuristics to make quick decisions, although they may not always guarantee the best solution. Each technique has its own algorithmic steps and is suited for different types of problem-solving scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views9 pages

AI 2nd Unit Engineering

Heuristic search techniques are vital in AI for efficiently solving problems by finding optimal paths in various applications like navigation and game playing. Methods such as Hill Climbing, Best First Search, and Beam Search utilize heuristics to make quick decisions, although they may not always guarantee the best solution. Each technique has its own algorithmic steps and is suited for different types of problem-solving scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Heuristic Search Techniques in AI

One of the core methods AI systems use to navigate problem-solving is through heuristic
search techniques. These techniques are essential for tasks that involve finding the best
path from a starting point to a goal state, such as in navigation systems, game playing, and
optimization problems.

Why do we need heuristics?


Heuristics are used in situations in which there is the requirement of a short-term solution. On
facing complex situations with limited resources and time, Heuristics can help the companies
to make quick decisions by shortcuts and approximated calculations. Most of the heuristic
methods involve mental shortcuts to make decisions on past experiences.

The heuristic method might not always provide us the finest solution, but it is assured that it
helps us find a good solution in a reasonable time.

Heuristic search techniques in AI (Artificial Intelligence)


o Bidirectional Search
o A* search
o Simulated Annealing
o Hill Climbing
o Best First search
o Beam search

Hill Climbing Algorithm


It is a technique for optimizing the mathematical problems. Hill Climbing is widely used
when a good heuristic is available.

It is a local search algorithm that continuously moves in the direction of increasing


elevation/value to find the mountain's peak or the best solution to the problem. It terminates
when it reaches a peak value where no neighbor has a higher value. Traveling-salesman
Problem is one of the widely discussed examples of the Hill climbing algorithm, in which we
need to minimize the distance traveled by the salesman.

It is also called greedy local search as it only looks to its good immediate neighbor state and
not beyond that. The steps of a simple hill-climbing algorithm are listed below:

Step 1: Evaluate the initial state. If it is the goal state, then return success and Stop.

Step 2: Loop Until a solution is found or there is no new operator left to apply.

Step 3: Select and apply an operator to the current state.

Step 4: Check new state:

If it is a goal state, then return to success and quit.

Else if it is better than the current state, then assign a new state as a current state.

Else if not better than the current state, then return to step2.

Step 5: Exit.

Best first search (BFS)

Best first search (BFS) is a search algorithm that functions at a particular rule and uses a

priority queue and heuristic search. It is ideal for computers to evaluate the appropriate

and shortest path through a maze of possibilities. Suppose you get stuck in a big maze

and do not know how and where to exit quickly. Here, the best first search in AI aids
your system program in evaluating and choosing the right path at every succeeding step

to reach the goal as quickly as possible.

For example, imagine playing a video game of Super Mario or Contra where you have to

reach the goal and kill the enemy. The best first search aid computer system to control

the Mario or Contra to check the quickest route or way to kill the enemy. It evaluates

distinct paths and selects the closest one with no other threats to reach your goal and kill

the enemy as fast as possible.

The best first search in artificial intelligence is an informed search that utilizes an

evaluation function to opt for the promising node among the numerous available nodes

before switching (transverse) to the next node. The best first search algorithm in AI

utilizes two lists of monitoring the transversal while searching for graph space, i.e., Open

and CLOSED. An open list monitors the immediate nodes available to transverse at the

moment. In contrast, the CLOSED list monitors the nodes being transferred already.

Best first search algorithm:

Step 1: Place the starting node into the OPEN list.

Step 2: If the OPEN list is empty, Stop and return failure.

Step 3: Remove the node n from the OPEN list, which has the lowest value of h(n), and
places it in the CLOSED list.

Step 4: Expand the node n, and generate the successors of node n.

Step 5: Check each successor of node n, and find whether any node is a goal node or not. If
any successor node is the goal node, then return success and stop the search, else continue to
next step.

Step 6: For each successor node, the algorithm checks for evaluation function f(n) and then
check if the node has been in either OPEN or CLOSED list. If the node has not been in both
lists, then add it to the OPEN list.

Step 7: Return to Step 2.


BEAM Search

BEAM Search, a variant of breadth-first Search, is an algorithm that searches a weighted


graph for an optimal path from some start node S to some goal node G. The difference
between BEAM search and breadth-first search is that at every level of the search tree, only
the top β candidates are chosen for further exploration. Here, β is known as the beam width.
The reasoning behind this is that a path from S to G is likely to pass through some top
number of most promising nodes. This leads to an algorithm that is fast and memory-efficient
because it can disregard many nodes that may appear to be too far from the goal. This,
however, sometimes causes the algorithm to overlook a potential shortest path because a
candidate node is greater than the beam width. This renders the algorithm as incomplete,
meaning that finding the shortest path is not guaranteed. Since the algorithm can find a
reasonably short path, trading completeness for efficiency is accepted.

The Algorithm
Similar to A* search, the algorithm uses an open list and a closed list for the exploration of
nodes. In this algorithm, the open list is an ordinary queue. The algorithm begins with a start
node S, which also serves as the root node for the search tree.

1. Initialize a search tree with the root node being the start node S. This is level zero in
the tree.
2. Add S to the closed list and evaluate all nodes adjacent to S.
3. Select the top β nodes and add them as child nodes to S in the tree. Disregard all other
nodes.
4. Add the selected nodes to the open list for further exploration.
5. Remove all nodes in the open list. Once a node is removed from the open list for
exploration, add it to the closed list.
6. Evaluate all adjacent nodes and sort them according to the evaluation function.
7. Select the top β nodes and add them to the tree, connecting them to their respective
parent nodes.
8. Repeat this process until the goal node G is removed from the open list, indicating
that a path has been found.

It is important to note that every level of the search tree contains at most β number of nodes.

Example
Consider the following example of searching a graph from S to G. For simplicity, only the
edge weights will be used for evaluation. A beam width of β = 2 will be used, meaning only
the top two nodes are considered at every level.
The incompleteness of this algorithm can be seen in this step. Node G has appeared in
the open list but unfortunately, it has been eliminated by the beam width. Nodes M and C are
next:
It is in this step that node G has been found:
Trace the path from S to G:
Advantages and Disadvantages
As stated before, the advantage of BEAM search is that it is efficient both in time and
memory. The disadvantage can be seen from the example in that a possible shortest path
from S to G was overlooked. This can be somewhat corrected by varying the beam width to
include more nodes. This, however, would reduce the efficiency of the algorithm. Selecting
the optimal beam width is problem-specific and usually requires further insight into the
problem.

Applications of BEAM Search


The BEAM search algorithm is commonly used in natural language processing and machine
translation. An encoder is used to process the text from the source language and BEAM
search selects the most probable words (the beam width) in the target language

You might also like