AI Search Algorithm
AI Search Algorithm
Artificial Intelligence
Credit: 3
By
Debanjan Pathak
Assistant Professor
KIIT University
HEURISTIC IN ARTIFICIAL INTELLIGENCE
Informed Search Algorithms
• The heuristic method, however, might not always give the best
solution, but it guaranteed to find a good solution in reasonable time.
Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic
cost should be less than or equal to the estimated cost.
Pure Heuristic Search:
2. A* Search Algorithm
Best-first Search Algorithm (Greedy Search):
• In the best first search algorithm, we expand the node which is closest
to the goal node and the closest cost is estimated by heuristic function
i.e
f(n)= g(n).
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
place it in the CLOSED list.
•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 terminate the search, else
proceed to Step 6.
•Step 6: For each successor node, the algorithm checks for evaluation function f(n), and
then check if the node has been in either the OPEN or CLOSED list. If the node has not
been in both lists, then add it to the OPEN list.
Disadvantages:
•It can behave as an unguided depth-first search in the worst-case scenario.
•It can get stuck in a loop as DFS.
•This algorithm is not optimal.
In this search example, we are using two lists which are OPEN and CLOSED Lists.
Following are the iteration for traversing the above example
Initialization: Open [A, B], Closed [S]
where
h is the consistent heuristic function
N is any node in the graph
P is any descendant of N
G is any goal node
c(N, P) is the cost of reaching node P from N
Informally, every node i will give an estimate that, accounting for the cost to reach
the next node, is always lesser than the estimate at node i+1.