The theory of optimal stopping