You are on page 1of 16

Problem Reduction Search-

(AO* Search)
Lecture-21

Hema Kashyap

7 September 2015 1
AND/OR Search
• The Depth first search and Breadth first search given earlier for OR trees or
graphs can be easily adopted by AND-OR graph. The main difference lies
in the way termination conditions are determined, since all goals following
an AND nodes must be realized; where as a single goal node following an
OR node will do. So for this purpose we are using AO* algorithm.
• Like A* algorithm here we will use two arrays and one heuristic function.

OPEN: It contains the nodes that has been traversed but yet not been marked
solvable or unsolvable.

CLOSE: It contains the nodes that have already been processed.

h(n):The distance from current node to goal node.


The AND/OR Graph Search Problem

• Problem Definition:
– Given: [G , s , T] where
• G: implicitly specified AND/OR graph
• S: start node of the AND/OR graph
• T: set of terminal nodes
• H(n): heuristic function estimating the cost of solving
the sub- problem at n
– To find:
• A minimum cost solution tree
Algorithm
Step 1: Place the starting node into OPEN.
Step 2: Compute the most promising solution tree say T0.
Step 3: Select a node n that is both on OPEN and a member of T0.
Remove it from OPEN and place it
Step 4: If n is the terminal goal node then leveled n as solved and
leveled all the ancestors of n as solved. If the starting node is marked
as solved then success and exit.
Step 5: If n is not a solvable node, then mark n as unsolvable. If
starting node is marked as unsolvable, then return failure and exit.
Step 6: Expand n. Find all its successors and find their h (n) value, push
them into OPEN.
Step 7: Return to Step 2.
Step 8: Exit. in CLOSE
Example
An Example
(8) A
An Example
[12] A [13]
4 5
5
(1) B D (8)

(2)
C
An Example
[15] A [13]
4 5
5
(4) B 2 D (8)

(2)
C
An Example
[15] A [8]
4 5
5
(4) B 2 D (3)

(2)
C 2
4

(1) E

(0) G
An Example
[15] A [9]
4 5
5
(4) B 2 D (4)

(2)
C 2
2
4

(3) E
3

(0) G
An Example
[15] A Solved
4 5
5 Solved
(4) B 2 D

(2)
C 2
2
4

(3) E
3

(0) G Solved
Another Example
Current State = S S
f(A) = 3 + 5 = 8 3 2
f(B) = 2 + 4 = 6 4
(5) A B (4)
Current State = B 1 4
f(S) = 2 + 8 = 10
f(A) = 4 + 5 = 9 (5) C E (2)
f(C) = 1 + 5 = 6
2 3 1
f(E) = 4 + 2 = 6
(4) H (2) D F (1)
Current State = C
f(H) = 2 + 4 = 6 2
f(B) = 1 + 6 = 7
G (0)
Another Example
Current State = H
f(C) = 2 + 7 = 9 S
3 2
Current State = C
(5) 4 (4)
f(B) = 1 + 6 = 7 A B
f(H) =  1 4
Current State = B
f(S) = 2 + 8 = 10 (5) C E (2)
f(A) = 4 + 5 = 9
2 3 1
f(E) = 4 + 2 = 6
f(C) =  (2)
(4) H D F (1)
Current State = E 2
f(B) = 4 + 9 = 13
G (0)
f(D) = 3 + 2 = 5
f(F) = 1 + 1 = 2
Another Example
Current State = F
f(E) = 1 + 5 = 6 S
3 2
Current State = E (5) 4 (4)
f(D) = 3 + 2 = 5
A B
f(B) = 4 + 9 = 13
1 4
f(F) =  (2)
Current State = D
(5) C E
f(G) = 2 + 0 = 2 2 3 1
f(E) = 3 + 13 = 16
(4) H (2) D F (1)
Visited Nodes =
2
S, B, C, H, C, B, E, F, E, D, G
G (0)
Path = S, B, E, D, G
Advantages
• It is an optimal algorithm.
• If traverse according to the ordering of nodes.
• It can be used for both OR and AND graph.
Disadvantages
• Sometimes for unsolvable nodes, it can’t find
the optimal path.
• Its complexity is than other algorithms.

You might also like