Dynamic programming, optimal control and reinforcement learning