AI
AI
• AO* algorithm is a best first search algorithm. AO* algorithm uses the
concept of AND-OR graphs to decompose any complex problem given
into smaller set of problems which are further solved. AND-OR graphs
are specialized graphs that are used in problems that can be broken
down into sub problems where AND side of the graph represent a set
of task that need to be done to achieve the main goal , whereas the
or side of the graph represent the different ways of performing task to
achieve the same main goal.
• Working of AO* algorithm:
• The AO* algorithm works on the formula given below :
f(n) = g(n) + h(n)
where,
• g(n): The actual cost of traversal from initial state to the current
state.
• h(n): The estimated cost of traversal from the current state to the
goal state.
• f(n): The actual cost of traversal from the initial state to the goal
state.
• Now, to get a better idea of the AO* algorithm lets take a
look at an example.
Example-
• Step-1
Starting from node A, we first calculate the best
path.
f(A-B) = g(B) + h(B) = 1+4= 5 , where 1 is the
default cost value of travelling from A to B and 4
is the estimated cost from B to Goal state.
f(A-C-D) = g(C) + h(C) + g(D) + h(D) = 1+2+1+3
= 7 , here we are calculating the path cost as
both C and D because they have the AND-Arc.
The default cost value of travelling from A-C is 1,
and from A-D is 1, but the heuristic value given
for C and D are 2 and 3 respectively hence
making the cost as 7.
• Step-2
• Using the same formula as step-1, the path is now
calculated from the B node,
• f(B-E) = 1 + 6 = 7.
• f(B-F) = 1 + 8 = 9
• Hence, the B-E path has lesser cost. Now the heuristics
have to be updated since there is a difference between
actual and heuristic value of B. The minimum cost path
is chosen and is updated as the heuristic , in our case
the value is 7. And because of change in heuristic of B
there is also change in heuristic of A which is to be
calculated again.
• f(A-B) = g(B) + updated((h(B)) = 1+7=8
Step-3
Comparing path of f(A-B) and f(A-C-D) it is seen that f(A-C-D) is
smaller. Hence f(A-C-D) needs to be explored.
Now the current node becomes C node and the cost of the path
is calculated,
f(C-G) = 1+2 = 3
f(C-H-I) = 1+0+1+0 = 2
f(C-H-I) is chosen as minimum cost path,also there is no change
in heuristic since it matches the actual cost. Heuristic of path of
H and I are 0 and hence they are solved, but Path A-D also needs
to be calculated , since it has an AND-arc.
f(D-J) = 1+0 = 1, hence heuristic of D needs to be updated to 1.
And finally the f(A-C-D) needs to be updated.
f(A-C-D) = g(C) + h(C) + g(D) + updated((h(D)) = 1+2+1+1 =5.