For vacuum cleaner world: your agent is a vacuum cleaner robot, which is responsible for cleaning 4 rooms (A, B, C, and D). Each state is represented by the agent’s location and the dirt status at this location. The goal state is achieved when all rooms are clean. You are required to do the following tasks:
-
Create the state space for all possible states.
- Comment on the state space type if it is cyclic or acyclic.
-
Consider the initial state is the corresponding figure a state (C’). Build a search tree with at least depth of 3 levels.
- Comment on expected depth of complete tree.

Sol:
1. State Space
Based strictly on the rule ("Each state is represented by the agent’s location and the dirt status at this location"), the state space is defined by 8 distinct simplified states.
Let a letter represent a clean room and a prime (') represent a dirty room:
- State Space:
{A, A', B, B', C, C', D, D'}
(Note: While these 8 codes represent the agent's immediate local state, the environment must implicitly track the dirt in all four rooms behind the scenes to know when the "all rooms are clean" goal is achieved. A fully observable global state space would contain
State Space Type:
The state space is Cyclic. The agent can move back and forth between rooms indefinitely without performing a "Suck" action (e.g., moving
2. Search Tree (Depth of 3 Levels)
Environment Layout:
-
Top Row: A (Dirty), C (Dirty)
-
Bottom Row: B (Clean), D (Dirty)
-
Possible Moves: Up, Down, Left, Right (bounded by walls).
Initial State: C' (Agent in C, C is dirty. Uncleaned rooms: A, C, D)
Here is the search tree expanded to 3 levels. To make the tree accurate to the goal, I have tracked the hidden global dirt states to determine what code the agent encounters when moving.
-
Level 0
-
C' * Level 1 (Actions from C')
-
├── Suck
C (Rooms A, D remain dirty) -
├── Left
A' (Rooms A, C, D remain dirty) -
└── Down
D' (Rooms A, C, D remain dirty)
-
-
Level 2 (Actions from Level 1)
-
From C:
-
├── Left
A' (Rooms A, D remain dirty) -
└── Down
D' (Rooms A, D remain dirty)
-
-
From A':
-
├── Suck
A (Rooms C, D remain dirty) -
├── Right
C' (Cycle) -
└── Down
B (Rooms A, C, D remain dirty)
-
-
From D':
-
├── Suck
D (Rooms A, C remain dirty) -
├── Up
C' (Cycle) -
└── Left
B (Rooms A, C, D remain dirty)
-
-
-
Level 3 (Actions from a selection of Level 2 nodes)
-
From C
A': -
├── Suck
A (Only D remains dirty) -
├── Right
C (Cycle) -
└── Down
B (Rooms A, D remain dirty)
-
-
From C
D': -
├── Suck
D (Only A remains dirty) -
├── Up
C (Cycle) -
└── Left
B (Rooms A, D remain dirty)
-
-
From A'
A: -
├── Right
C' (Rooms C, D remain dirty) -
└── Down
B (Rooms C, D remain dirty)
-
-

Comment on the Expected Depth of the Complete Tree
-
Optimal Path Depth: The expected depth to reach the goal state (all rooms clean) along the most efficient path is 6 levels.
- Optimal Sequence: Suck at C (1)
Move Left to A (2) Suck at A (3) Move Down to B (4) Move Right to D (5) Suck at D (6).
- Optimal Sequence: Suck at C (1)
-
Complete Tree Depth: Because the state space is cyclic, the complete unpruned search tree has an infinite depth. The agent can wander forever without cleaning. If a search algorithm uses cycle-checking (tracking visited global states), the absolute maximum depth of the tree would be capped at 64.