Book Image

Hands-On Artificial Intelligence for Search

By : Devangini Patel
Book Image

Hands-On Artificial Intelligence for Search

By: Devangini Patel

Overview of this book

With the emergence of big data and modern technologies, AI has acquired a lot of relevance in many domains. The increase in demand for automation has generated many applications for AI in fields such as robotics, predictive analytics, finance, and more. In this book, you will understand what artificial intelligence is. It explains in detail basic search methods: Depth-First Search (DFS), Breadth-First Search (BFS), and A* Search, which can be used to make intelligent decisions when the initial state, end state, and possible actions are known. Random solutions or greedy solutions can be found for such problems. But these are not optimal in either space or time and efficient approaches in time and space will be explored. We will also understand how to formulate a problem, which involves looking at it and identifying its initial state, goal state, and the actions that are possible in each state. We also need to understand the data structures involved while implementing these search algorithms as they form the basis of search exploration. Finally, we will look into what a heuristic is as this decides the quality of one sub-solution over another and helps you decide which step to take.
Table of Contents (5 chapters)

Basic search concepts

To understand the functionality of search algorithms, we first need to understand basic searching concepts, such as the state, the ingredients of a search, and the nodes:

  • State: The state is defined as the space where the search process takes place. It basically answers the question—what are we searching for? For example, in a navigation application, a state is a place. In our search application, a state is a file or folder.
  • Ingredients of a search: There are three main ingredients in a search algorithm. These ingredients are as follows, using the example of a treasure hunt:
    • Initial state: This answers the question—where do we begin our search? In our example, the initial state would be the location where we begin our treasure hunt.
    • Successor function: This answers the question—how do we explore from the initial state? In our example, the successor function should return all of the paths from the location where we began our treasure hunt.
    • Goal function: This answers the question—how will we know when we've found the solution? In our example, the goal function returns true if you've found the place marked as the treasure.

The search ingredients are illustrated in the following diagram:

Figure 15
  • Node: A node is the basic unit of a tree. It may consist of data or links to other nodes.