You are on page 1of 24

Informed Search Algorithms

I
Best First Search / Greedy Search
A* Search Algorithm
Uninformed Vs Informed
• Uninformed • Informed
• Uses a problem specific heuristic
• Worked only on function h(n) - estimated cost of
the cheapest path from the state at
problem definition node n to a goal state.
• Node selection • Node selection based on evaluation
function f(n)
based on path cost
• Informed search algorithms
g(n) / other criteria • Best First Search / Greedy search
• f(n) = h(n)
• A*
• f(n) = h(n) + g(n)
Generic Best First Search

• Select node for expansion according to


an evaluation function f(n)
Greedy Search / Best First Search
• Expand the node closest to the goal (f(n) = h(n))
• Examples of h(n)
• Route finding problem heuristic function for a node –
Straight line distance between the node and the goal node
• Sliding puzzle problem heuristics
• Number of tiles which are not in position
• Sum of distances between the actual position of the tiles to the
positions in the goal
Greedy search - Example Route Finding

Initial Node

Goal Node
Greedy search - Example Route Finding
• Heuristic function
Solution

Initial Node

Goal Node
Performance Measures - Completeness
• Completeness
• Tree search - Initial Node
Incomplete Infinite loop
even in finite Goal Node
state spaces
• Graph search –
complete in
finite spaces,
incomplete in
infinite ones
Performance Measure – Optimality

Not optimal
Initial Node

Optimal Path Greedy search path

Goal Node
Performance measure of greedy search

• Time and search complexity – O(bm)


• Depends on problem and quality of heuristic
A* search (A star search)
• Choose node n that has minimum path cost, heuristic
sum (f(n) = g(n)+h(n))
• Since
• g(n) – path from start node to node n
• h(n) – estimated cost of the cheapest path from n to goal,
f(n) estimated cost of the cheapest solution through n
Identical to Uniform Cost Search except that A* uses g+h
instead of g.
A* Algorithm
Performance measures for A*
• Completeness
• Complete for optimal goal cost less than or equal to C* (step costs exceed
some finite value ε and branching factor b is finite
• Optimality
• Tree search
• Optimal when heuristic function used is admissible
• Admissible heuristic never overestimates the cost to reach the goal (optimalistic i.e
value lesser than the actual cost n’
• Graph search
• Optimal when heuristic function used in consistent
C(n, a, n’) h(n’)
• Consistent heuristic satisfies the following condition
n
h(n)
Goal node
• Admissible heuristic
• Consistent heuristic
• h(n) <= minimal cost to reach the goal from n
• h(n) <= cost(n, c) + h(c)
• h(1) <= 4
• h(1) <= cost(1,2)+h(2)
• h(2) <= 3
• h(1) <= 1 + h(2)
• h(3) <= 0
• h(2) <= cost(2,3) + h(3)
• h(2) <= 3 + h(3)

Admissible, non consistent heuristic


Goal
h(A) > 1 + h(C)
h(C) <= 3 h(G) = 0
Performance measures for A*
• Time complexity
• Number of states to be visited are exponential
• For problems with constant step costs, growth in run time in terms of
d is analysed in depth of absolute error (Δ ≡ h∗ − h) or relative error of
the heuristic (ε = (h∗ − h)/h∗)
• For a single goal state space which is a tree with reversible actions
O(bΔ).
• For constant step costs O(bεd) making relative branching factor bε
• For state space with multiple goals there is an extra cost proportional
to the number of goals whose cost is within ε of the original cost
• Space complexity
• Exponential space complexity (Depends of heuristic. Worst case O(bd))
Features of A*
• Optimally efficient
• Does not expand any node that has f-cost
greater the optimal cost to reach the goal
(f(n) > C*) (optimal among all algorithms for
a given heuristic)
• State space can be segmented into
elliptical contours based on f-cost
• A contour of a f-cost F value contains nodes
with f-cost lesser than the f-cost F
• With more accurate heuristic the contours
are more focussed to the goal as nodes Map of Romania showing contours at f = 380, f = 400, and f =
with higher f-cost are pruned 420, with Arad as the start state. Nodes inside a given contour
have f-costs less than or equal to the contour value.
• For uniform cost search the contours are
circular
Main draw back
• All generated nodes are kept in the memory (as
Graph search algorithms)
• Not suitable for large scale problems
• Solution: Memory bounded heuristic search
algorithms, Iterative Deepening A*
Variants of the informed search algorithms
• Iterative Deepening A* - Similar to Iterative deepening Depth First
Search. Iterations for increasing limit on f-cost with each iterations
performing a depth first search
• Recursive Best First Search – Recursive design similar to the recursive
design of the Depth First Search algorithm
• IDA*, RBFS – Uses too little memory
• Algorithms the effectively use the available memory
• Memory Bounded A*
• Simplified memory bounded A*
Exercise
• FIND THE SOLUTION USING Greedy Search / BFS AND A* GRAPH SEARCH
ALGORITHMS (S-START NODE, G – GOAL NODE, EDGES – PATH COST)

You might also like