Optimal control with engineering applications