Text this: Deterministic and stochastic optimal control