0% found this document useful (0 votes)
40 views20 pages

Lecture 5 Heuristic Search Strategies

The document discusses heuristic search techniques in artificial intelligence. It describes heuristic search, heuristic functions, heuristic evaluation methods like Euclidean and Manhattan distance. It also covers hill climbing techniques like simple hill climbing, steepest ascent hill climbing and stochastic hill climbing as well as problems with hill climbing.

Uploaded by

ÀbdUŁ ßaŠiŤ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views20 pages

Lecture 5 Heuristic Search Strategies

The document discusses heuristic search techniques in artificial intelligence. It describes heuristic search, heuristic functions, heuristic evaluation methods like Euclidean and Manhattan distance. It also covers hill climbing techniques like simple hill climbing, steepest ascent hill climbing and stochastic hill climbing as well as problems with hill climbing.

Uploaded by

ÀbdUŁ ßaŠiŤ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Heuristic Search Strategies

Heuristic Search Techniques in AI


• Heuristic Search is also known as:
Informed Search
Heuristic Control Strategy
• These are effective if applied correctly to the right types of tasks.
• Usually demand domain-specific information.
• Extra information need to compute preference among child nodes to explore
and expand.
• Each node has a heuristic function associated with it.
What is a Heuristic Search?
• A Heuristic is a technique to solve a problem faster than classic methods, or to
find an approximate solution when classic methods cannot.
• Tries to Solve a Problem in Minimum Number of Steps/Cost.
• A Heuristic Function takes a look at search algorithms.
At each branching step, it evaluates the available information and makes a decision on
which branch to follow.
An Estimation on the cost of getting from N-node to G-node (Goal Node)

• It does so by ranking alternatives. Example?


• The Heuristic is any device that is often effective but will not guarantee work in
every case.
Why do we need heuristics?

How to Calculate Heuristic Value?
• Euclidian Distance ( Straight Line Distance)
a

b
S G

• Manhattan Distance ( Vertical & Horizontal Distance)


1 2 3 1 3 2

4 5 6 6 5 4

7 8 8 7
Types of Heuristic Functions
• Admissible
This Function Never overestimate the cost of
reaching the goal
H(n) is always less than or equal to the actual A
cost of lowest path from N to Goal Node 1 1
1
• Non Admissible
H(B)=3 B
This Function overestimate the cost of reaching C D
the goal 3 H(C)=4 H(D)=5
H(n) is always greater than the actual cost of
H(E)=2 E
lowest path from N to Goal Node
5
2
H(F)=1 F G
Types of Heuristic Functions
• Admissible
This Function Never overestimate the cost of
reaching the goal
H(n) is always less than or equal to the actual A
cost of lowest path from N to Goal Node 1 1
1
• Non Admissible
H(B)=3 B
This Function overestimate the cost of reaching C D
the goal 3 H(C)=4 H(D)=5
H(n) is always greater than the actual cost of
H(E)=2 E
lowest path from N to Goal Node
5 3
2
H(F)=1 F G
Hill Climbing in Artificial Intelligence
• Local Search Algorithm ( Local Domain Knowledge)
• Greedy Approach (only looks to its good immediate neighbor state not beyond
that as well as moves in the direction which optimizes the cost.)
• No Backtracking
• It is a variant of the generate-and-test algorithm in which feedback from test
procedure is used to help generator to decide which direction to move in search
space.
• A node of hill climbing algorithm has two components which are state and
value.
• Always Moves In Single Direction
• If New State is better or Equal than current state then consider new state as
current state.
Types of Hill Climbing in AI
• Simple Hill Climbing
This examines one neighboring node at a time
and selects the first one that optimizes the
current cost to be the next node.
• Steepest Ascent Hill Climbing
This examines all neighboring nodes and
selects the one closest to the solution state.
• Stochastic Hill Climbing
This selects a neighboring node at random
and decides whether to move to it or examine
another.
Flow Chart of Hill
Climbing
Example of Hill Climbing Search

4 6
5
Simplest Ascent Hill Climbing A =4

g
bin
lim
• In Steepest Ascent Hill Climbing

ll C
Hi
Multiple points are checked. B=5

ple
Sim
• In Steepest Ascent Hill Climbing, A=4
Algorithms select the best among the
children states that are better than D=6
current State.
C=6
• All moves are considered and best one B=5
is selected as next state.
• Examine all the neighboring nodes and
selects nodes closet to solution as next D=6 F=3 G=8
node.
Steepest Ascent Hill Climbing
Evaluate Initial State

Flow Chart of Steepest Goal


State Yes, Solution / Quit
Ascent Hill Climbing
No
Generate All Successor

Select the best Successor as Current State

Yes, Solution / Quit

No

Better
than Yes, Solution / Quit
CS
Problems with Hill Climbing in AI
Local Maximum
A local maximum is a peak state in the landscape
which is better than each of its neighboring states,
but there is another state also present which is
higher than the local maximum.
Plateau
A plateau is the flat area of the search space in
which all the neighbor states of the current state
contains the same value, because of this algorithm
does not find any best direction to move. A
hill-climbing search might be lost in the plateau Ridge
area.
Ridge
A ridge is a special form of the local maximum. It
has an area which is higher than its surrounding
areas, but itself has a slope, and cannot be
reached in a single move.
Pure Heuristic Search
• Pure heuristic search is the simplest form of heuristic search algorithms that
expands nodes based on their heuristic value h(n).
• It maintains two lists, OPEN and CLOSED list.
CLOSED list contains those nodes which have already expanded
OPEN list, contains those nodes which have yet not been expanded.
• On each iteration, each node n with the lowest heuristic value is expanded and
generates all its successors and n is placed to the closed list.
• The algorithm continues unit a goal state is found.
• In the pure heuristic search two main algorithms will discussed which are given
below:
Best First Search Algorithm
A* Search Algorithm
Best-first Search Algorithm (Greedy Search)
• Best-first search algorithm always selects
the path which appears best at that Priority Queue (PQ) Containing Initial State
moment. Loop
• It is the combination of depth-first search If PQ = Empty Return Failure
and breadth-first search algorithms. It
uses the heuristic function and search. Else
• With the help of best-first search, at each Node Remove-First (PQ)
step, we can choose the most promising If Node = Goal
node.
Return Path from Initial to Node
• Utilize Evaluation algorithm (Function)
to decide which adjacent node is more Else
promising and than explore. Generate all successor of Node
and
• The Best first algorithm is implemented insert newly generated Node into
by the priority queue (PQ). (PQ) According to Cost Value
Open List Closed List
Best-first Search Algorithm [A] [ ]
(Straight Line Distance)
[C, B, D] [A ]

Node H(n) [B, D] [A , C ]


A→G 40
B→G 32 [F, E, B, D] [A , C ]
C→G 25
D→G 35 [E, B, D] [A , C, F ]
E→G 19
F→G 17 [G, E, B, D] [A , C, F ]
G→G 0
H→G 10 [E, B, D] [A , C, F, G ]

Path [A , C, F, G ]
Best-first Search Algorithm (Class Activity)
(Straight Line Distance)
Best-first Search Algorithm (Class Activity)
(Straight Line Distance)
• Expand the nodes of S and put in the CLOSED list
• Initialization:
Open [A, B], Closed [S]
• Iteration 1:
Open [A], Closed [S, B]
• Iteration 2:
Open [E, F, A], Closed [S, B]
Open [E, A], Closed [S, B, F]
• Iteration 3:
Open [I, G, E, A], Closed [S, B, F]
Open [I, E, A], Closed [S, B, F, G]
• Hence the final solution path will be: S----> B----->F----> G
Best-first Search Algorithm
• Time Complexity
The worst case time complexity of best first search is O(b d).
• Space Complexity
The worst case space complexity of best first search is O(b d).
Where, d is the maximum depth of the search space.
• Complete
Best-first search is also incomplete, even if the given state space is finite.
• Optimal
Best first search algorithm is not optimal.

You might also like