You are on page 1of 15

Artificial Intelligence

Informed Search Strategies


Contents
 Heuristic Search
 Greedy best-first search
 A* search
Heuristic Search
 uses problem-specific knowledge beyond the definition of the
problem itself
 can find solutions more efficiently than can an uninformed
strategy
 general approach is called best-first search
 a node is selected for expansion based on an evaluation
function, f(n)
 evaluation function is a cost estimate, so the node with the
lowest evaluation is expanded first
 identical to uniform-cost search
 best-first algorithms include a component of f a heuristic
function, denoted h(n)
h(n) = estimated cost of the cheapest path from the state at node n to a goal state
Greedy best-first search
 expand the node that is closest to the goal, on the grounds
that this is likely to lead to a solution quickly
 Evaluation function: f(n) = h(n)
 route-finding problem with straight line distance heuristic
hSLD
 hSLD is correlated with actual road distances and is, therefore,
a useful heuristic
Romania Map with Costs

Values of h —straight-line distances to Bucharest


SLD

5
GBFS

6
Greedy Best-First- Analysis
 Complete – No
 From Iasi to Fagaras
 No – can get stuck in loops, e.g., Iasi -> Neamt -> Iasi ->Neamt …
 Optimal - No
 Time Complexity - O(bm)
 Space Complexity – O(bm) keeps all nodes in memory
A∗ search
 most widely known form of best-first search
 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), estimated cost of the cheapest solution through n .


 complete and optimal
 identical to Uniform Cost Search except that A∗ uses g + h
instead of g.
A* search - Demo

9
A* search - Demo

10
Conditions for optimality
 Admissibility
 admissible heuristic that never overestimates the cost to reach the
goal, i.e., it is optimistic
 A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where
h*(n) is the true cost to reach the goal state from n
 Example: hSLD(n) –straight line cannot be an overestimate

 Consistency
 A heuristic is consistent if for every node n, every successor
n' of n generated by any action a,

 Triangle inequality
 the triangle is formed by n, n', and
the goal Gn closest to n
Workout
Optimality of A*

A∗ has the following properties:


 the tree-search version of A∗ is optimal if h(n) is admissible

 the graph-search version is optimal if h(n) is consistent


A* Search Analysis
 Complete – Yes, b is finite.
 Optimal - Yes, with finite b and positive path cost
 Admissibility and Consistency
 Time Complexity - O(bd), Exponential in the length of the
solution
 Space Complexity – O(bd), keeps all nodes in memory
The End…

15

You might also like