0% found this document useful (0 votes)
95 views53 pages

5 Uninformed Search

Here is the order of node visits and paths returned by BFS, DFS, and UCS: BFS: - Visits nodes level by level, starting with nodes closest to the root node - Returns the shortest path DFS: - Visits nodes by going as deep as possible along each branch before backtracking - Does not return the shortest path UCS: - Visits nodes with the lowest path cost first - Returns the lowest cost path, which is optimal if path costs are consistent
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)
95 views53 pages

5 Uninformed Search

Here is the order of node visits and paths returned by BFS, DFS, and UCS: BFS: - Visits nodes level by level, starting with nodes closest to the root node - Returns the shortest path DFS: - Visits nodes by going as deep as possible along each branch before backtracking - Does not return the shortest path UCS: - Visits nodes with the lowest path cost first - Returns the lowest cost path, which is optimal if path costs are consistent
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/ 53

Artificial Intelligence

Lecture 5:
Uniformed Search

Tauseef Iftikhar

Punjab University College of Information Technology


Lahore.
Today’s Agenda

Recap

Uninformed Search
Recap

I Goal-base agents
I Problem Solving
I Goal formulation
I Problem formulation
I Problem formulation
I Initial state
I Actions
I Transition model
I Goal test
I Path cost
I State space vs Search space
I Search space regions
I Explored
I Frontier
I Unexplored
Recap

I Tree Search
I Graph Search
I Search Strategies Evaluation criteria
I Completeness
I Time Complexity
I Space Complexity
I Optimality
Time and space complexity are measured in terms of
I b: maximum branching factor of the search tree (actions per
state)
I d: depth of the solution
I m: maximum depth of the state space (may be ∞)
Two kind of search: uninformed and informed
Uninformed Search

I Also known as blind search.


I No additional information about states beyond that provided
in the problem definition.
I Just capable to distinguish goal state from nongoal state.
I 5 Search strategies come under the uninformed search
I Breadth-first search
I Uniform cost search
I Depth-first search
I Depth-limited search
I Iterative deepening depth-first search
Breadth-first search

All the nodes are expanded at a given depth in the search tree
before any nodes at the next level are expanded.
Breadth-first search
Breadth-first search
Breadth-first search
Breadth-first search
Evaluation of BFS
I Completeness:
Evaluation of BFS
I Completeness: Yes; if b is finite
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity:
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
I Space Complexity:
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
I Space Complexity: O(b d )
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
I Space Complexity: O(b d )
I Optimality:
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
I Space Complexity: O(b d )
I Optimality:Yes; if the path cost is a nondecreasing function
of the depth of the node.
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
I Space Complexity: O(b d )
I Optimality:Yes; if the path cost is a nondecreasing function
of the depth of the node.
How bad is BFS?
Evaluation of BFS
I Completeness: Yes; if b is finite
I Time Complexity: 1 + b + b 2 + b 3 + ... + b d = O(b d )
I Space Complexity: O(b d )
I Optimality:Yes; if the path cost is a nondecreasing function
of the depth of the node.
How bad is BFS?

Time and Memory requirements for breadth-first search for a


branching factor b=10; 1 million nodes per second; 1,000 bytes per
Depth-first Search
DFS always expand the deepest node in the frontier of the search
tree.
Depth-first Search
DFS always expand the deepest node in the frontier of the search
tree.
Depth-first Search
DFS always expand the deepest node in the frontier of the search
tree.
Depth-first Search
DFS always expand the deepest node in the frontier of the search
tree.
DFS Search
DFS Evaluation
I Completeness:
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity:
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
I Space Complexity:
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
I Space Complexity: O(bm) Linear complexity (needs to store
only a single path from the root to a leaf node, along with the
remaining unexpanded sibling nodes for each node on the
path. )
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
I Space Complexity: O(bm) Linear complexity (needs to store
only a single path from the root to a leaf node, along with the
remaining unexpanded sibling nodes for each node on the
path. )
I Optimality:
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
I Space Complexity: O(bm) Linear complexity (needs to store
only a single path from the root to a leaf node, along with the
remaining unexpanded sibling nodes for each node on the
path. )
I Optimality:No.
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
I Space Complexity: O(bm) Linear complexity (needs to store
only a single path from the root to a leaf node, along with the
remaining unexpanded sibling nodes for each node on the
path. )
I Optimality:No.
How bad is DFS?
DFS Evaluation
I Completeness: Yes; if d is finite. No in infinite search space.
I Time Complexity: 1 + b + b 2 + b 3 + ... + b m = O(b m )
I Space Complexity: O(bm) Linear complexity (needs to store
only a single path from the root to a leaf node, along with the
remaining unexpanded sibling nodes for each node on the
path. )
I Optimality:No.
How bad is DFS?

At depth 12=? , At depth 16=?


Depth-limited search

I To cope the problem of unbounded tree in depth first search,


predetermined depth limit l is used.
I However, it introduces additional source of incompleteness if
l <d
I It can be nonoptimal if l > d.
I Time complexity is O(b l ).
I Space complexity is O(bl).
Iterative deepening depth-first search

I Combines the benefit of DFS and BFS


I It find the best depth limit.
I idea: Iteratively increase the search limit until the depth of
the shallowest solution d is reached.
I Because most of the nodes are on the bottom of the search
tree, it not a big waste to iteratively re-generate the top
Iterative deepening
iterative deepening
iterative deepening
iterative deepening
Uniform cost search

I UCS expand the node n with the lowest path cost.


I It does not care about the number of steps a path has.
Uniform cost search
UCS search
UCS Evaluation

I Completeness:
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
I Time Complexity:
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
I Time Complexity:
I Let C ∗ be the cost of optimal solution.
I The effective path is roughly C ∗ /

I O(b C / )
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
I Time Complexity:
I Let C ∗ be the cost of optimal solution.
I The effective path is roughly C ∗ /

I O(b C / )
I Space Complexity:
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
I Time Complexity:
I Let C ∗ be the cost of optimal solution.
I The effective path is roughly C ∗ /

I O(b C / )
∗ /
I Space Complexity: O(b C )
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
I Time Complexity:
I Let C ∗ be the cost of optimal solution.
I The effective path is roughly C ∗ /

I O(b C / )
∗ /
I Space Complexity: O(b C )
I Optimality:
UCS Evaluation

I Completeness: Yes; if cost of every step is greater than or


equal to some small positive constant .
I Time Complexity:
I Let C ∗ be the cost of optimal solution.
I The effective path is roughly C ∗ /

I O(b C / )

I Space Complexity: O(b C / )
I Optimality:Yes, with same condition as for completeness
Exercise

What is the order of the visit of the nodes and the path returned
by BFS, DFS and UCS

You might also like