Assignment 2 LP-II
Assignment 2 LP-II
Assignment No: 2
1. Title of Assignment:
4. Outcome: Successfully able to implement 8 puzzle game search problem using A star Algorithm
5. Software and Hardware Requirement:
Open Source C++ Programming tool like G++/GCC, python,java and Ubuntu.
6. Relevant Theory / Literature Survey:
Informed search
● Informed search algorithm contains an array of knowledge such as how far we are from the
goal, path cost, how to reach the goal node, etc.
● This knowledge helps agents to explore less of the search space and find the goal node.
● The informed search algorithm is more useful for large search spaces.
● Informed search algorithms use the idea of heuristic, so it is also called Heuristic search
Heuristics function:
● Heuristic is a function which is used in Informed Search, and it finds the most promising
path.
● It takes the current state of the agent as its input and produces the estimation of how close
the agent is from the goal.
● The heuristic method, however, might not always give the best solution, but it guaranteed to
find a good solution in reasonable time.
● Heuristic function estimates how close a state is to the goal. It is represented by h(n), and it
calculates the cost of an optimal path between the pair of states.
● The value of the heuristic function is always positive.
A* Search Algorithm:
● A* search is the most commonly known form of best-first search.
● It uses the heuristic function h(n), and costs to reach the node n from the start state g(n).
● It has combined features of UCS and greedy best-first search, by which it solves the problem
efficiently.
● A* search algorithm finds the shortest path through the search space using the heuristic
function.
● This search algorithm expands less search tree and provides optimal results faster.
● A* algorithm is similar to UCS except that it uses g(n)+h(n) instead of g(n).
8 Puzzle Algorithm:-
The 8-puzzle problem is a puzzle invented and popularized by Noyes Palmer Chapman in the 1870s.
It is played on a 3-by-3 grid with 8 square blocks labeled 1 through 8 and a blank square. Your goal is
to rearrange the blocks so that they are in order. You are permitted to slide blocks horizontally or
vertically into the blank square.
Disadvantages
need to explore each node and in case of failure need to generate its child which is a very
time consuming as well as space consuming process.
Solution A* Algorithm
7. Questions:
Q 1: Differentiate between Best first search and A star algorithm.
Q 2: Solve this problem using A star algorithm
Q 3: What is the drawback to solve 8 Puzzle problem with a non heuristic method ?
8. Conclusion:
In This way we have studied informed search strategy, how to calculate heuristic function and
implementation of 8 puzzle game search problems using A star Algorithm.