Optimized PolicyIteration.