Takeoff and landing are the phases of flight that require the most amount of thrust and fuel, and also pose the most risk of stall and loss of control. Therefore, it is important to optimize the drag during these phases. During takeoff, the aircraft needs to generate enough lift to overcome its weight and enough thrust to overcome its drag. To achieve this, the aircraft uses high-lift devices, such as flaps and slats, that increase the camber and area of the wing, and thus the lift coefficient. However, these devices also increase the parasite drag and the induced drag of the wing, so they need to be deployed at the right angle and retracted as soon as possible after takeoff. During landing, the aircraft needs to reduce its speed and altitude while maintaining enough lift and control. To achieve this, the aircraft uses drag devices, such as spoilers and airbrakes, that increase the drag and reduce the lift of the wing, and thus the speed and glide ratio. However, these devices also increase the risk of stall and loss of stability, so they need to be deployed at the right time and retracted before touchdown.