ARTIFICIAL INTELLIGENCE
PANKAJ DEBBARMA
Deptt. of CSE, TIT, Narsingarh
Search Algorithms
CONTENTS
Search
Algorithms
• Search Algorithms
• Uninformed Search
• Informed Search
• Breadth First Search
• Depth First Search
• Depth Limited Search
• Iterative Deepening DFS
• Cost First Search
Search Algorithms
• Do faster computers help? If searching takes too
long, the obvious solution would appear to be to
get a faster computer (or many parallel
computers).
• Irrelevant Operators: Irrelevant operators
increase the branching factor b, and this rapidly
increases the size of the search space, bd.
• Search Order: The excessive time spent in
searching is almost entirely spent on failures.
Search Algorithms
Uninformed Search
• Search without
information
• No knowledge
• Time consuming
• More complexity (time,
space)
• DFS, BFS, etc.
Informed Search
• Search with information
• Use knowledge to find
steps
• Quick solution
• Less complexity (time,
space)
• A*, Best First Search, etc.
Search Algorithms
1
4
3
2 1 2 3 4
1
2
3
4
Travelling Salesman Problem
Constraint
Satisfaction
Means-end
Analysis
AO* Search
A* Search
Informed Search
Search algorithms
Uninformed Search
Generate and Test Hill Climbing
Breadth First
Search
Cost First
Search
Depth Limited
Search
Depth First
Search
Iterative
Deepening DFS
Problem
Reduction
Best First
Search
Breadth-first search (BFS)
• Uninformed
• FIFO (Queue data
structure)
• Shallowest node
• Complete
• Optimal
• Time Complexity
– O(V+E)
– O(bd)
A
F
D
C
E
B
G
N
J
H I
M
K L
0
2
1
4
3
Breadth-first search
Advantage:
1. Guaranteed to find an optimal solution (in terms
of shortest number of steps to reach the goal).
2. Can always find a goal node if one exists
(complete).
Disadvantage:
1. High storage requirement: exponential with tree
depth.
Depth-first search (DFS)
• Uninformed
• LIFO (Stack data
structure)
• Deepest node
• Incomplete
• Non-optimal
• Time Complexity
– O(V+E)
– O(bd)
A
F
D
C
E
B
G
N
J
H I
M
K L
0
2
1
4
3
Depth-first search
Advantage:
1. Low storage requirement: linear with tree depth.
2. Easily programmed: function call stack does most
of the work of maintaining state of the search.
Disadvantage:
1. May find a sub-optimal solution (one that is
deeper or more costly than the best solution).
2. Incomplete: without a depth bound, may not find
a solution even if one exists.
Bounded depth-first search
Problems:
1. It’s hard to guess how deep the solution lies.
2. If the estimated depth is too deep (even by 1) the
computer time used is dramatically increased, by
a factor of bextra.
3. If the estimated depth is too shallow, the search
fails to find a solution; all that computer time is
wasted.
Iterative Deepening DFS
A
F
D
C
E
B
G
N
J
H I
M
K L
d = 0
d = 1
d = 3
d = 2
d = 4
Cost first search
Note visited:
A, C, B, D, G, E, L,
I, K, H, F, J, M, N
A
F
D
C
E
B
G
N
J
H I
M
K L
4
6
3
4
3
4
3
2
7
2
3
6
1
Child B C D G H E F I L J K M N
Cost 4 3 7 7 10 7 10 9 8 11 9 12 12
AI-05 Search Algorithms.pptx

AI-05 Search Algorithms.pptx

  • 1.
    ARTIFICIAL INTELLIGENCE PANKAJ DEBBARMA Deptt.of CSE, TIT, Narsingarh Search Algorithms
  • 2.
    CONTENTS Search Algorithms • Search Algorithms •Uninformed Search • Informed Search • Breadth First Search • Depth First Search • Depth Limited Search • Iterative Deepening DFS • Cost First Search
  • 3.
    Search Algorithms • Dofaster computers help? If searching takes too long, the obvious solution would appear to be to get a faster computer (or many parallel computers). • Irrelevant Operators: Irrelevant operators increase the branching factor b, and this rapidly increases the size of the search space, bd. • Search Order: The excessive time spent in searching is almost entirely spent on failures.
  • 4.
    Search Algorithms Uninformed Search •Search without information • No knowledge • Time consuming • More complexity (time, space) • DFS, BFS, etc. Informed Search • Search with information • Use knowledge to find steps • Quick solution • Less complexity (time, space) • A*, Best First Search, etc.
  • 5.
    Search Algorithms 1 4 3 2 12 3 4 1 2 3 4 Travelling Salesman Problem
  • 6.
    Constraint Satisfaction Means-end Analysis AO* Search A* Search InformedSearch Search algorithms Uninformed Search Generate and Test Hill Climbing Breadth First Search Cost First Search Depth Limited Search Depth First Search Iterative Deepening DFS Problem Reduction Best First Search
  • 7.
    Breadth-first search (BFS) •Uninformed • FIFO (Queue data structure) • Shallowest node • Complete • Optimal • Time Complexity – O(V+E) – O(bd) A F D C E B G N J H I M K L 0 2 1 4 3
  • 8.
    Breadth-first search Advantage: 1. Guaranteedto find an optimal solution (in terms of shortest number of steps to reach the goal). 2. Can always find a goal node if one exists (complete). Disadvantage: 1. High storage requirement: exponential with tree depth.
  • 9.
    Depth-first search (DFS) •Uninformed • LIFO (Stack data structure) • Deepest node • Incomplete • Non-optimal • Time Complexity – O(V+E) – O(bd) A F D C E B G N J H I M K L 0 2 1 4 3
  • 10.
    Depth-first search Advantage: 1. Lowstorage requirement: linear with tree depth. 2. Easily programmed: function call stack does most of the work of maintaining state of the search. Disadvantage: 1. May find a sub-optimal solution (one that is deeper or more costly than the best solution). 2. Incomplete: without a depth bound, may not find a solution even if one exists.
  • 11.
    Bounded depth-first search Problems: 1.It’s hard to guess how deep the solution lies. 2. If the estimated depth is too deep (even by 1) the computer time used is dramatically increased, by a factor of bextra. 3. If the estimated depth is too shallow, the search fails to find a solution; all that computer time is wasted.
  • 12.
    Iterative Deepening DFS A F D C E B G N J HI M K L d = 0 d = 1 d = 3 d = 2 d = 4
  • 13.
    Cost first search Notevisited: A, C, B, D, G, E, L, I, K, H, F, J, M, N A F D C E B G N J H I M K L 4 6 3 4 3 4 3 2 7 2 3 6 1 Child B C D G H E F I L J K M N Cost 4 3 7 7 10 7 10 9 8 11 9 12 12