Open Agent School · Public worked example
Reinforcement Learning: meaning and example
Welcome! Take one idea with you today.
Reinforcement learning improves a policy, a rule for choosing actions, using rewards from interaction with an environment. Unlike a table of correct answers for every situation, feedback may arrive after several actions. The objective usually concerns cumulative reward, so a tempting immediate reward can conflict with a better long-term outcome.
Picture it: A simulated cart chooses between a short aisle with a small immediate reward and a longer route that completes a delivery later. The real goal is correct deliveries without collisions. Rewarding distance traveled instead might teach the cart to circle forever. All actions here concern invented states, not a physical robot.
What is easy to mix up?
A policy may exploit a loophole in the reward. Track the real outcome, constraints, and held-out scenarios separately from the optimization score.
Teaching example by Open Agent School. Source: Gymnasium - Basic usage and the reinforcement learning interaction loop.