Problem Solving Agents

By seeing tis example below, Imagine you are a tourist in Romania. You are standing in the city of Arad, and you must reach Bucharest to catch your flight tomorrow morning.

You can go to Sibiu, Zerind, or Timisoara — but which road will get you to Bucharest fastest

This is exactly what an AI problem-solving agent faces — a situation where it must decide what to do to reach a goal.

What is a Problem-Solving Agent?

A problem-solving agent is an intelligent system that:

  1. Thinks before it acts.
  2. Plans a sequence of actions to reach its goal.
  3. Executes those actions in the real world.

It follows four clear steps

1️⃣ Goal Formulation

 The agent decides what it wants to achieve.

Example: Reach Bucharest.

 Why is goal setting important?

Because it tells the agent what to focus on — it doesn’t have to think about sightseeing or food, only the goal.

2️⃣ Problem Formulation

The agent now describes the world as a simple model — only the parts that matter for solving the problem.

this is like making a simplified version of reality.

ConceptExample
State spaceAll cities on the map (Arad, Sibiu, Fagaras, etc.)
Initial stateArad
Goal stateBucharest
Actions(s)Move from one city to another connected by a road
Transition modelWhat happens when you take an action (e.g., RESULT(Arad, ToSibiu) = Sibiu)
Action costDistance between cities (in miles)

💡 Example:

  • ACTIONS(Arad) = {ToSibiu, ToTimisoara, ToZerind}
  • ACTION-COST(Arad, ToSibiu) = 140 miles

So, the agent’s problem is to find a path (a series of actions) that goes from Arad → Bucharest with the least total cost.

3. Search (Thinking Before Acting)

The agent doesn’t just move randomly — it searches for the best path.

It uses the map (knowledge) to explore all possible routes.

Example of possible paths:

1️⃣ Arad → Sibiu → Fagaras → Bucharest

  • Total cost = 140 + 99 + 211 = 450 miles

2️⃣ Arad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest

  • Total cost = 140 + 80 + 97 + 101 = 418 miles

3️⃣ Arad → Timisoara → Lugoj → Mehadia → Drobeta → Craiova → Pitesti → Bucharest

  • Total cost = 118 + 111 + 70 + 75 + 120 + 138 + 101 = 733 miles

So, the second route (via Sibiu → Rimnicu Vilcea → Pitesti) is shortest.

✅ Optimal Path: Arad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest
✅ Cost: 418 miles

4️⃣ Execution (Acting Stage)

4. Execution

Now that the agent has planned the route, it actually executes it:

Drive Arad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest.

If the world is perfect (no roadblocks, no mistakes), the agent can simply follow the plan — this is called an open-loop system (no need to keep checking).

If the world changes (road closed, traffic jam), the agent must adjust — that’s a closed-loop system, where it monitors and adapts.

Summary Table

StepWhat Agent DoesExample
1. Goal FormulationDecides what it wants“Reach Bucharest”
2. Problem FormulationDescribes the environmentCities, distances, roads
3. SearchFinds the best pathArad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest
4. ExecutionFollows the chosen pathDrives city by city

how AI agents think and plan using:

  • State space (possible situations)
  • Actions (choices)
  • Goal (what to achieve)
  • Search algorithms (how to reach the goal efficiently)

Why Abstraction Is Important

In real life, traveling involves:

  • Traffic
  • Weather
  • Food breaks
  • Music
  • Road conditions

But for AI, we remove all these extra details and keep only what’s important — cities and distances.

This is called abstraction — simplifying reality so the AI can focus on solving the right problem.