Returning to the AA BOS-SFO H14ESNR fare, here is a subset of the fare’s rules. The fare restricts the first flight in its fare component to be on Tuesday or Wednesday. It has a 14 day advance purchase restriction defined on the entire priceable unit. That means that if the fare is used to pay for the return portion of a trip, then even if the flights the fare is paying for leave 21 days after reservations the fare may not be usable, if the outbound portion of the trip took place only 7 days after reservation. The fare, a round trip fare, prohibits use in one way PUs. The fare includes a complicated back to back restriction that limits the geometries of other priceable units in the journey.
One part of the fare’s rules is known as the routing. The routing is a directed graph of permitted routes within the fare component. For example, the H14ESNR fare permits non-stop travel between BOS and SFO, but also permits stops in NYC, CHI, DFW and LAX (but not in both DFW and CHI). Thus, the price is the same, $436.28, whether one takes one flight or four, despite the wildly different cost to the airline of providing the service. In fact, since many of the cheapest fares on popular business routes prohibit non-stop travel, it is commonly the case that airlines’ prices and expenses are anti-correlated, something to think about when you read about airline bankruptcy filings!
Fare rules are expressed in an extremely complicated and baroque electronic language, built from hundreds of parameterized predicates joined by sometimes bizarre logical combinators. Although the language has to be very big to express all of the many airlines’ restrictions, the language is not nearly as expressive as a general purpose programming language. There are no functions, variables, quantifiers, scoping operators, iterators, etc. A non-profit company, ATP (Airline Tariff Publishing), owned jointly by many airlines, manages and distributes fares and rules electronically and working jointly with airlines and search companies defines the electronic representations.