Session 12 Informed Search Strategies (Heuristic Search Techniques) A Search (Minimizing The Total Estimated Solution Cost)
Session 12 Informed Search Strategies (Heuristic Search Techniques) A Search (Minimizing The Total Estimated Solution Cost)
Session 12 Informed Search Strategies (Heuristic Search Techniques) A Search (Minimizing The Total Estimated Solution Cost)
A* search
(Minimizing the total estimated solution cost)
Session Outcomes
• A* search
Greedy best-first search
•Greedy Best First search using hSLD finds a solution without ever
expanding a node that is not on the solution path; hence, its search
cost is minimal.
Greedy Best First Search(Continued….)
Algorithm:
1. Start with OPEN containing just the initial state
• At each step, it picks the most promising of the nodes that have so
far been generated but not expanded.
• Heuristic function h(n)= estimated as cost of the cheapest path from the
state at node n to a goal state, i.e., h(n)=straight line distance
• Its search cost is minimal(Search cost is very low but not lowest).
However, it is not optimal.
•The worst-case time and space complexity for the tree version is
O(dm ), where m is the maximum depth of the search space.
Greedy Best First Search(Continued….)
Example:
• Consider the following Romania map:
• Goal is to find a path from Arad to Bucharest.
Greedy Best First Search(Continued….)
Greedy Best First Search(Continued….)
Advantages:
Disadvantages:
•It evaluates nodes by combining g(n), the cost to reach the node,
and h(n), the cost to get from the node to the goal: f(n) = g(n) + h(n)
.
•Since g(n) gives the path cost from the start node to node n, and
h(n) is the estimated cost of the cheapest path from n to the goal, we
have f (n) = estimated cost of the cheapest solution through n .
Check to see if the new path is better. If so, set the parent link
and g and f’ values appropriately.
Example:
• This figure in the next slide represents the intial map of Romania.
• The values representing in red colour are heuristic values(i.e h(n)).
• The values representing in silver colour are path cost values
i.e g(n).
• The values representing in blue colour are f(n) values
i.e., f(n) = g(n) + h(n).
A* search (Continued…)
• As we know f(n)=g(n)+h(n).
• f(Arad)=f(n)=280+366=646(g(n)=280 and h(n)=366).
•f(Oradea)=f(n)=291+380=671(g(n)=291 and h(n)=380).
•f(Fagaras)=f(n)=239+176=415(g(n)=239 and h(n)=176).
•f(Rimnicu)=f(n)=220+193=413(g(n)=220 and h(n)=193).
• From these three nodes we have to choose the least f(n) value,
so f(Fagaras) is least among the nodes
A* search (Continued…)
• After expanding Fagaras node we have two nodes i.e Sibiu and
Bucharest.
• As we know f(n)=g(n)+h(n).
• f(Sibiu)=f(n)=338+253=591(g(n)=338 and h(n)=253).
• f(Buchrest)=f(n)=450+0=450(g(n)=450 and h(n)=0).
• From these three nodes we have to choose the least f(n) value,
so f(Fagaras) is least among the nodes.
A* search (Continued…)
Advantages:
Disadvantages:
• For most problems, the number of states within the goal contour
search space is still exponential in the length of the solution.
A* search (Continued…)
E (3+2)
F (3+3)
h’ underestimates h at node B
A
E (2+2)
F (1+3)
G (0+3)
h’ overestimates h at node D
Observations about A*
1. F(n)=g(n)+h(n)
2. If g=0 then F(n)=h(n), then the node that seems closest to the goal will
be chosen (and it becomes GBFS).
3. If g=1 and h=0 then the path involving fewest number of steps will be
chosen.