Nonlinear programming and optimal control