Optimality conditions for control systems andeconomic applications