Skip to content

Cost Functions and Penalties: Guiding the Solver

In crew pairing optimization, feasibility (legality) is only half the battle. Once the Pairing Generator finds a set of legal trips, the optimizer seeks the least costly set of pairings that covers every flight in the given network.

The cost of a pairing is defined by using complicated rules. Rave provides the declarative framework to calculate these costs, mixing hard operational expenses with "soft penalties" to guide the mathematical solver toward desirable human outcomes.


1. Hard Costs (Financial Realities)

Hard costs are the actual monetary expenses incurred by the airline. These rules are calculated in Rave and passed directly to the objective function of the optimizer.

  • Flight Pay / Duty Rigs: Calculating the exact union-mandated pay for a sequence of flights.
  • Deadheading Costs: Transporting crew on flights as passengers has major impacts on crew costs.
  • Hotel and Per Diem: Factors like layovers at non-base cities incur fixed costs that the solver must calculate.

2. Soft Costs (Penalties)

A mathematically optimal roster might be perfectly legal and extremely cheap, but absolutely exhausting for a human pilot to fly. To prevent this, OR analysts use Soft Penalties.

A soft penalty is an artificial cost added to the actual financial cost of a trip. It "tricks" the optimizer into thinking an undesirable trip is too expensive to select, unless it is the absolutely only way to cover the flight schedule.

Examples of Soft Penalties:

  • Short Layovers: If a layover is exactly the legal minimum (e.g., 10 hours), a soft penalty is applied to encourage the solver to find a pairing with a 12-hour layover instead.
  • Aircraft Changes: Changing aircraft types mid-duty increases the risk of delays. A penalty of +500 "cost points" is added every time a crew swaps tails.

3. The Objective Function in Rave

In Rave, the optimization engine generates sequences of flights, and it needs to calculate the cost of the pairing by using certain rules.

PROPERTY cost OF Trip
  RULE:
    %financial_base_cost% + %deadhead_penalties% + %quality_of_life_penalties%;
ENDPROPERTY

By tweaking the weights of these penalties, Operations Researchers tune the solver to balance airline profitability against crew quality of life.