Generic Q-Learner. Takes an object that defines states and rewards