The theory of optimal control