Trajectory optimization to minimize the environmental impact of departing and arriving aircraft