AI lect4
AI lect4
• A State Space. Set of all possible states where you can be.
• A Start State. The state from where the search begins.
• A Goal State. A function that looks at the current state returns
whether or not it is the goal state.
PRELIMINARIES
We need to define two things:
• Goal Formulation
Define objectives
• Problem Formulation
Define actions and states
PROBLEM FORMULATION
Four components:
• Uninformed search is one in which the search systems do not use any clues about the
suitable area but it depend on the random nature of search.
• they begins the exploration of search space (all possible solutions) synchronously,
• The search operation begins from the initial state and providing all possible next
steps arrangement until goal is reached.
• These are mostly the simplest search strategies, but they may not be suitable for
complex paths
• These algorithms are necessary for solving basic tasks or providing simple processing
before passing on the data to more advanced search algorithms that incorporate
prioritized information.
UNINFORMED SEARCH ALGORITHMS:
Toy Problems:
Vacuum World
8-puzzle
8-queens problem
BREADTH-FIRST SEARCH:
ADVANTAGES: DISADVANTAGES:
• BFS will provide a solution if any solution exists. • It requires lots of memory since each level of
• If there are more than one solutions for a given the tree must be saved into memory to
problem, then BFS will provide the minimal solution expand the next level.
which requires the least number of steps.
• It also helps in finding the shortest path in goal state,
• BFS needs lots of time if the solution is far
since it needs all nodes at the same hierarchical level away from the root node.
before making a move to nodes at lower levels. • It can be very inefficient approach for
• It is also very easy to comprehend with the help of searching through deeply layered spaces, as
this we can assign the higher rank among path types. it needs to thoroughly explore all nodes at
each level before moving on to the next
BREADTH-FIRST SEARCH:
BFS
VACCUM CLEANER
8-QUEENS PROBLEM
OTHER EXAMPLES
Real Problems
Route-Finding Problem
Robot Navigation
Automatic Assembly Sequencing
Protein Design
Internet Searching
SOLUTIONS
Initial state
Expanded nodes
PERFORMANCE
a. Branching factor b
b. Depth of the shallowest node d
c. Maximum length of any path m
PROBLEM SOLVING BY SEARCHING
• Introduction
• Solutions and Performance
• Uninformed Search Strategies
• Avoiding Repeated States
• Partial Information
• Summary
BREADTH-FIRST SEARCH
Properties:
Complete (if b and d are finite)
Optimal (if path cost increases with depth)
Cost is O(bd+1)
SEARCH
UNIFORM-COST SEARCH
Properties:
Complete (if b and d are finite)
Optimal (if path cost increases with depth)
Cost is O(b c*/e)
Could be worse than breadth first search
SEARCH
DEPTH-FIRST SEARCH
Properties:
Incomplete (if L < d)
nonoptimal (if L > d)
Time complexity is O(bL)
Space complexity is O(bL)
Parameters BFS DFS
Stands for BFS stands for Breadth First Search. DFS stands for Depth First Search.
BFS(Breadth First Search) uses Queue data DFS(Depth First Search) uses Stack data
Data Structure structure for finding the shortest path. structure.
Conceptual Difference BFS builds the tree level by level. DFS builds the tree sub-tree by sub-tree.
It works on the concept of FIFO (First In First It works on the concept of LIFO (Last In First
Approach used Out). Out).
BFS is more suitable for searching vertices DFS is more suitable when there are
Suitable for closer to the given source. solutions away from source.
Properties:
Complete (if b and d are finite)
Optimal if path cost increases with depth
Time complexity is O(bd)
SEARCH