An Optimal Control Framework for Flight Management Systems