Conditions for the Evolution of Apology and Forgiveness in Populations of Autonomous Agents