Artificial intelligence • Original RRTutors lesson
Formulating AI Problems and State Spaces
Represent a task using states, actions, an initial condition, a goal test, and action costs.
Concept and explanation
A search problem is defined by a state space and legal transitions. A good representation removes irrelevant details while preserving what is needed to determine future actions and goal achievement. Poor state design can make search unnecessarily large or accidentally merge situations that are not equivalent.
How to apply it
Define initial state, successor function, goal condition, and path cost; test the representation on tiny cases.
Worked example
For a grid navigation problem, a state may be a cell coordinate, actions may be four legal moves, and cost may be one per step.
Illustrative Python example
start = (0, 0)
goal = (2, 1)
actions = [(1, 0), (-1, 0), (0, 1), (0, -1)]
print(start != goal, len(actions))
Expected result
The state and action representation makes possible transitions explicit.
Limitations and cautions
A state space can explode combinatorially; pruning and abstraction must preserve solution quality.
Practice exercise
Formulate a simple word-ladder or maze task using states, actions, goal, and cost.
Key takeaway: The right problem representation is often more important than a clever search implementation.