Watch a robot learn which route works

Compare two ways to pick a route when only the route the robot takes can teach it.

Artificial intelligence Intermediate Reinforcement learning · Routes ~6 min
The idea

Learn from the trip you take

A school robot takes a note to the office. It can use the Hall, the Yard, or the Gate. Each trip is on time or late. The robot only learns about the route it just took. Learning from the result of your own action is called reinforcement learning. That result is the reward: on time counts as 1, and late counts as 0.

Best average tries each route once, then always takes the route with the most on-time trips per trip. The screen writes that as “3 out of 4”. If two averages match, it picks Gate, then Yard, then Hall. Take turns uses Hall, then Yard, then Gate, and then starts at Hall again.

Best average can be fooled by a short lucky run. One late trip through the Gate makes the Yard look better for a moment, then the Gate recovers. Take turns keeps learning about all three routes, but it is on time less often, because it keeps using the Hall.

TipThe on-time lists are fixed, so every run matches the notes. A real corridor would vary. The robot still only learns about the route it takes. Clustering, on the groups page, never gets a reward at all.
DataThe same hidden lists
RouteEach trip, in order
Halllate, late, late, on time
Yardon time, late, late, on time
Gateon time, on time, on time, late, on time

The robot does not see this table during the run. A later trip on the same route takes the next result in its row.

Interactive

Run the simulation

Look at the route just taken, then at the on-time total. Best average and Take turns use the same three lists.

Step 0 / 0
Three routes and the on-time totalbest average
Ready
Shortcuts: Space play/pause · → step · ← back · R reset
Remember

One trip teaches one route

Best average hunts for on-time trips. Take turns keeps checking every route.

1

Your own result

Reinforcement learning updates from the route just taken. The other routes stay unknown on that trip.

2

Best average

After one trip each, pick the highest “on time out of trips”. One late trip can change that pick.

3

Take turns

Using every route keeps the picture fair, and it also spends trips on the Hall, which is often late.