While the reward is calculated from the features (in our case the energy) of the current and new states, a penalty can also be used instead of the reward for policy updating when the new state is undesirable. Specifically, we use penalties when it is not possible to calculate the reward, or when we want to avoid particular action outcomes. Actions can be penalized for the following three outcomes: