Fundamentals IN Artificial Intelligence & Machine Learning CSA2001
Fundamentals IN Artificial Intelligence & Machine Learning CSA2001
IN
ARTIFICIAL INTELLIGENCE & MACHINE
LEARNING
CSA2001
Dr. N. PAZHANIRAJA
MODULE DESCRIPTION
❑ Informed Search
❑ Best First Search
❑ Greedy Best First Search
❑ Recursive Best First Search
❑ Heuristic Functions
UNINFORMED SEARCH
❑ General-purpose search algorithms which operates in Brute Force-way.
❑ Do not have additional information about state or search space other than
how to traverse the tree
▪ Starts searching from the root node of the tree and expands all successor node
at the current level before moving to nodes of next level.
❑ It starts from root node and follows each path to its greatest depth node before
moving to the next path.
Space Complexity: Store only single path from the root node,
hence space complexity of DFS is equivalent to the size of the
fringe set, which is O(bm).
DEPTH-LIMITED SEARCH ALGORITHM
❑ Similar to depth-first search with a predetermined limit.
❑ Solve drawback of infinite path in the depth-first search.
❑ Node at depth limit will treat as it has no successor nodes further.
❑ Terminated with two conditions of failure:
❑ Standard failure value:
❑ it indicates that problem does not have any solution.
• Memory efficient.
• DISADVANTAGES:
• Incompleteness.
• It may not be optimal if the problem has more than one solution.
Completeness: complete if the solution is above the
depth-limit.
❑ Uniform cost search is optimal because at every state the path with the
least cost is chosen.
❑ DISADVANTAGES:
❑ DISADVANTAGES:
❑ The main drawback of IDDFS is that it repeats all the work of the previous phase.
1'st Iteration-----> A
2'nd Iteration----> A, B, C
3'rd Iteration------>A, B, D, E, C, F, G
4'th Iteration------>A, B, D, H, I, E, C, F, K, G
In fourth iteration, algorithm will find goal node.
Completeness:
This algorithm is complete is ifthe 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:
Space complexity of IDDFS will be O(bd).
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.
BIDIRECTIONAL SEARCH ALGORITHM
❑ ADVANTAGES:
❑ DISADVANTAGES:
❑ Contains an array of knowledge such as how far we are from the goal, path cost,
how to reach to goal node, etc.
❑ Knowledge help agents to explore less the search space and find more efficiently
goal node.
❑ Represented by h(n), and it calculates the cost of an optimal path between the pair of
states.
❑ OPEN list, it places nodes which have yet not been expanded, estimates how close a
state is to the goal.
❑ On each iteration, each node n with the lowest heuristic value is expanded and
generates all its successors and n is placed to the closed list.
INFORMED SEARCH ALGORITHMS
❑ A* SEARCH ALGORITHM
BEST-FIRST SEARCH ALGORITHM (GREEDY SEARCH)
❑ Selects path which appears best at that moment.
❑ We expand node which is closest to goal node and closest cost is estimated
by heuristic function f(n)= g(n).
BEST-FIRST SEARCH ALGORITHM
Step 1: Place the starting node into the OPEN list.
Step 2: If the open list is empty, stop and return failure.
Step 3: Remove the node n, from the open list which has the lowest value of h(n), and places it
in the closed list.
Step 4: Expand the node n, and generate the successors of node n.
Step 5: Check each successor of node n, and find whether any node is a goal node or not. If any
successor node is goal node, then return success and terminate the search, else proceed to step
6.
Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check if
the node has been in either open or closed list. If the node has not been in both list, then add it
to the OPEN list.
Step 7: Return to step 2.
BEST-FIRST SEARCH ALGORITHM
❑ ADVANTAGES:
❑ Switch between BFS and DFS by gaining the advantages of both the algorithms.
❑ More efficient than BFS and DFS algorithms.
❑ DISADVANTAGES:
❑ Behave as an unguided depth-first search in the worst case scenario.
❑ Get stuck in a loop as DFS.
❑ Not optimal.
Expand the nodes of S and put in the CLOSED list
Initialization: Open [A, B], Closed [S]
Iteration 1: Open [A], Closed [S, B]
Iteration 2: Open [E, F, A], Closed [S, B]
: Open [E, A], Closed [S, B, F]
Iteration 3: Open [I, G, E, A], Closed [S, B, F]
: Open [I, E, A], Closed [S, B, F, G]
Final solution path will be: S----> B----->F----> G
BEST-FIRST SEARCH ALGORITHM
❑ TIME COMPLEXITY:
❑ The worst case time complexity of greedy best first search is o(bm).
❑ SPACE COMPLEXITY:
❑ The worst case space complexity of greedy best first search is o(bm).
❑ Where, m is the maximum depth of the search space.
❑ COMPLETE:
❑ Incomplete, even if the given state space is finite.
❑ FINDS THE SHORTEST PATH THROUGH THE SEARCH SPACE USING THE
HEURISTIC FUNCTION.
STEP 2: Check if the OPEN list is empty or not, if the list is empty then return failure and stops.
STEP 3: Select the node from the OPEN list which has the smallest value of evaluation function (g+h), if
node n is goal node then return success and stop, otherwise
STEP 4: Expand node n and generate all of its successors, and put n into the closed list. For each successor
n', check whether n' is already in the OPEN or CLOSED list, if not then compute evaluation function for n'
and place into open list.
STEP 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to the back pointer
which reflects the lowest g(n') value.
❑ DISADVANTAGES:
❑ It does not always produce the shortest path as it mostly based on heuristics and approximation.
❑ The main drawback of a* is memory requirement as it keeps all generated nodes in the memory, so it
is not practical for various large-scale problems.
A* SEARCH ALGORITHM
Initialization: S, 5
Iteration1 S A, 4 , S G, 10
Iteration2 S A C, 4 , S A B, 7 , S G,
10
Iteration3 S A C G, 6 , S A C D,
11 , S A B, 7 , S G, 10
Iteration 4 will give the final result, as S A
C G it provides the optimal path with cost 6.