Keep the model of chapter 1: n cities, one hub, d passengers per ordered pair per day, s seats per flight, whole aircraft, at least one flight per direction per route per day. Let F be flights per day and S passenger-segments per day. Add a cost with two weights, in any one unit:
α could stand for fuel burned in take-off and climb, or the noise of a movement; β for the extra weight carried or the extra distance flown by a passenger. The chapter does not assign either. It asks only how the comparison depends on ρ = β/α, flights per passenger-segment.
From chapter 1, Shub − Sdirect = 2(n−1)2d − n(n−1)d = (n−1)(n−2)d. The hub is cheaper when β·(n−1)(n−2)d < α·(Fdirect − Fhub).
The script checks this against a direct cost comparison on 4,283 cases (every d from 1 to 150 at n = 50 and s = 150, with exact rational ρ on both sides of the threshold) and finds no disagreement.
| d | F direct | F hub | S direct | S hub | hub cheaper when ρ < |
|---|---|---|---|---|---|
| 1 | 2,450 | 98 | 2,450 | 4,802 | 1.0000 |
| 4 | 2,450 | 196 | 9,800 | 19,208 | 0.2396 (= 2,254 / 9,408) |
| 20 | 2,450 | 686 | 49,000 | 96,040 | 0.0375 |
| 50 | 2,450 | 1,666 | 122,500 | 240,100 | 0.0067 |
| 73 | 2,450 | 2,352 | 178,850 | 350,546 | 0.0006 (= 98 / 171,696) |
| 74 and up | 2,450 | 2,450 or more | hub flies more | never | |
The threshold falls fast. At 4 passengers per pair per day the hub wins unless a passenger-segment weighs more than about a quarter of a flight. At 73 it wins only if a passenger-segment weighs less than about 6 parts in 10,000 of a flight. From 74 passengers per pair per day the hub never wins, whatever the weights, because it has no fewer flights and always more passenger-segments.
A cost can also be counted by place. Every hub flight has the hub at one end, so the hub airport sees Fhub movements a day. In the direct network each airport sees 2(n−1)⌈d/s⌉ = 98 movements a day at these values. At d = 4 the hub airport sees 196, twice as many as any airport in the direct network. At d = 20 it sees 686, and at d = 73, 2,352. The hub network has fewer flights in total but concentrates them on one place. Whether that is better or worse depends on how the cost of a movement grows with the number of movements at one airport, and this chapter does not model that.
python3 book15/ch02-verify.py uses only the standard library, prints every number on this page and exits non-zero on any failure. The Lean file for these counts is not written.