Improve RockSample custom lower bound

Earlier it was just following the policy given by the average state of the
distribution. Now each time the policy samples a rock, we check if it is
better to sample it first, in order to eliminate the bad states.

Also, upper bounds for non-stochastic models do not depend on the random
number position, so make it a 1D array indexed by states, and compute
it iteratively instead of recursively.