Email Record: Deterministic and stochastic optimal control