State Space Search

State Space Search is a general methodology to search for the solution of a problem inside a solution space.

It is an essential method in AI, which looks for potential states and their transitions to solve problems.

As per this method, the problem is modeled as a state space, with each state representing a possible configuration and transitions denoting actions or operations that change the state of the problem. The aim is to find a route that meets predefined requirements from an initial state to a goal state by exploring various states.

State space search can be used to solve a variety of AI problems including pathfinding, puzzle-solving, and playing games.

The efficiency of the search algorithm greatly depends on the size of the state space, and it is important to choose an appropriate representation and search strategy to search the state space efficiently.

Some well-known state space search algorithms are:

  • Algorithm A

  • Breadth-First Search (BFS)

  • Depth-First Search (DFS)

  • Hill Climbing Algorithm

  • Simulated Annealing Algorithm

  • Genetic Algorithm

Common Terminologies

The following terminologies are commonly associated with state space search:

  • State: A specific configuration of the problem

  • Initial State: The starting state of the problem

  • Goal State: The desired end state that needs to be reached

  • Transition: An action that changes the state of the problem

  • Path: A sequence of states connected by transitions

  • Search strategy: A method to explore the state space to find a solution

Features of State Space Search Algorithm

  • Exhaustiveness/Expansiveness: The algorithm should be able to explore all possible states to find a solution.

  • Completeness: The algorithm should be able to find a solution if one exists.

  • Optimality: The algorithm should find the best (optimal) solution among all possible solutions.

  • Time and spaace complexity: Time complexity depends upon the branching and depth of the search tree whereas space complexity depends upon the maximum number of nodes stored in memory simultaneously.

Steps:

  1. current_state \(=\) initial_state

  2. if current_state \(=\) goal then stop

  3. select a rule \(R\) with preconditions consistent with the current_state

  4. current_state \(=\) state produced by applying \(R\) on current_state

  5. go to step 2

  6. stop

Static

Example: 8-Puzzle Problem

Static

The state space consists of all the possible states of a problem including its initial state and goal state.

Possible actions that can be performed on the possible states of the problem:

  • Move up

  • Move down

  • Move left

  • Move right

Example: Travelling Salesman Problem

Static

Starting with a city A, find a route of minimal distance that visits each of the cities only once and returns to A.

Static