A shaped reward is for some potential function . Prove that the optimal policy does not change. If , and , what bonus does the agent get on the move , and what does the bonus sum to along a whole episode?
Reinforcement learning, Reward shaping
Level L4 Advanced. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can show that potential-based shaping only shifts optimal action values by a state-dependent constant, so it speeds up learning without changing what is optimal.
Key idea
If is optimal for , then satisfies the Bellman optimality equation for . The subtracted term depends on only, so the maximising action in each state is unchanged.
Steps
- Write the Bellman optimality equation for the original reward: .
- Subtract from both sides and add and subtract inside the bracket: . This uses .
- Recognise and define . The line becomes , which is the optimality equation for .
- The solution of that equation is unique (the Bellman operator is a contraction), so .
- For a fixed state , , since is the same for all actions. The optimal policy is unchanged.
- Numbers. The bonus for is . Over an episode the shaping terms telescope: . If the final state has , the total discounted bonus is , a constant that depends only on the start state.
Common mistakes
- Using without the in a discounted problem. That form is not policy-invariant when .
- Making the bonus depend on the action, so it depends on the action taken. Arbitrary action-dependent bonuses can change the optimal policy.
- Forgetting that the potential of the terminal state should be 0 in episodic tasks. Otherwise the leftover term can differ across policies.
- Thinking shaping changes the values only slightly. Values move by , which can be large, but the ranking of actions does not move.
How long your answer should be
Half a page; 4–5 minutes.
Read this
Previous in Reinforcement learning: For the policy-gradient estimate , derive the constant baseline that minimises variance. Then take a one-state problem with , , rewards and . Compute and the variance for , and . Is the average reward the best baseline?
Next in Reinforcement learning: How do you prove that the Bellman optimality operator is a -contraction in the max-norm, and what does this tell you about value iteration converging to a unique and when to stop it?