Problem Solving in Artificial Intelligence
In our previous post, we explored various types of environments in which intelligent agents operate. Now, we turn our attention to one of the core pillars of AI: Problem Solving by Searching. Understanding how AI agents systematically find solutions to complex challenges is key to grasping the intelligence behind many real‐world applications—whether it’s a robot navigating a maze, a chess engine calculating moves, or Google Maps finding the optimal route.
What Is Problem Solving?
Problem solving in AI is a systematic search through a space of possible actions to reach a predefined goal from a given initial state. The collection of all states that an agent can reach—starting from the initial state and following valid actions—is called the state space. The agent’s task is to search this state space to discover a sequence of actions leading to the goal state.
Scenario Example:
A robot is placed in a maze and must reach the exit. Each cell in the maze represents a “state.” The robot begins at the entrance (initial state) and wants to arrive at the exit (goal state). To find its way, it must explore possible movements—up, down, left, right—until it discovers a path through the maze. All cells reachable from the start make up the maze’s state space.

Searching and Problem Solving
In AI, searching is the primary mechanism for tackling problems:
- A search algorithm explores the search space (the set of all reachable states) by applying possible actions to individual states.
- The agent evaluates each possible transition until it finds a path that satisfies the goal test.
When tackling complex problems, an agent becomes a problem‐solving agent, which follows a structured approach:
- Goal Formulation – Identify what constitutes a successful end state.
- Problem Formulation – Decide which actions and states to consider.
- Search – Execute a search strategy to find a sequence of actions leading to a goal.
- Execute – Perform the chosen actions in the real (or simulated) environment.
Once one goal is achieved, the agent can formulate a new goal and repeat this process.
Four General Steps in Problem Solving
Let’s break down these steps:
- Goal Formulation
- Define the desired outcome or goal state.
- Example: A delivery robot’s goal might be “Package delivered to Room 101.”
- Problem Formulation
- Identify the actions the agent can take and the states it must consider.
- Example: Can the robot use the elevator? Are there locked doors?
- Search
- Explore the state space by generating successor states.
- Choose the best sequence of actions (path) that leads to the goal.
- Example: Should the robot go down Hallway A or Hallway B?
- Execute
- Carry out the selected sequence of actions.
- Once complete, update the agent’s knowledge and possibly formulate a new goal.
Problem Formulation in Detail
Successful problem solving hinges on clear problem formulation. An AI problem is formally defined by:
| Component | Description |
|---|---|
| Initial State | The state where the agent begins. |
| Successor Function | A function that, given a state, returns all reachable successor states by applying valid actions. |
| Goal Test | A test (often Boolean) to check if a state is a goal state. |
| Path Cost | A numerical cost assigned to each action; the cost of a path is the sum of its actions’ costs. |
Solution: Any sequence of actions that takes the agent from the initial state to a goal state.
Optimal Solution: A solution whose total path cost is minimal among all possible solutions.
Example: Maze Navigation
Consider a simple 4×4 grid maze:
- Initial State: Cell (0, 0) (top-left corner)
- Goal State: Cell (3, 3) (bottom-right corner)
- Actions: Move Up, Down, Left, Right (if not blocked by walls)
- Successor Function: From any cell, generate neighbor cells (unless blocked)
- Path Cost: Each move has a cost of 1
The agent’s search algorithm (e.g., Breadth-First Search) explores various paths—(0,0) → (0,1) → (1,1) → …—until it reaches (3,3). Among all possible paths, it chooses the one with the fewest moves (lowest path cost).
State Space Representation (Coming Next)
To formally represent problems like our maze, we use a State Space Representation. This representation models:
- States as nodes.
- Actions (transitions) as edges between nodes.
- Costs on edges to represent path cost.
In the next post, we will dive into State Space Representation in detail, seeing how it underpins search algorithms and enables agents to handle more complex problems.
Conclusion
Problem solving in AI is more than just trial and error. It’s a structured search through a state space, guided by clearly defined goals and a precise problem formulation. We learned how a problem-solving agent formulates goals, identifies relevant states and actions, executes a search algorithm, and then carries out the solution.
Key takeaways:
- Problem Solving is a four‐step process: Goal Formulation, Problem Formulation, Search, and Execute.
- Proper problem formulation defines the initial state, successor function, goal test, and path cost.
- An optimal solution minimizes total path cost.
- Real-world examples like maze navigation help illustrate these concepts concretely.
In our next post, we’ll explore State Space Representation—the formal framework that allows us to map out all possible states and transitions, laying the groundwork for specific search algorithms such as Breadth-First Search, Depth-First Search, and beyond.
Stay tuned!