Module_3_L2_Search_Methods
Module_3_L2_Search_Methods
Quick Recap
BFS DFS
Queue Stack
Uninformed Search / Blind Search
ALEX
Uninformed
Search / Blind Depth First Search
Search
Uniform Cost
Search
Search Algorithms
A* Search
Informed Search /
Heuristic Search
Best First Search
Algorithm(Greedy
search)
Adversarial Search
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
Priority Queue:
[A(1), B(3), C(5)]
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
4 G
Exploring A
Priority Queue:
[B(3), C(5), G(4)]
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
3 5
4 G 8 F
Exploring B
Priority Queue:
[C(5), G(4), F(8)]
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
3 5
4 G 8 F
Exploring G
Priority Queue:
[C(5), F(8)]
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
3 5 2
4 G 8 F 7 E
Exploring C
Priority Queue:
[F(8), E(7)]
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
3 5 2
4 G 8 F 7 E
1
Exploring E
Priority Queue: 8 Goal
[F(8)]
Uniform Cost Search
Source
1
3 5
1 A 3 B 5 C
3 5 2
4 G 8 F 7 E
1
Path to reach Goal:
Source -> C -> E -> Goal 8 Goal
Total Cost : 8
G 2
D
1 2
1
Uniform Cost E F
5
Search C
3
4
B
1 A
Uninformed
Search / Blind Depth First Search
Search
Uniform Cost
Search
Search Algorithms
A* Search
Informed Search /
Heuristic Search
Best First Search
Algorithm(Greedy
search)
Adversarial Search
Informed Search / Heuristic Search
• Informed Search algorithms use ALEX
domain knowledge
• In an informed search, problem
information is available which
can guide the search.
• Informed search strategies can
find a solution more efficiently
than an uninformed search
strategy.
Heuristic Search
Heuristic Search
Spot the Difference!
A* algorithm
Source 11.5
10.1 A 3.5 B
Source 11.5
10.1 A 3.5 B
B F 4+2+4+3.5 =
4+2+5+5.8 = 13.5
3+4+5+7.1 = 19.1 E C 3+4+4+3.4 = 14.4
16.8
4+2+4+3.5+0 = G
13.5
FRONT
1 2
10 B
C
3 5
4 D
Goal 5
A* algorithm Problem to be solved!
Solve it using A* algorithm
f (n) = g (n) + h (n) Solve it using A* algorithm
S
Uninformed
Depth First
Search / Blind
Search
Search
Uniform Cost
Search
Search
Algorithms A* Search
Informed Search
/ Heuristic
Search Best First Search
Algorithm
Adversarial
Search
Best First Search
f (n) = h (n)
Solve it using Best First
Search
Remember,
f (n) = h (n)
Constraint Satisfaction Problem (CSP)
Constraint?
something that controls what you do by
keeping you within particular limits
Satisfaction?
fulfilment of expectations,
or needs
Constraint Satisfaction Problem (CSP)
Domain : {1,2,……,9}
Constraints :
• All the values in each row should be
from 1-9 without repetitions.
• All the values in each column
should be from 1-9 without
repetitions.
• All the values in 3X3 should also be
from 1-9 without repetitions.
Example of CSP: Map Coloring
Domains?
Red, Green, Blue
Constraints:
WA != NT, WA != SA, NT !=SA,
NT != Q, SA !=Q, Q !=NSW,
NSW !=SA, NSW != V, SA!=V
Map Coloring using Backtracking Method
Constraints:
Which Uninformed
Search method was WA != NT, WA != SA, NT !=SA,
used here? NT != Q, SA !=Q, Q !=NSW,
WA WA WA
NSW !=SA, NSW != V, SA!=V
NT NT NT
SA SA SA
Q Q Q
NT
Q
NSW NSW NSW
WA
V V V SA NSW