0% found this document useful (0 votes)
28 views8 pages

Assignment 2 LP-II

This document describes implementing the A* search algorithm to solve 8 puzzle game problems. It provides background on informed search strategies, heuristics functions, and the A* algorithm. It then explains how to apply A* search to solve 8 puzzle problems more efficiently than non-heuristic methods.

Uploaded by

abhinavdeokar7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

Assignment 2 LP-II

This document describes implementing the A* search algorithm to solve 8 puzzle game problems. It provides background on informed search strategies, heuristics functions, and the A* algorithm. It then explains how to apply A* search to solve 8 puzzle problems more efficiently than non-heuristic methods.

Uploaded by

abhinavdeokar7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Laboratory Practice II Third Year Computer Engineering

Answers Coding Viva Timely Total Dated Sign of


Efficiency Completion Subject Teacher
5 5 5 5 20

Date of Performance:....................................Date of Completion:..............................................

Assignment No: 2

1. Title of Assignment:

Implement A star Algorithm for 8 puzzle game search problems.


2. Prerequisite:
Basic knowledge of Graph, Tree , informed search, uninformed search, best first search etc.
3. Objective:
In this experiment, we will be able to do the following:
● To understand Informed Search Strategies.
● To make use of Graph and Tree Data Structure for implementation of Informed Search
strategies.
● Study how A star Algorithm is useful for implementation of 8 puzzle game search problems.

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

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 1


Laboratory Practice II Third Year Computer Engineering

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).

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 2


Laboratory Practice II Third Year Computer Engineering

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 3


Laboratory Practice II Third Year Computer Engineering

A* search Algorithm Advantages:


● A* search algorithm is the best algorithm than other search algorithms.
● A* search algorithm is optimal and complete.
● This algorithm can solve very complex problems.
A* search Algorithm Disadvantages:
● A* search algorithm has some complexity issues.
● 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.

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 4


Laboratory Practice II Third Year Computer Engineering

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.

There are a number of ways by which we can solve 8 puzzle problems.


● Solution without Heuristic Function
● Solution A* Algorithm

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 5


Laboratory Practice II Third Year Computer Engineering

Solution without Heuristic Function

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.

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 6


Laboratory Practice II Third Year Computer Engineering

Solution A* Algorithm

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 7


Laboratory Practice II Third Year Computer Engineering

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.

S.N.J.B’s. Late Sau. K B Jain College of Engineering, Chandwad 8

You might also like