Unit 2
Unit 2
ML
Unit 2
QUEUE
STACK
Bidirectional Search
01/31/2025 14
• The most widely known form of best-first search is called A∗ search (pronounced
“A-star SEARCH”). 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 .
• Thus, if we are trying to find the cheapest solution, a reasonable thing to try first is
the node with the lowest value of g(n) + h(n).
• It turns out that this strategy is more than just reasonable: provided that the
heuristic function h(n) satisfies certain conditions, A∗ search is both complete and
optimal.
01/31/2025 19
• An admissible heuristic is one that never overestimates the cost to reach the goal.
• Because g(n) is the actual cost to reach n along the current path, and f(n)=g(n) +
h(n), we have as an immediate consequence that f(n) never overestimates the true
cost of a solution along the current path through n.
01/31/2025 20
• Estimated cost of reaching to goal from new position should be less than or equal to
estimated cost of reaching to goal from old position.
01/31/2025 21
Hill-Climbing Algorithm
Simulated Annealing
Game Playing
Stochastic Games