A Framework for Reinforcement Learning and Planning