Heuristic Search: Unit 4
Heuristic Search: Unit 4
UNIT 4
HEURISTIC SEARCH
Taibah University_CS Dept. CS 362_ Intelligent Systems
Outline
Slide 2
4.0 Introduction
Heuristic definition
Slide 3
Heuristic is:
an AI search technique that employs heuristic for its moves.
a rule of thumb that probably leads to a solution. Heuristics
play a major role in search strategies because of exponential
nature of the most problems.
help to reduce the number of alternatives from an exponential
number to a polynomial number.
Heuristic Information
Slide 8
Hill Climbing
Slide 12
The simplest way to implement heuristic search is through a procedure called hill-climbing
(Pearl 1984).
Hill climbing (local search) is an iterative improvement algorithm that starts with an initial
state to a problem, then attempts to find the best node for the current node to follow. And
so on until goal node is found.
Hill-climbing strategies expand the current state of the search and evaluate its children.
The “best” child is selected for further expansion; neither its siblings nor its parent are
retained.
In hill climbing the basic idea is to always head towards a state which is better than the
current one.
So, if you are at town A and you can get to town B and town C (and your target is town D)
then you should make a move IF town B or C appear nearer to town D than town A does.
Taibah University_CS Dept. CS 362_ Intelligent Systems
Hill Climbing
Slide 13
Note that:
Backtracking is not permitted.
At each step in the search, a single node is chosen to follow.
The criterion for the node to follow is that it’s the best state for the current
state.
Hill climbing do not care about path from initial state to goal
In steepest ascent hill climbing you will always make your next state the best
successor of your current state, and will only make a move if that successor is
better than your current state. This can be described as follows:
1. Start with current-state = initial-state.
A. Get the successors of the current state and use the evaluation function to assign a score to
each successor.
B. 2. If one of the successors has a better score than the current-state then set the new current-
state to be the successor with the best score.
Taibah University_CS Dept. CS 362_ Intelligent Systems
Hill Climbing
Slide 14
Taibah University_CS Dept. CS 362_ Intelligent Systems
Hill Climbing
Slide 15
Taibah University_CS Dept. CS 362_ Intelligent Systems
Hill Climbing
Slide 17
BEST-FS – Example 1
Slide 26
BEST-FS – Example 1
Slide 27
BEST-FS – Example 2
Slide 28
BEST-FS – Example 2
Slide 29
tiles 2,8,1,6,5
Taibah University_CS Dept. CS 362_ Intelligent Systems
The A* Algorithm
Slide 30
If two states have the same or nearly the same heuristic evaluations, it is
generally preferable to examine the state that is nearest to the root state of the
graph.
This state will have a greater probability of being on the shortest path to the
goal.
The distance from the starting state to its descendants can be measured by
maintaining a depth count for each state.
This count is 0 for the beginning state and is incremented by 1 for each level of
the search.
This makes our evaluation function, f , the sum of two components:
f (n) = g(n) + h(n)
Where
• g(n) measures the actual length of the path from any state n to the start
state and,
• h(n) is a heuristic estimate of the distance from state n to a goal.
Taibah University_CS Dept. CS 362_ Intelligent Systems
A* Algorithm – Example
Slide 31
This is A* example
Taibah University_CS Dept. CS 362_ Intelligent Systems
A* Algorithm – Example
Slide 32
A* Algorithm – Example
Slide 33
To summarize:
Operations on states generate children of the state currently under
examination.
Each new state is checked to see whether it has occurred before (is on
either open or closed), there by preventing loops.
Each state n is given an f value equal to the sum of its depth in the
search space g(n) and a heuristic estimate of its distance to a goal
h(n). The h value guides search toward heuristically promising states
while the g value can prevent search from persisting indefinitely on a
fruitless path.
States on open are sorted by their f values. By keeping all states on
open until they are examined or a goal is found, the algorithm
recovers from dead ends.
As an implementation point, the algorithm’s efficiency can be
improved through maintenance of the open and closed lists, perhaps
as heaps or leftist trees.
Taibah University_CS Dept. CS 362_ Intelligent Systems
BEST-FS Properties
Slide 35
While h(n) (path cost from the current node to the goal node)
monotonically decreases.
Taibah University_CS Dept. CS 362_ Intelligent Systems
Admissibility Measures
Slide 38
A* algorithm
Slide 39
In this sense f(n) estimates the total cost of the path from the start
state through n to the goal state.
A* search
40
root
g(n): cost of path
A* algorithm
Slide 41
A* algorithm:
1- Start with OPEN holding the initial state
2- Pick the best node on OPEN
3- Generate its successors
4- For each successor Do
If it has not been generated before
evaluate it add it to OPEN and record
its parent
If it has been generated before change
the parent if this new path is better
and in that case update the cost of
getting to any successor nodes
5- If a goal is found or no more nodes left in
OPEN, quit, else return to 2.
Taibah University_CS Dept. CS 362_ Intelligent Systems
A* algorithm
Slide 42
A* algorithm
Slide 43
f(Arad) = c(??,Arad)+h(Arad)=0+366=366
A* algorithm Properties
Slide 59
Search techniques
Blind Heuristic
Hill
Depth first Breadth first A*
climbing
Search Search search
Search
( DFS ) ( BFS )
Best-First Greedy
Search Search
Taibah University_CS Dept. CS 362_ Intelligent Systems
MONOTONICITY
Slide 62
information provided by
evaluating c1 is
“inconsistent”
Taibah University_CS Dept. CS 362_ Intelligent Systems
Monotonicity Example
Slide 64
Taibah University_CS Dept. CS 362_ Intelligent Systems
INFORMEDNESS
Slide 65