Professional Documents
Culture Documents
AO*
Problem Solving Methods – Best First Search – OR Graph
A*
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
OR
h’
A*
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
Intro • Example:
OR Promising
node
A*
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
Intro • Example:
OR
A*
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
Intro • Example:
OR
A*
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
Intro • Example:
OR
A*
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
AND -
OR
AO*
Problem Solving Methods – Best First Search – OR Graph
Intro
• OPEN: nodes that have been generated, but have not
examined.
OR
This is organized as a priority queue.
AO*
Problem Solving Methods – Best First Search – OR Graph
Intro ALGORITHM:
• OPEN = {initial state}.
• Loop until a goal is found or there are no nodes left in OPEN:
OR −Pick the best node in OPEN
−Generate its successors
−For each successor:
new →evaluate it, add it to OPEN, record its parent
A*
generated before →change parent, update successors
AND -
OR
AO*
Problem Solving Methods – A* Algorithm
AND - n
OR
g(n)
G
Node n
AO* (current node)
Best First Search - An Example
• There are cities in a country (Romania). The task is to reach from Arad to Bucharest
Best First Search - An Example
Method: Best First Search: Start from Source (Arad). At each possible outward node n from S, write the heuristic
function h(n). Proceed further in the direction in which h(n) is minimum. Repeat the exercise till goal (destination-
Bucharest ) is achieved
A* Search
Method: A* Search: Start from Source (Arad). At each possible outward n, node from S, calculate f(n)=g(n)
+h(n), where the heuristic function is h(n) and the total distance travelled so far is g(n). Proceed further in the
direction in which h(n)( is minimum. Repeat the exercise till goal (destination- Bucharest ) is achieved
A* Search
Method: A* Search: Start from Source (Arad). At each possible outward node from S, write the heuristic
function h(n). Add the total distance travelled so far g(n). Proceed further in the direction in which h(n) is
minimum. Repeat the exercise till goal (destination- Bucharest ) is achieved
A* Search Algorithm
Algorithm
Let h(n) be the heuristic function in a graph. In simple case, let it be the straight line
distance SLD from a node to destination. Let g(n) be the function depending on the
distance from source to current node. Thus f(n) = g(n) + h(n)
1. Start from source node S, determine all nodes outward from S and queue them.
2. Examine a node from queue (as generated in 1) .
* If this node is desired destination node, stop and return success.
* Evaluate f(n) at this node. The node with optimal f(n) gives the next successor,
term this node as S.
3. Repeat steps 1 and 2.
Time = O(log f(n)) where h(n) is the actual distance travelled from n to goal
Problem Solving Methods : AND – OR Graph
Problem Reduction:
Intro • Useful for representing the solution of problem by
decomposing it into smaller sub-problems.
• Each sub-problem is solved and final solution is
obtained by combining solutions of each sub-problem.
OR • Decomposition generates arcs that we will call AND arc.
• Such structure is called AND–OR graph rather than
simply AND graph.
A* • AND-OR graph solve the problem using revised cost
technique.
AO*
Steal TV Earn Money Buy TV
Problem Solving Methods : AND – OR Graph
AND-OR Graph:
Intro • For simplicity, Each arc with successor will have a cost of 1.
• Estimate cost for each node using f’ (ignore g’)
• Each node has estimated cost and revised cost.
OR • Example: Step 1
A* f’
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
AND-OR Graph:
Intro • For simplicity, Each arc with successor will have a cost of 1.
• Estimate cost for each node using f’
• Estimate revised cost by f’+1
OR • Example: Step 2
Revised
Costs. Here
A* 6 is least so
expand ‘D’
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
AND-OR Graph:
Intro • For simplicity, Each arc with successor will have a cost of 1.
• Estimate cost for each node using f’
• Example: Step 3
OR
A*
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
AND-OR Graph:
Intro • For simplicity, Each arc with successor will have a cost of 1.
• Estimate cost for each node using f’
• Example: Step 4
OR
A*
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
AND-OR Graph:
Intro • For simplicity, Each arc with successor will have a cost of 1.
• Estimate cost for each node using f’ Revised
Costs. Here
6 is least so
f’ expand ‘D’
OR
A*
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
Note:
Intro • For searching AND-OR Graph we need ‘FUTILITY’
• If f’ > FUTILITY = abandon the search
• FUTILITY correspond to threshold (it’s too expensive),
OR even if it could ever found.
• Traverse the graph using problem reduction algorithm
(refer text book) until the starting node is labeled as
‘SOLVED’.
A*
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
Operation of Problem Reduction
Intro • Use Marker (arrow) to identify the better way to finding
the goal.
OR
A*
11 11
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
Longer Path may be better!!
Intro • Consider in the below figure goal state is state E
• Successor node of J is E (Shown in fig b)
• New path E is longer than through C
OR • But, path C only lead to a solution if D has solution
• D has no solution. So, J path is better than C path.
A*
AND -
OR
AO*
Problem Solving Methods : AND – OR Graph
Limitation: Interacting Sub goals
Intro • Fails to take into account any interaction between sub goals.
Failure is shown in fig.
• Assume C and E ultimately lead to a solution.
OR • Our Algorithm will report complete solution about C and E.
• For A to be solved C and D must be solved.
• But solution of D is separate process from solution of C.
• Need to consider both but our algorithm does not
A* consider such interactions.
• It will find a non optimal path.
AND -
OR
AO*
Problem Solving Methods – AO* Algorithm
A*
AND -
OR
AO*
Problem Solving Methods – AO* Algorithm
AO*
Problem Solving Methods – AO* Algorithm
Example
Intro 1. After one cycle
A (3)
OR
B (2) C (1) D (1)
2. After two cycle
A* A (4)
Example – Cont…
Intro
OR
A*
AND -
OR
AO*
Problem Solving Methods – AO* Algorithm
Example – Cont…
Intro
OR
A*
AND -
OR
AO*
Problem Solving Methods – AO* Algorithm
Algorithm:
Intro
1. Initialise the graph to start node
2. Traverse the graph following the current path accumulating nodes
that have not yet been expanded or solved
3. Pick any of these nodes and expand it and if it has no successors
OR
call this value FUTILITY otherwise calculate only f' for each of the
successors.
4. If f' is 0 then mark the node as SOLVED
A* 5. Change the value of f' for the newly created node to reflect its
successors by back propagation.
6. Wherever possible use the most promising routes and if a node is
marked as SOLVED then mark the parent node as SOLVED.
AND - 7. If starting node is SOLVED or value greater than FUTILITY, stop,
OR else repeat from 2.
AO*
Intro
QUERIES???
OR
A*
AND -
OR
AO*
AO*
Intro
THANK YOU
OR
A*
AND -
OR
AO*
AO*
CLASS TEST 1
A*
AND -
OR
AO*
AO*