Course / Lectures / Lecture 15 / Lab Lab 15

The map is not the world.

A grid-world agent sees a 5×5 window, writes what it sees into an occupancy map, plans with A*, and executes. Remove the model, or remove the loop, and watch what survives.

22 × 14 grid A* planner 3 modes No install · runs in the browser

The grid-world agent lab

World · ground truththe robot sees a 5 × 5 window
A 22 by 14 grid world with a U-shaped trap, a divider with a door, and a horizontal wall.
Model · the agent’s occupancy mapunknown · free · blocked
The agent's occupancy map, with the current plan and the agent.
Reset. Mode: closed loop (model + monitor). Press Step or Run.

Legend. The left panel is the world; the right panel is what the agent believes. Dark cells are walls. The orange line is the current plan; the teal line is the path already taken. The dashed teal box is the 5 × 5 window. In reactive mode the right panel shows only that window, because there is no stored map.

Mode

Choose the architecture

Switching mode resets the episode. The world is the same in every mode; only the agent changes. The layout is fixed (seed 15), and A* tie-breaking is deterministic.

Steps0
Replans0
Collisions0
Nodes expanded0
Plan length—
Known cells—

Trace

Reset. Mode: closed loop (model + monitor).

Press “Compare all three” to run each architecture on the same world.

What this shows

The reactive agent has no model, so it cannot see past the next hill: it walks into the U-shaped trap and stops at a local minimum. The open-loop agent has a model, but it never updates it; its plan is valid for the prior and invalid for the world, and it collides with a wall it never looked at. The closed-loop agent perceives, updates the map, replans when the plan meets a known wall, and reaches the goal.

The cost is visible: replans and nodes expanded are the price of keeping the model honest. A wrong model is not a planner bug; it is a model that stopped listening.

WHAT TO NOTICE

Three architectures, three failures.

REGIME 01 · REACTIVE

No model, local minimum

The greedy step is optimal for the next cell and wrong for the task. The U-shaped trap is a one-cell-deep local minimum: every escape increases the distance. A model is what lets the agent see the escape before it takes it.

REGIME 02 · OPEN LOOP

A model without a monitor

The plan is valid for the prior: the divider door is known, the furniture is not. The agent follows the plan into the horizontal wall and stops. It is not a planner failure — A* was correct relative to the map. The map was wrong, and nothing checked it.

REGIME 03 · CLOSED LOOP

Perceive, replan, pay

The same planner, with a map that is updated from the 5 × 5 window. The plan changes when the wall is observed; the agent goes around. The cost is real: extra steps, replans, and nodes expanded. The benefit is that the model stays in contact with the world.

What the lab is not

It is a hand-built 22 × 14 grid with a deterministic A* planner and an idealized 5 × 5 window. It has no learned perception, no continuous control, no noise, and no physics. It does not measure a benchmark. It isolates one mechanism: a model in the loop is what turns a plan into a behaviour that survives contact with the world.

Read the agent loop again · Read the failure taxonomy · Slides