You are on page 1of 11

Informed Search

•Search efficiency would improve greatly if there is a


way to order the choices so that the most promising
are explored first.
–This requires domain knowledge of the problem.
•Add domain specific knowledge to select what is the
best one to continue searching along the path
•Define a heuristic function, h(n) that estimates the
goodness of a node n, based on domain specific
information that is computable from the current state
description.
•Heuristics is knowledge about the domain that helps to
undertake focused search
–It is rule of thumb, or guess that limits the search space
towards the goal
Example: 8- puzzle
Heuristic function, h(n)
•It is an estimate of how close we are to a goal state
•Heuristic function h(n)
h(n) = estimated cost of path from state n to a goal state.
•What good heuristic function for the following
problems:
–Route finding: straight line distance
•Note that:
–h(n) ≥ 0 for all nodes n
–h(n) = 0 if n is a goal node
–h(n) = infinity if n is a dead-end from which a goal can’t be
reached
Best first search
•It is a generic name to the class of informed methods
•Nodes are ordered in the open list so that the one
with the best evaluation (minimum cost) is expanded
first
–Evaluation function, f incorporates domain specific
information and determines the desirability of expanding the
node
–It aims to find low-cost solutions towards goal node
•There are two measures
–The use of the path cost g to decide which path to extend
further (e. g. uniform cost search).
–The use of some estimate of the cost of the path from
current state to the goal state (heuristics h)
–The first measure may not direct search towards the goal. It
needs to be supplemented by the second measure
Best First Search Approaches
•Two approaches to find the shortest path:
–Greedy search: minimizes estimated cost to reach a goal
–A*-search: minimizes the total path cost
•When expanding a node n in the search tree, greedy
search uses the estimated cost to get from the
current state to the goal state, define as h(n).
–In route finding problem h(n) is the straight-line distance
•We also possess the sum of the cost to reach that
node from the start state, define as g(n).
–In route finding problem this is the sum of the step costs for
the search path.
•For each node in the search tree, an evaluation
function f(n) can be defined as the sum of these
functions.
f(n) = g(n) + h(n)
Admissibility
• Search algorithms (such as greedy and A*- search)
are admissible when the heuristic function never over
estimated the actual cost so that
–the algorithm always terminates in an optimal path from the
initial state to goal node if one exists.
• check whether estimated cost h(n) is not
overestimated
–h*(n): Actual cost of shortest path from n to z (not known)
–h(n) is said to be an admissible heuristic function if for all n,
h(n) ≤ h*(n)
–The closer h to h* the fewer extra nodes that will be
expanded
–Using an admissible heuristics guarantees that the solution
found by searching algorithm is optimal
Greedy search
• A best first search that uses a heuristic function h(n)
alone to guide the search
–Selects node to expand that is closest (hence it’s greedy) to
a goal node
–The algorithm doesn’t take minimum path costs from initial
to current nodes into account, it just go ahead optimistically
and never looks back.
• Implementation: expand 1st the node closest to the goal
state, i.e. with evaluation function f(n) = h(n)
–h(n) = 0 if node n is the goal state
–Otherwise h(n) ≥ 0; an estimated cost of the cheapest path
from the state at node n to a goal state
Example 1: Route finding problem
Example 2: Can we arrange the search in the 8-puzzle so that
a move will minimize the distance b/n the initial state & the
goal arrangement
Exercise
Solution to Route Finding
Arad f(n) = 366

Sibiu 253 Timisoara 329 Zerind 374

Arad 366 Fagaras 176 Oradea 380 Rimnicu Vilcea 193

Bucharest 0 Sibiu 253

Is Arad  Sibiu  Fagaras  Bucharest optimal?


Total cost = 450
A*-search Algorithm
•It considers both estimated cost of getting from n to
the goal node h(n), and cost of getting from initial
node to node n, g(n)
•Apply three functions over every nodes
–g(n): Cost of path found so far from initial state to n
–h(n): Estimated cost of shortest path from n to z
–f(n): Estimated total cost of shortest path from a to z via n
–Evaluation function f(n) = h(n) + g(n)
•Implementation: Expand the node for which the evaluation
function f(n) is lowest
–Rank nodes by f(n) that goes from the start node to goal node
via given node

Example: Route finding problem


Solution to Route Finding
Arad f(n) = 0 + 366

Sibiu 393 Timisoara 447 Zerind 449


=140+253

413 =
220+193
Arad 646 Fagaras 415 Oradea 671
Rimnicu Vilcea

415
=317+98
Pitesti Craiova 573

418
=418+0 Bucharest Craiova 615 Rimnicu 607
Quiz !!
Initial State = Corvallis
Goal State = Wilson
Find the shortest path using:
Greedy Best
First search
A* Search
Show all necessary steps.

You might also like