Scenario 2: Union Bidding & Quality of Life Penalties
During the Rostering phase (assigning pairings to named crew members), the optimizer must respect crew preferences and seniority bidding. These are rarely hard constraints; instead, they are "soft constraints" modeled via cost penalties to guide the solver toward crew-friendly schedules.
📌 The Scenario
Background: The pilot union's Collective Bargaining Agreement (CBA) allows pilots to "bid" (request) specific days off. Because of manpower shortages, the airline cannot guarantee every bid will be honored.
The Requirements:
- Identify if a duty overlaps with a pilot's requested day off.
- Apply a massive cost penalty if a senior pilot's bid is denied.
- Apply a smaller penalty if a junior pilot's bid is denied.
- Add this to the final Roster cost to force the optimizer to respect seniority.
💻 The Rave Solution
graph LR
A[Duty overlaps Day Off?] -->|Yes| B{Check Crew Seniority}
A -->|No| C[Penalty = 0]
B -->|High| D[Penalty = 10,000]
B -->|Low| E[Penalty = 1,000]
D --> F[Add to Roster Cost]
E --> F
C --> F
// ====================================================================
// MODULE: CBA - Seniority Bidding & Day Off Penalties
// ====================================================================
CONSTANTS:
%senior_bid_penalty% = 10000.0;
%junior_bid_penalty% = 1000.0;
%seniority_threshold% = 10; // Years of service
ENDCONSTANTS
// 1. Identify if a duty is scheduled on a requested day off (RDO)
// 'crew.%requested_days_off%' is a keyword array provided by the external system
%violates_rdo% =
duty.%start_date% in crew.%requested_days_off%;
// 2. Calculate penalty based on seniority
%rdo_violation_penalty% =
if %violates_rdo% then
if crew.%years_of_service% >= %seniority_threshold% then
%senior_bid_penalty%
else
%junior_bid_penalty%
else
0.0;
// 3. Aggregate across the Roster
%total_bidding_penalty% = sum(duty(roster), %rdo_violation_penalty%);
// 4. Inject into the objective function
PROPERTY cost OF Roster
RULE:
%financial_cost% + %total_bidding_penalty%;
ENDPROPERTY