0% found this document useful (0 votes)
3 views44 pages

Chapter 3 Uninformed Search

The document discusses various uninformed search strategies in artificial intelligence, including breadth-first search, depth-first search, uniform-cost search, depth-limited search, iterative deepening, and bidirectional search. It evaluates their performance based on completeness, optimality, time complexity, and space complexity, highlighting the advantages and disadvantages of each method. The document emphasizes the systematic nature of uninformed search and the trade-offs between memory efficiency and search speed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views44 pages

Chapter 3 Uninformed Search

The document discusses various uninformed search strategies in artificial intelligence, including breadth-first search, depth-first search, uniform-cost search, depth-limited search, iterative deepening, and bidirectional search. It evaluates their performance based on completeness, optimality, time complexity, and space complexity, highlighting the advantages and disadvantages of each method. The document emphasizes the systematic nature of uninformed search and the trade-offs between memory efficiency and search speed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

CH 3

UnInformed Search

CE –FH2025 – AI

Dr. Kalyani Pampattiwar


Assistant Professor
Dept. of Computer Engineering,
SIES Graduate School of Technology

1
Dr. Kalyani Pampattiwar
Uninformed Search Strategies

Uninformed strategies use only the information available in the


problem definition
Also known as blind searching

•Breadth-first search
•Uniform-cost search
•Depth-first search
•Depth-limited search
•Iterative deepening search

Dr. Kalyani Pampattiwar


Measuring problem-solving performance
The output of a problem-solving algorithm is either failure or a solution.
(Some algorithms might get stuck in an infinite loop and never return an output.)
An algorithm's performance is evaluated in four ways:
Completeness: Is the algorithm guaranteed to find a solution when there is one?
Optimality: Does the strategy find the optimal solution
Time complexity: How long does it take to find a solution?
Space complexity: How much memory is needed to perform the search?
Complexity analysis are measured in terms of
b: maximum branching factor of the search tree
d: the depth of the least cost solution in the state space.
m: maximum depth m of the state space

[Don't confuse between d and m]


d: level at which we found goal
m: depth of entire state space
3
Dr. Kalyani Pampattiwar
Uninformed Search (Blind search)

Uninformed search strategies are very systematic.

Expand nodes using the successor function and check whether state is a goal state or not.

1) Breadth First Search

Description

∙ A simple strategy in which the root is expanded first then all the root successors

are expanded next, then their successors.

∙ We visit the search tree level by level that all nodes are expanded at a given depth

before any nodes at the next level are expanded.

4
Dr. Kalyani Pampattiwar
∙ Order in which nodes are expanded.
e.g. Goal state is 11. Assume each cost path is 1. Open is maintained ad as Queue (FIFO)

5
Dr. Kalyani Pampattiwar
∙ Order in which nodes are expanded.
e.g. Goal state is 11. Assume each cost path is 1. Open is maintained ad as Queue (FIFO)

Solution is obtained at Level 3. Closed: Open


10 : 11, 12
6
Dr. Kalyani Pampattiwar
K is goal node.
Reachable? Yes. Reachable
Will you expand successor of K? No

7
Dr. Kalyani Pampattiwar
Closed Open
A
A B, C
B C, D, E
C D, E, F, G
D E, F, G
E F, G, H, I
F G, H, I
G H, I, J, K
H I, J, K, L, N, M
I J, K, L, N, M, O, P
K is goal node.
J K, L, N, M, O, P
Reachable? Yes. Reachable
K L, N, M, O, P, Q
Will you expand successor of K? No

8
Dr. Kalyani Pampattiwar
Advantages:
• BFS will provide a solution if any solution exists.
• If there are more than one solutions for a given problem, then BFS will provide the
minimal solution which requires the least number of steps.

Disadvantages:
• It requires lots of memory since each level of the tree must be saved into memory to
expand the next level.
• BFS needs lots of time if the solution is far away from the root node.

9
Dr. Kalyani Pampattiwar
Performance measure:
Complete: Yes. It always reaches goal ( if b is finite)
Time: 1+b+b2+b3+.....+bd=O(bd) This is the number of nodes we generate
Space: O(bd). Keep every generated node in memory.
Optimal: Yes (if step cost=1)
Conclusion:
Not suitable for searching large graphs. We see that space complexity
is the biggest problem for BFS than its exponential execution time.

10
Dr. Kalyani Pampattiwar
1+10+100
1+10+100+1000+10000

• The number of nodes


generated at each depth
follows the formula:

• Nodes=b^d=10^d
• b=10

11
Dr. Kalyani Pampattiwar
2) Depth-first search (DFS)
Description:
∙ DFS progresses by expanding the first child node of the search tree that appears
and thus going deeper and deeper until a goal node Is found, or until it hits a node
that has no children. Then the search backtracks, returning to the most recent node
it hasn’t finished exploring.
∙ Order in which nodes are expanded

e.g. Goal state is 11. Assume each cost path is 1. Open is maintained ad as Stack (LIFO)

Closed: Open
10 : 11, 12

12

Dr. Kalyani Pampattiwar


Ex 2:

Ex

Q is goal node

13
Dr. Kalyani Pampattiwar
Closed Open Closed Open
A I O, P, C
A B, C O P, C
B D, E, C P C
D E, C C F,G
E H, I, C F G
H L, N, M, I, C G J, K
L N, M, I, C J K
N M, I, C K Q
M I, C Q
I O, P, C

Q is goal node

14
Dr. Kalyani Pampattiwar
Performance measure

Advantage:

• DFS requires very less memory as it only needs to store a stack of the nodes on the

path from root node to the current node.

• It takes less time to reach to the goal node than BFS algorithm

(if it traverses in the right path).

Disadvantage:

• There is the possibility that many states keep re-occurring, and there is no guarantee

of finding the solution.

• DFS algorithm goes for deep down searching and sometime it may go to the

infinite loop.
15
Dr. Kalyani Pampattiwar
[Just read]Consider the scenario that there is more than one goal node, and our search

decided to first expand the left sub tree of the root where there is a solution at a very

deep level of this left sub tree, in the same time the right sub tree of the root has a

solution near the root, here comes the non-optimality of DFS that it is not guaranteed that

the first goal to find is the optimal one, so we conclude that DFS is not optimal.

16
Dr. Kalyani Pampattiwar
Performance Measure:
Complete: Not always. Fails in infinite-depth space, spaces with loops
Time: O(bm) terrible if m is much larger than d
Space: O(bm) Linear space.
Optimal: No. It may find non-optimal goal first.

Conclusion:

DFS may suffer from non-termination when the length of a path in the search tree is

infinite, so we perform DFS to a limited depth which is called Depth-limited Search.

17
Dr. Kalyani Pampattiwar
3) Uniform-cost search (UCS)

Description:

∙ Uniform-cost is guided by path cost rather than path length like in BFS, the

algorithms starts by expanding the root, then expanding the node with the

lowest cost from the root, the search continues in this manner for all nodes.

∙ Dijkstra’s algorithm, can be regarded as a variant of uniform-cost search, where

there is no goal state and processing continues until the shortest path to all

nodes has been determined.

∙ If operators have unit cost, this is same as BFS.

18
Dr. Kalyani Pampattiwar
Will discuss

19
Dr. Kalyani Pampattiwar
20
Dr. Kalyani Pampattiwar
Two important points to remember

• If node A comes in Open. And in Priority Queue if Node A is already present,

we retain node A with less cost.

• If node B already present in Closed. And in Priority Queue if Node B comes again.

We can move Node B to closed if only if is already explored in closed with more

cost. Otherwise we remove it from open without moving to closed.

21
Dr. Kalyani Pampattiwar
Advantages:

• Uniform cost search is optimal because at every state the path with the least

cost is chosen.

Disadvantages:

• It does not care about the number of steps involve in searching and only concerned

about path cost. Due to which this algorithm may be stuck in an infinite loop.

22
Dr. Kalyani Pampattiwar
• If node A comes in Open. And in Priority Queue if Node A is

already present, we retain node A with less cost.

Closed Open (Priority Queue)

D10
D10
------- 23
Dr. Kalyani Pampattiwar
• If node B already present in Closed. And in Priority Queue if Node B comes again.

We can move Node B to closed if only if is already explored in closed with more cost.

Otherwise we remove it from open without moving to closed.

Path cost between 4 to 5 is 3 ? What is the output

24
Dr. Kalyani Pampattiwar
25
Dr. Kalyani Pampattiwar
26
Dr. Kalyani Pampattiwar
Performance Measure
Completeness: Uniform-cost search is complete, such as if there is a solution,
UCS will find it.
Time Complexity:
Let C* is Cost of the optimal solution, and ε is each step to get closer to the goal node.
Then the number of steps is = C*/ε+1. Here we have taken +1, as we start from state 0 and
end to C*/ε.
Hence, the worst-case time complexity of Uniform-cost search is O(b1 + [C*/ε]).
Space Complexity: The same logic is for space complexity so, the worst-case space
complexity of Uniform-cost search is O(b1 + [C*/ε]).

Optimal: Uniform-cost search is always optimal as it only selects a path with the lowest
Path cost. [Not with –ve cost path]

27
Dr. Kalyani Pampattiwar
4) Depth Limited Search

A depth-limited search algorithm is similar to depth-first search with a predetermined limit.

Depth-limited search can solve the drawback of the infinite path in the Depth-first search.

In this algorithm, the node at the depth limit will treat as it has no successor nodes further.

Depth-limited search can be terminated with two Conditions of failure:

• Standard failure value: It indicates that problem does not have any solution.

• Cut-off failure value: It defines no solution for the problem within a given depth limit.

28
Dr. Kalyani Pampattiwar
Advantages:

Depth-limited search is Memory efficient.

Disadvantages:

• Depth-limited search also has a disadvantage of incompleteness.

• It may not be optimal if the problem has more than one solution.

29
Dr. Kalyani Pampattiwar
Example:

Limit=2

Nodes are expanded as below based on levels

Level 0: S

Level 1: S A B

Level 2: S A C D B I J

Level 3: S A C E F D G B I H J

For goal node J: S A C D B I J


30
Dr. Kalyani Pampattiwar
31
Dr. Kalyani Pampattiwar
Performance Measure

Completeness: DLS search algorithm is complete if the solution is above the depth-limit.

Time Complexity: Time complexity of DLS algorithm is O(bl).

where b is the branching factor of the search tree, and l is the depth limit.

Space Complexity: Space complexity of DLS algorithm is O(b×l).

Optimal: Depth-limited search can be viewed as a special case of DFS, and it is also not

optimal even if l>d.

32
Dr. Kalyani Pampattiwar
3) Exercise on Depth Limited Search (DLS)

Goal state G

Limit=3

33
Dr. Kalyani Pampattiwar
5) Iterative deepening depth-first Search (DFID)

Whenever the goal is near the start state, BFS were able to do it quickly. And the drawback

was, it was using up too much of space. So, one nice trade-off between space and time is to

use depth first search to do breadth first search. This is an iterative deepening.

DFS is performed, but by repeatedly using increasing depth bounds.

The iterative deepening algorithm is a combination of DFS and BFS algorithms. This search

algorithm finds out the best depth limit and does it by gradually increasing the limit until a

goal is found.

This Search algorithm combines the benefits of Breadth-first search's fast search and depth-

first search's memory efficiency. It is useful when search space is large, and depth of goal

node is unknown.
34
Dr. Kalyani Pampattiwar
Advantages:
• It combines the benefits of BFS and DFS search algorithm in terms of fast
search and memory efficiency.
Disadvantages:
• The main drawback is that that it repeats all the work of the previous phase.
Example:

1'st Iteration-----> A
2'nd Iteration----> A, B, C
3'rd Iteration------>A, B, D, E, C, F, G
In the third iteration, the algorithm will find the goal node.

35
Dr. Kalyani Pampattiwar
Performance Measure:

Completeness:

This algorithm is complete is the branching factor is finite.

Time Complexity:

Let's suppose b is the branching factor and depth is d then the worst-case time

complexity is O(bd).

Space Complexity:

The space complexity of IDDFS will be O(bd).

Optimal:

IDDFS algorithm is optimal if path cost is a non- decreasing function of the depth of the

node.
36
Dr. Kalyani Pampattiwar
6. Bidirectional Search Algorithm:

Bidirectional search algorithm runs two simultaneous searches, one form initial state

called as forward-search and other from goal node called as backward-search, to find the

goal node.

Bidirectional search replaces one single search graph with two small subgraphs in which

one starts the search from an initial vertex and other starts from goal vertex. The search

stops when these two graphs intersect each other.

Bidirectional search can use search techniques such as BFS, DFS, DLS, etc.

37
Dr. Kalyani Pampattiwar
Advantages:

• Bidirectional search is fast.

• Bidirectional search requires less memory

Disadvantages:

• Implementation of the bidirectional search tree is difficult.

• In bidirectional search, one should know the goal state in advance.

38
Dr. Kalyani Pampattiwar
Iteration
First (Level 0) A
Second (Level 1) A, B,C
Third (Level 2) A, B, D, E, C, F, G
Fourth (Level 3) A, B, D, H, I, E, J, K, C, F, G, L, M
Fifth (Level 4) A, B, D, H, I, E, J, X, Y, K, C, F, G, L, M

39
Dr. Kalyani Pampattiwar
40
Dr. Kalyani Pampattiwar
Example:

The algorithm terminates at node 9 where two searches meet.

Completeness: Bidirectional Search is complete if we use BFS in both searches.

Time Complexity: Time complexity of bidirectional search using BFS is O(bd/2).

Space Complexity: Space complexity of bidirectional search is O(bd/2).

Optimal: Bidirectional search is Optimal. When you use BFS but not in DFS 41
Dr. Kalyani Pampattiwar
42
Dr. Kalyani Pampattiwar
Iterative deepening
https://www.youtube.com/watch?v=BK8cEWKHCkY
Depth limited search
https://www.youtube.com/watch?v=P7WQUBLKDmo

Dr. Kalyani Pampattiwar


Thank You!

44
Dr. Kalyani Pampattiwar

You might also like