The Theory of Optimal Control