You are on page 1of 4

Roll No.

: C052 Name: SHRAVANI SAWEKAR


Class: SE-C Batch: C3
Date of Submission: 11-04-2024 Grade:

EXPERIMENT NO: 09
AIM:
To implement 15-puzzle problem using Branch and Bound technique.

THEORY:

The 15-puzzle is a sliding puzzle that consists of a 4x4 grid with 15 numbered
tiles and one empty space.The objective is to arrange the tiles in ascending order
from left to right, top to bottom, with the empty space in the bottom-right
corner.

Branch and Bound Technique:


Branch and Bound is an algorithm design paradigm that is used for
optimization problems. It involves a systematic enumeration of all possible
candidates for thesolution and then eliminating those that cannot be optimal.

ALGORITHM:

1. Start with the initial state of the puzzle.


2. Generate all possible successor states by moving the empty space (up,
down,left, right) to adjacent positions.
3. Evaluate each successor state using a heuristic function (e.g.,
Manhattandistance, misplaced tiles) to estimate its potential to lead to
a solution.
4. Choose the most promising successor state based on the heuristic value
andrecursively explore its successors.
5. Prune the search space by discarding states that are guaranteed to be
worsethan the current best solution.
6. Repeat this process until a solution is found or until all states have
beenexplored.
INPUT/OUTPUT :
OBSERVATION AND CONCLUSION:

OBSERVATION:
- State Representation: Each arrangement of the tiles on the board represents
astate. We can represent a state as a configuration of the 15 tiles.
- Goal State: The goal state is when the tiles are arranged in ascending order
withthe blank space in the bottom-right corner.
- Branching Factor: At each state, there are typically four possible moves (up,
down, left, right), but not all moves are valid depending on the position of
theblank space.
- Heuristic Function: A heuristic function can be defined to estimate the cost
fromthe current state to the goal state. For example, the Manhattan distance
can be used as a heuristic to estimate the number of moves required to reach
the goal state.

CONCLUSION:
The Branch and Bound technique can be applied to the 15-puzzle problem to
e ciently explore the state space and find the optimal solution. By using heuristics
to guide the search and pruning branches of the search tree, it can significantly
reduce the time and space complexity compared to a brute-force search.
However, the effectiveness of the technique depends on the quality of the
heuristicfunction used and the branching factor of the problem.

You might also like