Optimistic Planning in Markov Decision Processes Using a Generative Model