4. Rules, Legality & Search Space Dynamics
4.1 Rule Definition Syntax
A rule in Rave defines a hard constraint. If a rule evaluates to False, the associated entity is declared illegal.
CONSTRAINT max_duty_flight_time OF Duty
COMMENT: "Duty flight time must not exceed 8 hours"
STATUS: ON;
CONSTANTS:
%max_allowed% = 08:00;
RULE:
sum(leg(duty), %leg_duration%) <= %max_allowed%;
ENDCONSTRAINT
Or using standard shorthand syntax:
4.2 Legality Evaluation Semantics
During optimization, the solver calls the compiled Rave shared library to check legality. A candidate sequence \(P = \langle f_1, f_2, \dots, f_k
angle\) is legal if and only if all active rules evaluate to True:
\[ ext{Legality}(P) = igwedge_{r \in ext{Rules}} ext{Eval}(r, P) == ext{True}\]
4.3 Search Space Pruning & Optimization Mechanics
The Pairing Generator constructs candidate trips using a depth-first search tree:
graph TD
Root["Root: Base Airport SAW"]
F1["Flight 1"]
F2["Flight 2"]
F3["Flight 3"]
F4["Flight 4 (Candidate Sub-trip)"]
Root --> F1
Root --> F2
F1 --> F3
F1 --> F4
When evaluating a candidate node \(n\) representing an incomplete sub-trip \(P_{sub}\):
- If \(P_{sub}\) violates a Final Rule, the generator immediately prunes the entire subtree rooted at \(n\).
- If \(P_{sub}\) violates an Illegal Subchain Rule, the generator does NOT prune the search tree; it continues appending legs.