Stochastic processes and optimal control