You are on page 1of 12

Omkar Bhabal

501807
IT - Sem 7
ISL : Experiment 2

Aim: Implementation of Any AI problem using the Uninformed search


techniques.

Course Outcomes: (CO 2) Implementation of Any AI problem using the


Uninformed search techniques.
Theory: The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower[1] and
sometimes pluralized as Towers, or simply pyramid puzzle[2]) is a mathematical game
or puzzle. It consists of three rods and a number of disks of different diameters, which
can slide onto any rod. The puzzle starts with the disks stacked on one rod in order of
decreasing size, the smallest at the top, thus approximating a conical shape.
The objective of the puzzle is to move the entire stack to the last rod, obeying the
following simple rules:
1. Only one disk may be moved at a time.
2. Each move consists of taking the upper disk from one of the stacks and placing
it on top of another stack or an empty rod.
3. No disk may be placed on top of a disk that is smaller than it.
State Space
Uninformed search is a class of general-purpose search algorithms which
operates in a brute force-way. Uninformed search algorithms do not have
additional information about state or search space other than how to
traverse the tree, so it is also called blind search.
Breadth-first search (BFS) is an algorithm for searching a tree data
structure for a node that satisfies a given property. It starts at the tree root and
explores all nodes at the present depth prior to moving on to the
nodes at the next depth level. Extra memory, usually a queue, is needed to
keep track of the child nodes that were encountered but not yet explored.

Depth-first search (DFS) is an algorithm for traversing or searching tree or


graph data structures. The algorithm starts at the root node (selecting
some arbitrary node as the root node in the case of a graph) and explores as
far as possible along each branch before backtracking.

Depth-limited search (DLS) 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 be treated as it has no successor nodes.

Uniform-cost search is a searching algorithm used for traversing a weighted


tree or graph. This algorithm comes into play when a different cost is available
for each edge. The primary goal of the uniform-cost search is to find a path to
the goal node which has the lowest cumulative cost.
Uniform-cost search expands nodes according to their path costs from the root
node. It can be used to solve any graph/tree where the optimal cost is in
demand. A uniform-cost search algorithm is implemented by the priority
queue. It gives maximum priority to the lowest cumulative cost. Uniform cost
search is equivalent to the BFS algorithm if the path cost of all edges is the
same.
Code:

The key to solving a problem recursively is to recognize that it can be broken


down into a collection of smaller sub-problems, to each of which that same
general solving procedure that we are seeking applies, and the total solution is
then found in some simple way from those sub-problems' solutions. Each of these
created sub-problems being "smaller" guarantees that the base case(s) will
eventually be reached.
Output:
Conclusion:

Space Complexity Time Complexity Optimality Completeness

BFS O(bd) O(bd) Yes Yes

DFS O(bm) O(bm) No No

DLS O(bd) O(bd) Yes Yes

UCS O(bc/e) O(bc/e) Yes Yes

Successfully implemented 8 puzzle problems using BFS and DFS uninformed


search techniques.

You might also like