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.
| Route | Each trip, in order |
|---|---|
| Hall | late, late, late, on time |
| Yard | on time, late, late, on time |
| Gate | on 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.
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.
One trip teaches one route
Best average hunts for on-time trips. Take turns keeps checking every route.
Your own result
Reinforcement learning updates from the route just taken. The other routes stay unknown on that trip.
Best average
After one trip each, pick the highest “on time out of trips”. One late trip can change that pick.
Take turns
Using every route keeps the picture fair, and it also spends trips on the Hall, which is often late.