Ai 5
Ai 5
Artificial Intelligence
Heuristic
• Origin: from Greek Word ‘heuriskein’, means, “to discover”.
• Webster’s New World Dictionary defines Heuristic as,
“helping to discover or learn”
• As an adjective, means, serving to discover
• As noun, a heuristic is an aid to discovery.
A heuristic is a method to help solve a problem, commonly informal.
It is particularly used for a method that often rapidly leads to a
solution that is usually reasonably close to the best possible answer.
Heuristics are "rules of thumb", educated guesses, intuitive judgments
or simply common sense.
A heuristic contributes to the reduction of search in a problem-solving
activity.
Heuristic Search
• Uses domain-dependent (heuristic) information in order to
search the space more efficiently.
E 5 F 6 G4 H 3 I 6 J 4
K 7 L 8 M5 N4 O2 P 3 Q 7 R 4
D
Start A h=7 G
H
h=1 h = 10 h = 12
E
C h=5
h=8 Goal
h=0
D C B
7 + 3 = 10 6 + 2 = 8 9 + 1 = 10
E F B F E
6+5=11 8+2=10 9+4=13 6+2=8 4+5=9
D G E A 8
B 9
C 6
D 7
E 5
F 2
G 0
Distance to
destination
A* Search: An Example
Distance Travelled = g
Distance to be covered = h
f=g+h
A 8
B 9
C 6
D 7
E 5
F 2
G 0
Distance to
destination
An 8-Puzzle game
Start State Goal
2 8 3 1 2 3
1 6 4 8 4
7 5 7 6 5
2 8 3 2 8 3 2 8 3 State D
State B State C
1 6 4 1 4 1 6 4 f(D) = 1+5
f(B) = 1+5 f(C) = 1+3
7 5 7 6 5 7 5 =6
=6 =4
1 2 3 State L
8 4 f(L) = 4+1
1 2 3 State M 1 2 3 State N
7 6 5 =5
8 4 f(M) = 5+0 7 8 4 f(N) = 5+2
7 6 5 =5 6 5 =7
Hill Climbing
• Searching for a goal state = Climbing to the top
of a hill
• Generate-and-test + direction to move.
• Heuristic function to estimate how close a
given state is to a goal state.
Hill Climbing
Ways Out
• Backtrack to some earlier node and try going
in a different direction.
• Make a big jump to try to get in a new section.
• Moving in several directions at once.
Hill Climbing: Disadvantages
• Hill climbing is a local method:
Decides what to do next by looking only at the
“immediate” consequences of its choices.
• Global information might be encoded in
heuristic functions.
Hill Climbing: Example 1
8 B 13 C 11 D
4 E 3 F 7 G 5 H
2 I 1 J Goal
Hill Climbing: Example 2
Simulated Anealing
Annealing refers to a physical process that proceeds as follows: