optimal control theory and static optimization in