Você está na página 1de 8

ACKNOWLEDGEMENT

I am sincerely and humbly indebted to our Department of Electronics and Computer


Engineering , Pulchowk Campus for giving us this golden opportunity for encouraging
us in to use our knowledge and prove our skills in Artificial Intelligence.
I extend my sincere gratitude to Dr.Sashidhar Ram Joshi for his encouragement and
supervision throughout the project. I would also like to thank teachers Anil Verma
and Sanjeep Prasad Pandey.

TABLE OF CONTENTS
ACKNOWLEDGEMENT ................................................................................................................ 3
ABSTRACT................................................................................................................................... 5
BACKGROUND ............................................................................................................................ 5
INTRODUCTION .......................................................................................................................... 6
SEARCHING IN AI ........................................................................................................................ 6
UNINFORMED SEARCH .............................................................................................................. 6
INFORMED SEARCH.................................................................................................................... 7
PROBLEM STATEMENT............................................................................................................... 7
METHODOLOGY ......................................................................................................................... 7
SETTING UP THE MAZE .............................................................................................................. 7
PROPAGATING CONSTRAINTS ................................................................................................ 7
SEARCH....................................................................................................................................... 7
PROBLEM FACED ........................................................................................................................ 8
FUTURE IMPLEMENTATION ....................................................................................................... 9
SCREENSHOT .............................................................................................................................. 9
REFERENCES ............................................................................................................................. 10

ABSTRACT
The field of artificial intelligence is comprised of several fascinating areas, but fundamental
to many AI-based applications is problem solving. Essentially, there are two types of
problems. The first type can be solved through the use of some sort of deterministic
procedure that is guaranteed success. In the real world, however, few problems lend
themselves to such straightforward solutions. Instead, many problems can be solved only by
searching for a solution..
The purpose of this project is to provide a clear understanding of the Search algorithm. The
user will identify the goal in the network of paths through shortest possible path. The
simulation developed in Java will be a support of a deeper analysis of the factors of the
algorithm, its potentialities and its limitations. The utilization and implementations of this
algorithm is mostly defined for ad hoc networks and travelling problem.

BACKGROUND
Early on, search applied to problems like checkers and chess misled early researchers into
under estimating the extreme difficulty of writing software that performs tasks in domains
that require general world knowledge or deal with complex and changing environments.
These types of problems usually require the understanding and then the implementation of
domain specific knowledge.

INTRODUCTION
SEARCHING IN AI
In computer science, a search algorithm, broadly speaking, is an algorithm that takes a
problem as input and returns a solution to the problem, usually after evaluating a number of
possible solutions. Most of the algorithms studied by computer scientists that solve
problems are kinds of search algorithms. The set of all possible solutions to a problem is
called the search space. Brute-force search, otherwise known as nave or uninformed ,
algorithms use the simplest method of the searching through the search space, whereas
informed search algorithms use heuristic functions to apply knowledge about the structure
of the search space to try to reduce the amount of time spent searching.

Broadly searching can be classified as:

Uninformed search

Informed(heuristic) search

UNINFORMED SEARCH
An uninformed search algorithm is one that does not take account into the specific
nature of the problem. As such, they can be implemented in general, and then the same
implementation can be used in a wide range of problems due to abstraction. The drawback
is that, in actual practice, many search spaces are extremely large, and an uninformed
search (especially of tree or graph storage structures) will take an unreasonable amount of
time for even relatively small examples.

Breadth first search


It is a graph search algorithm that begins at the root node and explores all the
neighboring nodes. Then for each of those nearest nodes, it explores their
unexplored neighbors nodes, and so on, until it finds the goal. It can be
implemented by using queue data structure.

Depth first search:


It is an algorithm for traversing or searching a tree, tree structure, or graph. One
starts at the root (selecting some node as the root in the graph case) and explores as
far as possible along each branch before backtracking. It can be implemented using
stack data structure.

INFORMED SEARCH
In an informed search, a heuristic that is specific to the problem is used as a guide. A good
heuristic will make an informed search dramatically out-performed any uninformed search.
There are few prominent informed list-search algorithms. A possible member of that
category is a hash table with a hashing function that is heuristic based on the problem at
hand. Most informed search algorithms explore trees. These include best-first search, and
A*. Like the uninformed algorithms, they can be extended to work for graphs as well.
Uniformed cost search:
It is a tree search algorithm used for traversing or searching a weighted trees, tree
structure, or graph. The search begins at the root node. The search continues by
visiting the next node which has the least total cost from the root. Nodes are visited
in this manner until a goal state is reached.
A* search:
It is a network searching algorithm that takes a distance-to-goal + path-cost score
into consideration. As it traverses the network searching all neighbors, it follows
lowest score path keeping a sorted priority queue of alternate path segments
along the way. If at any point the path being followed has a higher score than other
encountered path segments, the higher score path is abandoned and a lower score
sub-path traversed instead. This continues until the goal is reached.

PROBLEM STATEMENT
Path search: Given maze and coordinate of the goal position, pacman should navigate itself
to the goal position automatically.

METHODOLOGY
5

SETTING UP THE MAZE


The maze followed by the pacman contains obstacles. There is a fixed starting
position and the goal position. The pacman is there for tracing route tricking the obstacles.
As I found there is no universal rule for placement of obstacles. I have implemented the
placement on random basis. That means, at each run the pacman have to face the random
obstacles. So that the pacman has to find the possible shortest path along the maze. Each
cell in the Maze can be positioned as I have implemented the Dimension structure to store
the width and height of each cell.

PROPAGATING CONSTRAINTS
I have implement a Maze class for designing the required maze , obstacles
,starting and

goal positions.

For finding the path in Maze, I have implemented a

doSearchOn2DGrid() method. It simply starts from the starting location and explores the
possible grid cell from that location. The movement are restricted to on four directions (i.e
left, right, up, down). So the pacman can move with unit step in the grid. On exploring the
possible cells from its location , the method check if the explored cells have obstacles or not.
If there are obstacles, the cells will be neglected and those without obstacles will be placed
in the queue. For the already visited cell, a Flag will be set. So that , the same cell will not be
visited twice. For tracking the shortest path an array predecessor is there for storing the
location.

SEARCH
Although the Depth First Search take less memory for locating the path, the
Breadth First Search Algorithm is computationally strong.
The Algorithm is as follows:
unmark all cells in the maze
choose starting cell start_cell
mark start_cell
Queue q = start_cell
6

While q nonempty
Choose cell cell_start from front of the Queue
Visit cell_start
For each unmarked neighbor cell_neighbor of cell_start
Mark cell_neighbor
Add cell_neighbor to the end of Queue q

PROBLEM FACED
Ghost within maze was not implemented as it required more time to know about
Multithreading in Java.

FUTURE IMPLEMENTATION
The breadth first search algorithm could be used in map-routing problems.

SCREENSHOT

Start

10

11

12

13

14

15

REFERENCES
1. Artificial Intelligence and Expert Systems, Dan w. Patterson
2. The Pac-Man projects,
http://www-inst.eecs.berkeley.edu/~cs188/pacman/pacman.html

Você também pode gostar