States, Actions, and Search
Represent a small problem as states and possible moves before searching.
artificial intelligence, state space, searchA 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.
- At A, the next possible locations are B and C.
- Try B; from B there is a door to D.
- 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
- CurrentACurrent focus
- ChoicesB or C
- 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.
