Onboard near-optimal climb-dash energy management