# Computational Complexity of Air Travel Planning

←

**Page content transcription**

If your browser does not render page correctly, please read the page content below

Computational Complexity of Air Travel Planning Carl de Marcken ITA Software carl@itasoftware.com This document is an annotated set of slides on the computational complexity of air travel planning. The goal is to give somebody with an undergraduate level computer science background enough information to understand why air travel planning is an interesting and especially difficult problem. It provides a basic introduction to the air travel planning problem and then presents a variety of original computational complexity results as well as some related demos. The complexity slides assume a basic familiarity with formal languages, computational complexity and computability, but the introduction to the problem should be accessible without this. ITA Software produces search and optimization software for the travel industry. Our search engines power popular web sites such as Orbitz and Cheap Tickets; airline web sites such as America West, Continental Airlines and Alaska Airlines; computer reservation systems (CRS/GDSes) used by travel agencies, such as Galileo; and various travel agencies. ITA was founded by MIT computer scientists and is located adjacent to MIT in Cambridge, MA. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 1

Air Travel Planning QUERY SFOÆBOS April 2 BOSÆSFO April 5 Airline Agent Travel Agent Search Engine Travel Website Airline Website RESULT SFO AA123 BOS BOS AA191 DFW AA15 SFO $634 Flights Prices Seat availability Suppose a traveler is planning a round trip from San Francisco to Boston and back. Most likely they’ll contact an airline reservation agent or a travel agent, or perhaps visit an airline's website or a general travel website like Orbitz, providing a query made up of airport and travel time requirements. For the most part these agents are middlemen, and will pass the query off to one of a handful of companies, including ITA Software, that provide search engines for the airlines and the traveling public. Hopefully the search engine will return one or more answers to the query. Each answer consists of a specific set of flights for each part of the trip, and a price. The rest of this talk is about the difficulties search engines face answering such questions. The search engines run on databases of flights, prices, and seat availability, provided electronically over private networks by the 800 or so airlines of the world. The data is not directly available to the general public and access often must be negotiated with individual airlines. Flight data is updated daily or occasionally more frequently in the case of unexpected cancellations. Prices are updated about ten times a day, and seat availability continuously. A large portion of the flight, price and seat availability data, called published data, is used by all the major search engines, but a significant amount of private data is restricted. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 2

Outline • Introduction • Flights • How airline prices work • Complexity of travel planning • Demos • Seat availability • Further reading The talk starts by listing some fundamental properties of the flight network, but flights are simple relative to prices, and after the flight discussion will be a long but necessary introduction to airline prices. Then some basic computational complexity results about the difficulty of air travel planning are presented, with demos that illustrate the complexity results. The talk concludes with an introduction to seat availability processing, since it is an important part of understanding how airline prices work, though this information isn't used in the rest of the talk. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 3

SHH ATK THU KPC WTK SVA KTS TLA OTZ OME DRG ORV YGZ JUV IAN KUS BKC WLK NUI WMO UMD GLV ABL SCC JQA ELI SHG KKA OBU EMK AUK SCM SXP HPB KOTWBB SKK JAV North American flights VAK SMKUNK AKP MOU HSL BTI YRB MYU KSM NUL KYU SNP TNKWWT PQS KAL JEG OOK GAL HUS AETBTT MLL UTO STG NME ATT RSH KGX CYF ANV RBY YIO KUK NUP SHX ARC YAB YSR SFJ KPN HCR YSY WTLWNA BET KWK KWTTLTKLG KKI PKA TAL KKHEEK AKI ANI CHU RMP SVSWBQ VEE YCY JHS CKD TCT KWN MCG MLY RDV FYU KBC YUB SLQ NIB LMA MNT CIK PTU GNU EHM SRV YOC JSU TWA TOG FAI IRC YHI LVD CEM CHP YEV HKB YVM GOH KMOWKK KGK YPC UAK DLGKEK CLP KKU KNW JNS TKA DJN YGT JJU KLL NNL JFR JNN KFP CFA WSN IGG ILIPTA EAA YYH YUX JGR CDB NLG EGX AKN KNKPDB YXP KVC CKX PML PTHUGBPIP ENA ANC BYA YCK YCB YBB PCA TKJ SDP KPV KCQ KCL TEH YDA YGH YHK KCG HOM ORT YCO SWD VDZ TEK NCN CZN ADQ CDV YVQ YUT ZFN YWJ YFB YTE YLC YRA YZS YAK YXY YFJ YBK YIK YQC YLE YZG YWB SGY HNS YCS YFS YZF YRT YKG GST EXI YSG PEC HNHJNU XGR CUW YXN AKV YPX YPJ TKE AGN YDP SIT YHY YVP YDI YEK YHOYMN KAE YSO YRG YBI PSG YRF KPB PPV YYE YSM WWP WRG YPH YHG EDAKCC YFX YHA NKI YOP YBE YMH YWM KLW CGAKTB WMK YOJ ZFD YSF KWFHYL KXA YYR HYGKTN YAY MTM YYQ YKL XTLXLB YBX ZUM YNL ZWL YSK YIF YPR YXJ YBT ZLT YXT YYD YQX YDQ YPE YWK YZP YMM YGW YTQ ZTB YHR YYT YYL XSI YER ZGS YDF YQU YLR YGX ZAC ZKG YNA ZTM YUD YKT YXS XPK YTH YPO YGV YJT YKU YGL ZEL QBC YVC YAA YQZ YOH YPN FSP YFO ZGI YNC YZV YCR YGO YXD YIV YRS XBE YAT YWL YEG YQD YNE YST MSA YTL XKS ZPB ZEM YNS YGP YZT YLL YAX YWP ZKE YFA YGR YPA KIFWNN YKQ YBC KEW ZRJ ZSJ SUR YVB YQY YVZ YNO YLH YMO YYY YBL YBV YMT YXK ZBF YPW YQQ YKA YXE YOG YGB ZJN YHP YFH YYG YAZYPB XQU YYC YPM YAC YPL YTFYBG YRJ YCD ZNA CXH YVR YLW YSL YQM YXX YDN YRL YYJ ESDBLI YYF YQN PQI YWHWSX RCERSJ FRD YYU YFC YHZ LPS YCG YXC YQR CLMODW YXH YXL YSJ YQL YQB YWG YQK YHD YTS YUY YVO YBR BFI LKE SEA EAT FCA BGR MWH GEG HVR YQT BHB YQI YAG INL YMX YUL YKM GGW ISN MOT AUG RKD OLF LYU YSB YYB PSC PUW GTF DVL GFKTVF YTA YOW PDX MSO SDY CMX MSS PLB BTV ALW LWS LWT BJI HIB GPZ YAM PWM PDT HLN GDV MQT CIU OGS SLK JMS FAR DLH IWD LEB DIK BIS PSM RUT EUG BTM MLS BRD PLN YGK MHT ART BZN IMT ESC APN RDM BIL RHI BED BOSPVC OTH STC UCA ALB ORH TVC YYZ YTZ SYR EWBHYA ABR ROC BDL PVDMVY ACK WYS EAU CWA GRB MBL YKF SHR ATY MSP YHM BUF ITHBGM WST MFR BOI COD ATW OSH MBS YXU ELM POU HVNGON SWF BID CEC SUN GCC PIR HON BKX YZR LMT IDA WRL RST LSE FNT HPN JAC RAP MKG JHW AVP ISP GRRLAN ERI BFD LGA JFK EWR ACV PIH FSD MSN MKE YQG IPT TWF RIW MCW DTW ABE CPR AZO FKL DUJ TTN CDR CLE YNG SCE RDG RDD FOD ALO DBQ RFD ORD TOL LNS PHL MDT SUX CGX SBN MDW CAK AOO ACY GYY PIT LBEJST AIA CID CIC EKO RKS BFF OFK MLI FWA HGR DSM CBE BWI SLC LAR OMA OTM CMH MGW RNO CYS LAF IAD DCA LBF BRL PIA BMI SBY STS SMF VEL GRI LNK DAY PKB CKB HDN EAR CMI IND MCK IRK UIN SPI DEC SHDCHO OAK SCK SFO CVG EGE DEN CRW RIC SJC MOD HTS PHF GJT ASE MCI BKWLWB LYH ORF MCE CNY MHK FOE STL SDF LEX ROA COU BLV BLF MRY MTJGUC COS HYS SLN EVV FAT CDC OWB BDA TEX PUB GBD MWA VIS SGU TBN TRI GSO RDU PGV GCK CEZ DDC ICT CGI PAH PGA ALS EWN SBP BFL IYK LAS DRO JLN SGF HKY SOPFAY OAJ SMX HAE FMN LBL BNA TYS CLT PNC AVL JGC GCN TSM WMH ILM SBA WDG TUL HRO GSP IFPIGM XNA JBR MKL FLO OXRBUR CHA FLG GUP SAF MYR LAXONT HII MEM CAE LGB PRC OKC FSM MSL HSV SNA PSP ABQ AMA AHN LIT TUP AGS SOW HOT ATL CHS CLD CVN LAW BHM SAN IPL PHX GTR HHH TIJ SPS GLH MCN SAV MXLYUM LBB ROW TXK ELD CSG MGM SVC ALM DFW DAL MEI BQK TUS HOB MLU JAN ABY SHV CNM ABI TYRGGG DHN FHU PIB VLD JAX ELP CJS MAF BWD ACT AEX TLH SJT MOB PNSVPS PFN GNV ILE GPT DAB BTR CLL LFT SFB AUS LCH MSY IAH BPT MCO MLB GUB HMO HOU EFD SAT TPA PIE TCB MHH CUU VCT SRQ FPO GYM PDS PBI RSW ELH FLL GHB CEN CRP APF MIA RSD LRD SAQNAS ATC NLD TBI ZSA LOV ASD LTO TZN MAY SML GGTLGI LMM MFE REX HRL EYW CRI MYG SLX BRO MAM AXP NCA MDSGDT TRC SLWMTY PLS XSC LZC VRA LAP HAV IGA AVI F SJU SIG DGO MZO POP CMW STI EPS BQN CVM MOA CAP PUJ MAZ PSE SJD BCA MZT GER CYO HOG LRM CUL BYMSCUGAO SDQ HEX ZCL PAP SLP TAM AGU CUN CYB TPQ MID CZM BJX GCM MBJ OCJ POT PVR GDL NEG KTP KIN QRO PAZ CPE MLM JAL UPN TLCMEXPBC ZLOCLQ VER CME CTM CVJ MTT VSA PQM ZIH OAX AUA CURBON TGZSZT ACA IZT PXM HUX TAP This is a map of all scheduled commercial flights in North America, with an arc drawn between two airports if there is at least one flight between them over the next year. This and most other data presented in this talk dates from 2001. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 4

The Flight Network • 4000 airports served by commercial airlines • Served by average of 4 airlines, connect to 8 others • Weighted by # of departures, 22 airlines, 64 destinations • Dominated by large airports – largest 1% (>4000 flights/day) have 40% of departures – largest 10% (>250 flights/day) have 85% of departures – reflects airlines’ hub-and-spoke system • Shortest path averages 3.5 in US, 5 worldwide (uniformly weighted) • Diameter > 20 • 30,000,000 scheduled commercial flights per year – 1 per second • 4000 – 10,000 planes in air, mostly large jets • 700,000 passengers in the air • 50% of flights within US and Canada There are more than 4000 airports served by commercial airlines worldwide. Averaged uniformly, each airport has an outgoing degree of 8 (it has flights to 8 other airports), and is served by 4 airlines. However large airports dominate the system: re-weighted by their number of departures, airports average degree 64. This reflects the hub-and-spoke system used by many airlines, wherein for a given airline one to four airports account for half of their departures. Despite the high connectivity amongst the major airports, the shortest path between two airports chosen uniformly averages 3.5 flights in the United States and 5 worldwide. Amazingly, the graph diameter is often as high as 20: there are airports that can take 20 flights minimum to get between, over 4 days (typically this will be a small airport in Alaska or Canada to another small airport in Africa or Indonesia). Commercial airliners take off about once per second worldwide, and most are large jets more than half full, resulting in close to a million people in the air at times. The United States and Canada heavily dominate air travel in terms of numbers of flights, though deregulation in Europe has led to a great increase in air travel there over recent years. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 5

San Francisco to Boston: 2,000 paths YVR SEA PDX YUL PWM BOI MSP YYZ BOS BDL MKE HPN DTW LGA JFK EWR ORD CLE MDW PHL RNO SLC PIT SMF BWI SFO SJC DEN CMH IADDCA CVG MRY MCI FAT STL LAS RDU SBA BNA CLT BUR LAX ONT SNA MEM SAN PHX ATL DFW IAH MCO MIA Switching to path planning, this map shows the routes involved in the 2,000 quickest paths (flight combinations) from San Francisco to Boston on a certain day. Specific flights are not shown: some arcs represent multiple flights between the same airports at different times of day. Notice that all of these paths look reasonable: they don’t leave the United States and southern Canada, all are length 3 or less, and all arrive the same day. An impecunious traveler might be willing to consider any of them. But 2,000 paths doesn’t begin to exhaust the possibilities. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 6

San Francisco to Boston: 10,000 paths YYC YVR SEA PDX BGR YUL YOW EUG BTV PWM BOI MSP YYZ ALB BOS ROC BUF BDL MKE HPN ISP DTW LGA JFK EWR ORD CLE MDW PHL RNO SLC PIT STS SMF BWI SFO SJC DEN IND CMH IADDCA CVG MRY MCI FAT STL SBP BFL LAS RDU SBA BNA CLT BUR LAX ONT SNA PSP MEM SAN PHX ATL DFW JAX AUS IAH MCO MIA SJD This map plots the arcs in the 10,000 quickest paths, all still arriving on the same day. A few more airports come into consideration, but again no path is out of the realm of possibility. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 7

At 30,000,000 flights per year, standard algorithms like Dijkstra's are perfectly capable of finding the shortest path. However, as with any well-connected graph, the number of Growth rate of # of paths possible paths grows exponentially with the duration or length one considers. Just for San • Standard graph algorithms adequate to find one path Francisco to Boston, arriving the same day, • Number of paths grows exponentially with duration or length there are close to 30,000 flight combinations, more flying from east to west (because of the SFO to BOS paths (same day arrival) longer day) or if one considers neighboring 40000 airports. Most of these paths are of length 2 35000 30000 or 3 (the ten or so 6-hour non-stops don't 25000 visually register on the chart to the right). For 20000 a traveler willing to arrive the next day the 15000 10000 number of possibilities more than squares, to 5000 more than 1 billion one-way paths. And that’s 0 6h 9h 12h 15h 18h for two airports that are relatively close. Duration Considering international airport pairs where SFO to BOS SFO+SJC+OAK to BOS+PVD+MHT • Can’t quickly enumerate all reasonable one-way itineraries; completely the shortest route may be 5 or 6 flights there impractical to enumerate all round-trips may be more than 10^15 options within a • Provably hard to use prices to inform selection small factor of the optimal. One important consequence of these numbers is that there is no way to enumerate all the plausible one-way flight combinations for many queries, and the (approximately squared) number of round-trip flight combinations makes it impossible to explicitly consider, or present, all options that a traveler might be interested in for almost all queries. Air travel prices and paths have a very complex relationship with each other. As will be shown, it’s provably hard to use prices to inform flight selection if one is searching for the cheapest route. This gives air travel planning a very different character from many other easier route planning problems, such as car route search. Dynamic programming techniques like those in Dijkstra's algorithm can not be used to reduce the exponential number of paths to a polynomial algorithm, because when prices are considered the state of a search can not be summarized by the current position: prices depend on the entire flight history. One interesting note is that while standard algorithms can be applied to the flight graph to generate shortest paths (or the k shortest paths), it is a considerable challenge to develop algorithms that can enumerate the best paths fast enough for use in a planning system that may need to consider thousands to millions of routes within tens of seconds. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 8

Outline • Introduction • Flights • How airline prices work • Complexity of travel planning • Demos • Seat availability • Further reading Airline prices are much, much more complex than prices for almost any other good or service, and are not intuitive. It is the prices, not route planning, that make air travel planning a difficult problem. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 9

Prices • Almost all the difficulty in travel planning comes from prices • Fare: price for one-way travel between two cities (a market) AA BOS-SFO H14ESNR $436.28 • Fare has rules restricting its use • Axioms – Each flight must be covered (paid for) by exactly one fare – One fare may cover one or more (usually consecutive) flights – One or more fares are used to pay for a complete journey • Fare component (FC) = fare + flights it covers The atomic unit of price in the airline industry is called a fare. A fare is a price an airline offers for one-way travel between two cities, usually good for travel in either direction. Such a city pair is known as a market. Each fare is given an alphanumeric identifier called a basis or fare basis code, H14ESNR in the example. Each fare is published with a set of rules restricting its use. Fundamentally, each flight must be paid for by exactly one fare, but a single fare may pay for more than one flight. Multiple fares may be combined to pay for all the flights in a journey. The airline industry uses the term fare component (FC) to refer to a fare and the flights it pays for (covers). Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 10

Fare components BOS-SFO Y $1000 BOS-SFO Y $1000 SFO BOS BOS SFO DFW $2000 Airline City 1 City 2 Basis Price AA BOS SFO Y $1000 AA BOS DFW QE14 $500 AA DFW SFO K21AP $300 As an example, suppose that a round-trip journey on American Airlines consists of the three flights shown, nonstop from San Francisco to Boston, then back to San Francisco through Dallas, and that American Airlines publishes the 3 fares listed in the table. For example, the $1000 “Y” fare can be used to pay for travel from BOS to SFO or from SFO to BOS. Then, assuming the Y fare’s rules are satisfied, one way to pay for this journey is by using the Y to pay for the single outbound flight, and the Y again to pay for both return flights, for a total price of $2000. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 11

Fare components BOS-SFO Y $1000 BOS-DFW QE14 $500 DFW-SFO K21AP $300 SFO BOS BOS SFO DFW $1800 Airline City 1 City 2 Basis Price AA BOS SFO Y $1000 AA BOS DFW QE14 $500 AA DFW SFO K21AP $300 Assuming the QE14 and K21AP fares’ rules are met, there is another valid way to pay for the same flights, using a BOS- DFW fare to pay for the first flight of the return and a DFW-SFO fare to pay for the second flight. In this case the total is only $1800. In general, a traveler may choose whatever fare combination for a ticket they wish so long as all fare rules are satisfied: usually they’ll want to choose the cheapest combination, but (for example) they may choose more expensive fares that permit refunds or first-class travel if they so desire. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 12

Fares are not the end of the story. There is another unit of representation between a fare component and a complete ticket, called a priceable unit (PU). A Priceable Units priceable unit is a collection of 1 to 4 fare components in one of a small number of • Priceable unit (PU) is a group of 1 to 4 fare components fixed geometric shapes. An analogy is that – restricted to one of several fixed geometries if fares are atoms, priceable units are the molecules used to build complete tickets. one way round trip open jaw open jaw circle trip 3 circle trip 4 It's not entirely correct, but a good working B A B intuition is that a priceable unit is the A B A B A B smallest group of flights and fares that A B A A B A C C B could be sold on their own. C D C • Ticket is built from one or more priceable units The simplest priceable unit is the one way PU built from one fare component. Others include round trip PUs and circle trip • PU is domain for fare rules such as minimum stay PUs built from 2, 3 or 4 FCs that form a – “Must be a Saturday night between departure of 1st flight in 1st fare loop. Open jaw PUs are like circle trips component of PU and departure of 1st flight in last fare component” with one FC missing – usually the open gap must be shorter than the distance flown in any of the flown FCs. • Many cheap (“round trip”) fares do not participate in one-way PUs The airlines use priceable units as a domain in which many fare rules apply. For example, many of the least expensive fares have a Saturday night stay restriction. The airlines often define such a restriction by reference to the priceable unit containing the fare in question: “there must be a Saturday night between the departure of the 1st flight in the 1st FC of the PU and the departure of the 1st flight in the last FC of the PU”. It is common for fares to require that other fares in the same PU be on the same airline. Importantly, many of the cheapest fares, known as round trip fares (to be distinguished from round trip PUs and round trip journeys) have rules that prohibit their use in one way PUs. That means that for a round trip fare to be used, it must be combined in a priceable unit with at least one other fare; it is round trip fares that usually impose Saturday night stay restrictions. The net effect is that to use a (cheap) round trip fare one must fly a journey with at least two flights separated by a Saturday night, and must use at least two fares to pay for the journey. As will be discussed, priceable units are responsible for much of the theoretical difficulty in pricing air travel. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 13

Priceable Units • Fare components may be grouped into priceable units in multiple ways – Affects the interpretation of fare rules circle trip PU 2 open jaw PUs DEN DEN SFO BOS SFO BOS DFW DFW QE14 QE14 14 AP: purchase time to dep. SFO 14 AP: purchase time to dep. DEN QE14: 14 days advance purchase, Saturday-night stay A specific set of flights may be partitioned into fares and priceable units in many ways. The above diagram shows two ways to partition the four flights of a SFO to BOS round-trip journey. In both cases, four fares are used, one per flight. On the left, the four fare components are grouped into a single circle-trip priceable unit. On the right, they are grouped into two open-jaw priceable units. Each black line represents a flight and each red a fare. The boxes represent priceable units. Because rules like the Saturday night stay restriction and advance purchase restrictions depend on how flights and fares are divided into priceable units, it is important how fare components are grouped into priceable units, and this non-determinism adds to the search space. Suppose the third fare, a BOS-DFW QE14 fare, has a 14-day advance purchase restriction and a Saturday night stay restriction, and the three other fares do not have important restrictions. The 14-day advance purchase restriction will likely be defined as requiring 14 days to pass between the time of reservation and the departure of the first flight in the priceable unit of the fare with the restriction. In the case of the single circle-trip priceable unit that flight is the initial departure from SFO, marked in green. In the case of two open-jaw PUs, that flight is the later departure from DEN. Thus, from the perspective of the 14-day restriction, it is more likely the restriction will be met in the two-PU choice. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 14

Priceable Units • Fare components may be grouped into priceable units in multiple ways – Affects the interpretation of fare rules circle trip PU 2 open jaw PUs DEN DEN SFO BOS SFO BOS DFW DFW QE14 QE14 14 AP: purchase time to dep. SFO 14 AP: purchase time to dep. DEN SAT: dep. SFO to dep. DFW SAT: dep. DEN to dep. BOS QE14: 14 days advance purchase, Saturday-night stay The QE14 fare's Saturday night stay restriction is likely defined as requiring that the first flight of the last fare component in the priceable unit be on or after the first Sunday following the departure of the first flight of the first fare component in the PU. In the single circle-trip PU case, the relevant times will be the departure from SFO and the departure from DFW. In the two open-jaw PUs case, the relevant times will be the departure from DEN and the departure from BOS. Therefore from the perspective of the Saturday night stay restriction, the circle-trip choice is advantageous (more time passes between the two measurements). Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 15

Priceable Units • Fare components may be grouped into priceable units in multiple ways – Affects the interpretation of fare rules circle trip PU 2 open jaw PUs DEN DEN SFO BOS SFO BOS DFW DFW QE14 QE14 14 AP: purchase time to dep. SFO 14 AP: purchase time to dep. DEN SAT: dep. SFO to dep. DFW SAT: dep. DEN to dep. BOS Priceable units introduce long-distance flight & fare dependencies Priceable units add to the complexity of ticket pricing in two ways. First, the choice of different partitions of fare components into priceable units increases the search space. Second, and more importantly, priceable units introduce long-distance dependencies between different parts of a trip. Notice in the case of the circle-trip priceable unit how the Saturday night stay restriction tests the combination of the departure times of two flights widely separated in both time and on the ticket. Nothing limits the distance between different fare components of a priceable-unit, which has huge ramifications for search algorithms: most efficient search techniques demand that constraints be local. Fare rules can and usually do restrict fare combinations within a priceable unit as well as flight combinations. For example, a fare may require that other fares in the same PU be published by the same airline and have similar basis codes. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 16

Priceable Units • Flights can be broken into fare components and priceable units in many ways 1 round trip 2 open jaws 1 circle trip 3 DEN DEN DEN SFO BOS SFO BOS SFO BOS DFW DFW DFW 1 circle trip 4 4 one ways 1 circle trip 3 DEN DEN DEN SFO BOS SFO BOS SFO BOS DFW DFW DFW A specific set of flights may be partitioned into fares and priceable units in many, many ways. For the four flights shown above 6 possibilities are shown (there are more). Each red line represents a fare component and each yellow polygon a priceable unit. For example, a round trip PU may be used with one fare paying for both outbound flights and one for both return flights. Alternatively two open jaw priceable units can be used, each containing two fares, each fare paying for one flight. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 17

Fare Portfolio • Airlines offer portfolio of fares at different prices in each market – From 5 to 500 fares (and more generated by macros) BA BOS – LON AAP £5663 HDWPXGB1 £578 MLF3CP $377 R £6142 B2 $653 HDXPXGB1 £558 MLF3IT $377 VHF4CP $502 DAP £2951 HFWPX2 £435 MLFAM3FP $378 VHF4IT $502 DXRT £3318 HFWPXGB1 £517 MLFAM3IT $378 VYWAP2 £357 F1 £3469 HHWAPUS $1063 MLWAPUS $533 VYWAPGB1 £208 F1US £543 HHWMTOW $577 MLWSX7 £255 VYXAP2 £337 5 F2BA £6608 HHWMTOW $536 MLWSX8 £225 VYXAPGB1 £208 HAWPXGB1 £418 HHWPX2 £610 MLWSXGB1 £268 WUS $1369 HAXPXGB1 £418 HHWPXGB1 £620 MLXAPUS $473 Y £837 HBWPXGB1 £516 HHXAPUS $1003 MLXSX7 £235 Y2 £407 HBXPXGB1 £496 HHXMTOW $515 MLXSX8 £225 YUS $1369 HCWPXGB1 £437 HHXMTOW $505 MLSXGB1 £268 AND 239 MORE… HCXPXGB1 £437 HHXPX2 £590 MQAPUS $803 Within every market airlines publish not just one, but many fares. For example, British Airways offers more than 280 fares between Boston and London. Some airlines publish as many as 1000 fares in international markets, and there are various “macro” systems in the industry that can double or triple that number. Each fare has a different price and a different fare basis code. A reasonable question is why the airlines publish so many fares, if the traveler is free to choose the cheapest. The answer is that each fare has its own rules restricting use, so that in any particular circumstances only a small subset of the fares may be usable. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 18

Fare Rules • Fare rules restrict use of each fare – Passengers • Age, nationality, occupation, employer, frequent flyer status – Fare component • Dates, times, locations, airlines, flights, duration of stops – Priceable unit • Types of priceable units (one way, round trip, open jaw, …) • Other fares in the priceable unit (airline and basis codes) • Dates, times, locations, airlines, flights, duration of stops – Journey • Fares and flights in other priceable units (airline and basis codes) • Other priceable unit geometries – Other • Purchase location and time Fare rules can restrict most any aspect of a journey. Often they restrict the passengers who may use the fare – limiting special discounts to children, for example -- and the travel agents who may sell the fare. Many fares include restrictions on the flight numbers, locations and departure times of flights within the fare’s fare component. Typically fares within the United States prohibit stops of longer than 4 hours within a FC. Fare rules may also impose restrictions at the priceable unit domain, such as the Saturday night stay restriction that depends on the times of flights from the first and last FC in the fare’s PU simultaneously. Rules very often restrict the fares that can combine in a priceable unit, such as requiring them to be on the same airline or have similar fare basis codes. It is even possible for a fare to restrict parts of the journey outside the fare’s priceable unit. As will be shown, this greatly increases the difficulty of the search problem. One passenger’s fares may restrict another’s, such as cheap companion fares that force a second or third passenger to accompany the first, and that restrict the fares those passengers may use to pay for common flights. This can cause an exponential increase in the complexity of search with the number of passengers on the trip. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 19

Sample Fare Rules AA BOS-SFO H14ESNR $436.28 Rule Details Restricts Routing Tues or Weds 1st flight in FC must depart on Tues FC flights BOS or Weds Surcharges add $22.50 if BOSÆSFO; FC flights add $20 if SFOÆBOS NYC 14 days adv purchase 1st flight in PU must depart 14 days PU flights after reservations DFW CHI Saturday-night stay complicated PU flights LAX Combinability all fares in PU must be on AA or TW; PU fares other restrictions; no OW PUs PU geometry Back-to-back complicated Other PU geometries SFO And much more … … • Rules expressed in extremely complicated and baroque electronic language – ~1000 parameterized predicates – Very limited range of logical combinators – No quantifiers, variables, functions – Very limited expressive power 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 defines the electronic representations. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 20

Summary: The Search Problem • For a travel query, find the best solution – A set of flights that satisfies the travel query – A set of fares that covers all the flights exactly once – A partition of the fares into priceable units – For each fare, solution must satisfies fare’s rules • Fare rules restrict – Flights in fare component – Flights and fares in other fare components of priceable unit – Priceable unit geometry – All flights and fares and priceable units in journey (less common) Although clearly not a practical algorithm, in the tradition of non-deterministic search one might summarize the air travel search problem as: 1. Guess a set of flights that satisfies the travel query; 2. Guess a set of fares and a mapping from flights to fares that covers all flights exactly once; 3. Guess a partitioning of the fares into priceable units; and 4. Verify that all fares’ rules are met, where the rules may conceivably test all flights and fares in the journey but take a very restricted form. In fact this isn’t the entire truth. For international travel some additional checks (so-called IATA checks) require comparing one answer against another, so that one answer can’t be used if another more expensive one is close by in a technical sense. While practically this adds greatly to the difficulty of international search, IATA checks are too complex to explore here. Fortunately, they only compare potential fare variations for the same set of flights, which limits their effect on the theoretical computational complexity of the air travel planning problem. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 21

Example with numbers • Real SFO-BOS round trip – Confined to SFOÆORDÆBOS, BOSÆDFWÆSFO – All flights on AA; max 1 day travel each way – 14 days advance purchase, Saturday night stay • 25,401,415 valid solutions from space >10,000,000,000 • Just one of many, many airlines and routes – longer routes have much bigger numbers 14 priceable unit geometries 13 partitions fc s ORD7 flig hts Æ 85 · 36 fare s fare s One way One way hts · 36 Æ 11 2 fc s 5 flig 19 flight combos · 32 fares Æ 109 fcs SFOÆBOS BOSÆDFW SFO BOS 109 fcs 87 fcs Æ 61 pus Æ 45 pus 8 flig 7 hts · 41 flight combos · 32 fares Æ 162 fcs re s Æ 8 3 2 fa fa Round Trip Open Jaw res Æ · 32 7 2 fc DFW 9 flig hts fc s SFOÆBOS ORDÆBOS s BOSÆSFO BOSÆDFW 109 · 162 fcs 112 · 87 fcs Æ 12,168 pus Æ 8,169 pus This is a real SFO-BOS round trip example with numbers, constrained to a particular American Airlines route (SFO to BOS through ORD, then after a Saturday night back from BOS to SFO through DFW) with travel each way limited to one calendar day. There are a total of 25,401,415 valid solutions from a space of more than 10,000,000,000 combinations of flights and fares and priceable units. Exploring the diagram, from SFO to ORD on the travel date AA offers 5 flights and publishes 36 fares in the market. After testing those fare rules that restrict fare component flights and times, there are a total of 85 possible SFO to ORD fare components (from a space of 5 * 36 = 180). Similarly, from SFO to BOS the 5 SFO to ORD flights combine with the 7 ORD to BOS flights to produce 19 flight combinations (instead of 35, because of time constraints). AA publishes 32 SFO-BOS fares, but the 19 flight combinations * 32 fares only produce 109 fare components after checking appropriate rules. When constructing priceable units, the 112 outbound ORD to BOS fare components combine with the 87 return BOS to DFW fare components to produce 8,169 open jaw priceable units. Again this is less than 112 * 87 because fare rules limit combinations. There are 14 possible priceable unit geometries, and 13 ways to use the geometries to cover all four flights. Putting together all the possible ways to combine all the possible priceable units into a complete ticket, there are 25,401,415 solutions. This is just for this particular airline and route – it represents a very small portion of the search space that an engine would need to consider for an unrestricted SFO to BOS round trip journey. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 22

Why this mess ? Variable pricing ∀p, p · demand(p) < Cost of flying plane Price • Offer portfolio of fares at different $1000 prices • Prevent the rich (business travelers) from using the cheap fares – Require advance purchase – Prohibit one-way priceable c units Cost of flying plane – Require Saturday night stays $100 C= Number of seats – Prohibit nonstop routes Seat rank by price • Dynamically enable and disable fares according to demand Why this mess? Why so many fares, such complicated rules, the logic of priceable units, and so on? The answer is often called variable pricing. Various airline economists make the following claim: there is no price such that the price times the demand at the price equals the cost of flying a large jet. There are a lot of technical issues that can be raised with their argument, but leaving those aside the argument is that if the airline charges $1 per ticket of course the plane will fill, but the total revenue of $150 barely pays for an hour of a pilot’s salary. If they charge $1000 a ticket then if they could fill the plane they’d make a fortune, but only a small number of people are willing to fly at that price, so again they can’t equal the fixed costs of flying a plane. But if the airline can make those who are willing to pay it pay $1000, and others pay $800, and others $500, maybe down to $100 or so, then the sum total over all passengers is sufficient to pay for the fixed costs. In fact, some estimates put the incremental cost of flying a single passenger as low as $30 (for the meal and baggage and ticket handling), so that once the airline has committed to flying the plane it is in their interest to sell a ticket for $30 rather than let a seat go empty. But they must keep those who can pay more from buying their ticket at low prices, a tough balancing act. The airlines solve this problem in two ways, collectively called revenue management. The first is to use fare prices and fare rules to construct a system wherein the cheapest fares have restrictions that increase their perceived cost for a business traveler to the point where the business traveler will choose to buy more expensive fares. For example, cheap fares require round trip travel, prohibit non stop flights and ticket refunds, et cetera. But the cheap fares remain available for leisure travelers with more flexibility, for whom the extra restrictions are not so onerous. The second way, discussed later, consists of dynamically deciding whether to sell a given fare for a flight based on how much demand there is for the flight. For example, if a flight is not filling, lower priced fares are made available (on the grounds that it’s better to get some money than none) but on high-demand flights only the most expensive fares are available. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 23

Outline • Introduction • Flights • How airline prices work • Complexity of travel planning • Demos • Seat availability • Further reading Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 24

Next are 4 proof sketches of the complexity of different aspects of the air travel planning and pricing problem. Some Complexity Results It would in fact be easy to show that air travel planning is hard if airlines could publish any type of rule with a fare, • Single fixed fare, fixed route, variable flights is NP-hard as opposed to the restricted set they commonly use and • Fixed flights, fixed PUs, variable fares is NP-hard that can be encoded in the industry’s electronic formats. • Fixed flights, fixed fares, variable PUs is NP-hard Except for the last one, the following proofs will rely only • Full search is EXPSPACE-hard (simpler proof) on the most fundamental parts of the airlines’ pricing • Full search is undecidable (more difficult) framework, used routinely. And except the last one, all the proofs are fairly simple and reduce standard • Proofs rely only on fundamental parts of the pricing framework computer science problems known to be difficult to the • All proofs reduce standard problems to travel queries over question of whether there is a valid ticket for a query specially constructed flight and fare databases over specially constructed flight and fare databases. 1. Even if the airlines publish only a single fare (with every ticket a single one way PU), and all the airports in a passenger’s itinerary are fixed, so that the only remaining choice is what flights to use between the consecutive airports, deciding whether there is a valid ticket is NP-hard. 2. Fixing the flights and priceable units, but leaving open the choice of fares to pay for each flight, deciding whether there is a valid ticket is NP-hard. 3. Removing bounds on the size of solutions, the general question of whether there is a ticket for a query is EXPSPACE- hard. That is, air travel planning is at least as hard (it might be harder) as deciding whether a computer program that can use space exponentially bigger than the input halts. EXPSPACE-hard problems are (thought to be) much harder than NP- complete problems like the traveling salesman problem, and even much harder than PSPACE-complete problems like playing games optimally. There is no practical hope that computers will ever be able to solve EXPSPACE-hard problems perfectly, even if quantum computing becomes a reality. 4. The final result shows that just finding out whether there is a valid solution for a query is actually harder then EXSPACE-complete: it is unsolvable (undecidable). The question of whether a valid ticket exists can not be solved for all databases and all queries no matter how long a computer thinks. However the full proof of this result is considerably more complex than the EXPSPACE-hard proof without offering any greater understanding of the problem. One interesting result not written up here is that even completely fixing the flights and fares of a ticket, so that the only remaining question is how to partition the fares into priceable units, is NP-complete. This is interesting because only flight and fare information makes its way onto printed tickets, not the grouping of fares into PUs. Therefore the problem of just validating a printed ticket is worst-case NP-complete, though it is rarely difficult in practice. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 25

Single fare, fixed route is NP-hard • One fixed fare, fixed route: only choice is flight number selection • Reduce 3SAT (m clauses over k variables): (x1 or x2 or ~x3) ^ (x2 or ~x4 or x5) ^ … ^ (~x1 or x5 or ~xk) x1 x2 x3 … xk Flights: A B C ... ... Z ~x1 ~x2 ~x3 … ~xk Fare: AÆZ Rules = If ~x1 and ~x2 and x3 then FAIL If ~x2 and x4 and ~x5 then FAIL … If x1 and ~x5 and xk then FAIL Else PASS It is possible to reduce the NP-complete 3SAT problem to the question of whether there is a combination of flights that satisfies a particular fare’s rules. For a given 3SAT expression over k variables one can construct a sequence of k+1 airports with exactly two flights between the ith and (i+1)th airport, one flight representing the assignment of true to the ith variable, the other false. It is possible to construct a single fare from the first to the last airport such that the fare’s rules enforce the 3SAT logical expression. This is not entirely trivial to show, in that the limited rule language forces one to apply DeMorgan’s rule to the expression and to encode the restrictions on variables as a certain kind of restriction on the flight numbers that can be used between two specific airports, but the fare rule language is (just barely) expressive enough to do this. This simple fact is interesting because the airlines often advertise fares to the public: “$100 special from Boston to San Francisco!” Even looking at that fare’s rules, it may not necessarily be easy to find a sequence of flights that will satisfy them. In point of fact, the particular rule mechanisms used in the complete proof are not usually problematic for search, but the combined set of all types of fare component flight and route and time restrictions can make it very difficult to find valid flight sequences for many fares between airports separated by 3 or more flights (or to prove that no valid sequence exists). Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 26

Fixing a sequence of flights but introducing a choice of fares to pay for each flight, it is again possible to reduce an NP-complete problem, k- Fixed flights, variable fares is NP-hard coloring a graph (coloring graph vertices with k colors such that no two connected vertices share • Flights are fixed: choice is over fares for each flight the same color). In this construction vertices are • Reduce k-Color (m vertices) represented by flights and the color of a vertex by • Fares can restrict fare basis codes of all other fares in solution the choice of fare used to pay for the flight. A sequence of flights is constructed, one per vertex, and a query posed between the endpoints. The Flights: S X1 X2 … … … … … Xm fare database is constructed to contain one fare per combination of vertex and color. In the figure, the fares for the flight representing vertex i SÆX 1 X1ÆX 2 X m-1ÆX m are named REDi, BLUEi and GREENi (for 3- RED1 RED2 … … REDm color). Fares: BLUE1 BLUE2 BLUEm GREEN1 GREEN2 GREENm REDi rules: for all (i,j) in E, may not be used in solution with REDj It is possible to encode in fare rules restrictions on the fare basis codes of other fares that appear on the same ticket, even if they are in other priceable units. Extra-priceable-unit restrictions on fare combinations are called end-on-end fare combinability restrictions, or end-on-end restrictions. To complete the translation of graph coloring into air travel pricing, if vertex i is connected to vertex j by an edge, then every vertex i fare prohibits the vertex j fare of the same color from appearing on the same ticket. For example, if vertex 3 is connected to vertex 6, then RED3 prohibits RED6, BLUE3 prohibits BLUE6 and GREEN3 prohibits GREEN6. Again, the only difficulties to this proof consist of finding mechanisms in the airline industry’s rule system sufficiently powerful to encode the original problem. The power of a fare to restrict, even independently, the fare basis codes of all other fares in a solution is simply too powerful for efficient search. To the extent that one associates NP-hard (NP-complete) problems with exponential time search, this result is extremely important, because in many queries the base and exponent are sufficiently large for exhaustive search to be impossible. For example, for a round-trip query requiring three outbound and three return flights, it may be necessary to search over tickets that use 6 fares per passenger. For each market, there may be 1000 published fares. Finally, if multiple passengers travel there can be interactions between the passengers’ fares. So, for a two person query the search space may be greater than 1000^12, or 10^36. For a completely fixed set of flights!! Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 27

Full search is EXPSPACE-hard • Simulate Turing Machine with exponential size tape – Flight represents a tape cell's contents at a particular time, including head position and state (all encoded into flight number) • Trip flights from A to B encode entire history of Turing Machine's execution • Final flight to destination B can only be taken from accept state A $ 0 0 1 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 0 1 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 1 1 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 1 0 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 0 0 1 1 1 0 0 0 0 0 0 0 0 $ $ 1 0 0 1 1 1 0 0 0 0 0 0 0 0 $ B Both of the previous proof sketches assumed a bounded number of flights, related to the size of the input problem. If one allows that a traveler might take any finite number of flights to satisfy their query, the problem is much harder. It is not difficult to show the problem is at least EXPSPACE-hard using a proof similar to Cook’s proof that SAT is NP-complete. The idea is, given a Turing Machine to simulate, to construct a query from A to B such that if there is an answer, flights of that answer encode the execution history of the Turing Machine tape from initial state to an accept state, and if the Turing Machine doesn’t halt or accept the input, for there to be no valid solution to the travel query. A network of flights is constructed such that each flight is covered by a single fare, with the combination representing the contents of one cell of a TM tape at a certain time, holding either 0, 1, $ (the tape end symbol) or the combination of 0, 1 or $ and a state symbol. The figure depicts a valid solution that reflects the execution of a TM. The solution is read from left to right, top to bottom, and each line represents the TM configuration at a particular time. Color is used to represent the TM state: the colored 0 in the second cell indicates that the TM starts in the green state with the read/write head over the second cell of the tape. Here red is used to indicate the accept state: when (and only when) the TM transitions to the red state, the flight graph permits a following flight to the destination B. For further intuition, imagine that each flight is one day long and that the tape is of length 10, and that the trip starts on January 1st. Then the January 1st flight represents the initial contents of cell 1 ($). The January 24th flight represents the contents of cell 4 at time step 3 (1, state yellow). The flight number can be used to encode the cell contents (#1000 for $, #2000 for 0, #3000 for 1) and the airline the state (Tape Airlines if the head is in a different cell, or Green Airlines, Yellow Airlines, Blue Airlines, Red Airlines, etc). So the depicted solution would have flights TA1000, GA2000, TA2000, TA3000, etc). The next slide will complicate this representation slightly. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 28

One-step consistency • Key is that one time step and the next are related by a “regular relation”: can be expressed by a finite-state transducer – $:$ (0:0|1:1)* (L1:A1 Q1:B1 R1:C1|L2:A2 Q2:B2 R2:C2|...) (0:0|1:1)* $:$ – Writing, moving and state transitions expressed by small table of triples • If we collapse into one sequence of alternating symbols, can be expressed using FSM – $$ (00|11)* (L1A1 Q1B1 R1C1|L2A2 Q2B2 R2C2|...) (00|11)* $$ A $ 0 0 1 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 0 1 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 1 1 1 1 0 1 0 0 0 1 0 0 0 $ $ 1 1 0 1 1 0 1 0 0 0 1 0 0 0 $ A $ $ 0 1 0 0 1 1 1 1 1 1 0 0 ... ... $ $ 1 1 0 1 1 1 1 1 1 1 0 0 ... ... $ $ 1 1 1 1 1 0 1 1 1 1 0 0 ... ... The important issue in the proof is how to enforce the standard logic for how a TM advances in time. The flight sequence must correctly simulate the TM. Start by considering a single TM transition. The tape away from the head does not change. The cell the head is over may change contents, the state may change, and the head may move left or right one cell. Thus, all change takes place in a window of 3 cells centered on the head, and within these cells only a small finite number of before and after configurations are possible. Therefore the set of permitted transitions can be encoded using a non-deterministic finite- state transducer (FST) that uses (0:0|1:1)* to account for most of the tape and a small set of triples L:A Q:B R:C to encode the changes near the head. From the start of the diagram, we see that one triple is $:$ GREEN0:1 0:GREEN0. We can change the representation so that the before-and-after contents of each cell are interleaved, as in the lower diagram. There the gray cells represent the tape at the current time step, and the white cells the tape at the next time step. Then a single row reflects one transition, and the consistency of that transition can be enforced by a non- deterministic finite-state machine (FSM): where the FST had X:Y, the FSM has XY. Therefore the initial flight sequence becomes TA1000 TA1000 GA2000 TA3000 TA2000 GA2000. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 29

Multi-step consistency • Now one-step transitions are encoded within a time step by FSM flight graph • To ensure multi-step consistency, need to enforce equality between cells on a diagonal – Implemented using round-trip priceable-units that enforce same-flight-number restrictions on outbound flight and return flight – Key issue is ensuring that right cells are paired; implemented using minimum and maximum stay restrictions: min stay = max stay = TAPE-LENGTH * 2 - 1 – EXP-SPACE limit comes from encoding of min/max stay: n bits encodes 2^n length A $ $ 0 1 0 0 1 1 1 1 1 1 0 0 ... ... $ $ 1 1 0 1 1 1 1 1 1 1 0 0 ... ... $ $ 1 1 1 1 1 0 1 1 1 1 0 0 ... ... The advantage of encoding single-step transitions within a row is that multi-step consistency is ensured if the “after” portion of one row is identical to the “before” portion of the next, or in other words, if each white “after” cell is encoded using the same airline and flight number as the gray “before” cell that is one down and to the left of it. But this geometric relation is also a linear one: if the TM tape length is T, then each “before” flight must be the same as the “after” flight that occurs 2T-1 days later. This flight equality restriction can be enforced using round-trip priceable units. The fare database is constructed so that each white cell (in a non-final row) can only be priced using a fare with rules that ensure it is paired in a round-trip priceable unit with another same-flight fare. The rules also have 2T-1 day minimum and maximum stay restrictions, ensuring that exactly the right white and gray cell are paired. Without this restriction the tape could become scrambled from one time step to the next. These minimum and maximum stay restrictions are the limiting factor in the simulation. It takes n bits to encode a minimum stay of length 2^n, so this construction can “only” simulate a TM with a tape of length exponential in the length of the encoding of the TM. On the other hand, there is no limit to the number of steps the TM can run. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 30

The flight and fare databases necessary for this query do not depend on how long execution takes, unlike Cook’s SAT proof. This is because it is possible in the airlines' Some Details electronic flight distribution language to • Finite-state machine encoding must be of size polynomial in the input, but allow for exponentially say that a flight leaves every day without many flights specifying each departure separately. – Electronic flight formats permit one to say “Flight X leaves every day at 5pm” – Encoding size is thus governed only by representation of input and number of transition triples For a fixed Turing Machine the only • Polynomial in input (TM specification and input tape) causes of variation in the size of the • TM specification bounded at a small number if one encodes a Universal TM and writes encoding are that some flights need to be the program on the tape dedicated to forcing the beginning of the – Minimum connection time (MCTs) tables make it easy to encode FSM first row of the simulation to match the • MCTs are per-airport specifications of whether one can connect between two flights TM input (thus, the flight network grows with specified flight numbers, and if one can, minimum time that must be allowed linearly with the size of the TM input) and • Can simulate non-deterministic TMs because their permitted transitions are just as easily encoded using an FSM as deterministic TMs the encoding of tape length using • Solutions are big minimum and maximum stay restrictions – For EXPSPACE, no limit on size of solution because no limit on # of steps on fares. As it is possible to encode a – If polynomial limit is placed on solution size, then can simulate polynomial-sized tape for duration of 2^n using n bits, general polynomial number of steps: NP-complete travel planning is at least EXPSPACE- – ITA Software's engine can run a TM over a tape of size 10 for about 10 steps hard. • No need to specify input tape: can let system search over all possible input tapes The proof goes through equally well for non-deterministic TMs. This means that even if solution size is bounded to a polynomial of the length of the TM input, the problem is NP-hard (in fact, NP-complete). As will be understood by those familiar with the undecidability proofs of Post’s Correspondence Problem and CFG intersection, the source of complexity here is the combination of finite state constraints (expressible in many ways: in this proof with the flight network) and long-distance “equality” checks (expressed using round-trip priceable units). Both of these are fundamental to the airline industry, though the trips constructed in this proof are very artificial. An interesting question is whether there is a way to prevent tape permutations in some way other than with minimum and maximum stay restrictions, since this is the limiting factor in the proof's complexity bound. If one could ensure the same geometric equality conditions no matter how long the tape was, then the air travel planning could simulate a TM for an unbounded number of steps on tapes of unbounded length: the problem of finding a valid ticket for a trip would be unsolvable (undecidable) in the general case. For such a proof one needs a way to restrict the ways that priceable units can be laid out in an answer. The airlines do provide one such mechanism, called the back to back restriction. It is not nearly so fundamental to the industry, and not easy to coerce to a form useful for this proof, but it can be used by slightly restructuring the layout of priceable units in solutions, as is possible using a proof based on Diophantine equations. Unfortunately the details of that proof are considerably more complex and add little to the understanding of the problem. Copyright 2003 ITA Software Notes for MIT course 6.034, Fall, 2003 31

You can also read