Reading preferences
Concept

States, Actions, and Search

Represent a small problem as states and possible moves before searching.

artificial intelligence, state space, search

A map of possible choices

Imagine finding a route from the classroom to the library. Your current location is a state. Walking through a doorway is an action that changes the state. The classroom is the start; reaching the library is the goal. Search explores possible actions to find a path from start to goal.

Try a small map

There are doors A–B, A–C and B–D. Start at A and make D the goal.

  1. At A, the next possible locations are B and C.
  2. Try B; from B there is a door to D.
  3. A → B → D reaches the goal. The route A → C does not reach D in this map.

See the reasoning

Explore a map of choices

Find D from A in the stated door map. This is a prepared demonstration, not live code execution.

Start at A

A connects to B and C; B connects to D
  1. CurrentACurrent focus
  2. ChoicesB or C
  3. GoalD

The current location is one state; each door is a possible move.

Why the representation matters

The state space contains the possible states and transitions allowed by the model. A goal test asks whether the current state satisfies the objective. If some doors are locked, location alone may not be enough: the state may also need to record which key the traveller holds. More detail can make a model more accurate but increase the number of states to search.

Real routes can have different costs, such as walking time. A path with fewer doors need not be the fastest. Later lessons compare search strategies; none can compensate for an incorrect map or missing constraint.

Reflect on the concept

Four fixed questions to reinforce the reasoning. Answers are not saved or scored.

1. What is a state in a route problem?
2. What does the goal test check?
3. What is a path?
4. Why include important constraints in a state model?

References and further reading