The 3MKT Network¶
PassengerSim includes a demo network called three market and commonly written as "3MKT".
import passengersim as pax
pax.versions()
passengersim 0.58 passengersim.core 0.59.dev1+g671876c7d
cfg = pax.Config.from_yaml(pax.demo_network("3MKT/DEMO"))
This network, as its name suggests, includes a simulation of ... three markets, where each market is defined by an origin-destination pair:
- Boston BOS to Chicago ORD,
- Chicago ORD to Los Angeles LAX, and
- Boston BOS to Los Angeles LAX.
Each market has some market demand that consists of potential passengers, who would like to travel from the origin to the destination on a simulated day. That demand is composed of two passenger segments: business and leisure.
from passengersim.config.dataframes import demands_to_dataframe
demands_to_dataframe(cfg.demands)
| orig | dest | segment | base_demand | reference_fare | distance | choice_model | dwm_tolerance | todd_curve | curve | group_sizes | prob_saturday_night | prob_num_days | deterministic | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | BOS | ORD | business | 70.0 | 250.0 | 863.753282 | business | 0.0 | None | c1 | None | False | [] | False |
| 1 | BOS | ORD | leisure | 90.0 | 100.0 | 863.753282 | leisure | 0.0 | None | c2 | None | False | [] | False |
| 2 | ORD | LAX | business | 120.0 | 375.0 | 1739.799337 | business | 0.0 | None | c1 | None | False | [] | False |
| 3 | ORD | LAX | leisure | 150.0 | 150.0 | 1739.799337 | leisure | 0.0 | None | c2 | None | False | [] | False |
| 4 | BOS | LAX | business | 100.0 | 500.0 | 2603.449105 | business | 0.0 | None | c1 | None | False | [] | False |
| 5 | BOS | LAX | leisure | 140.0 | 200.0 | 2603.449105 | leisure | 0.0 | None | c2 | None | False | [] | False |
cfg.demands
[Demand(orig='BOS', dest='ORD', segment='business', base_demand=70.0, reference_fare=250.0, distance=863.7532821438833, choice_model='business', dwm_tolerance=0.0, todd_curve=None, curve='c1', group_sizes=None, prob_saturday_night=False, prob_num_days=[], deterministic=False, overrides=[]), Demand(orig='BOS', dest='ORD', segment='leisure', base_demand=90.0, reference_fare=100.0, distance=863.7532821438833, choice_model='leisure', dwm_tolerance=0.0, todd_curve=None, curve='c2', group_sizes=None, prob_saturday_night=False, prob_num_days=[], deterministic=False, overrides=[]), Demand(orig='ORD', dest='LAX', segment='business', base_demand=120.0, reference_fare=375.0, distance=1739.79933695373, choice_model='business', dwm_tolerance=0.0, todd_curve=None, curve='c1', group_sizes=None, prob_saturday_night=False, prob_num_days=[], deterministic=False, overrides=[]), Demand(orig='ORD', dest='LAX', segment='leisure', base_demand=150.0, reference_fare=150.0, distance=1739.79933695373, choice_model='leisure', dwm_tolerance=0.0, todd_curve=None, curve='c2', group_sizes=None, prob_saturday_night=False, prob_num_days=[], deterministic=False, overrides=[]), Demand(orig='BOS', dest='LAX', segment='business', base_demand=100.0, reference_fare=500.0, distance=2603.4491052979865, choice_model='business', dwm_tolerance=0.0, todd_curve=None, curve='c1', group_sizes=None, prob_saturday_night=False, prob_num_days=[], deterministic=False, overrides=[]), Demand(orig='BOS', dest='LAX', segment='leisure', base_demand=140.0, reference_fare=200.0, distance=2603.4491052979865, choice_model='leisure', dwm_tolerance=0.0, todd_curve=None, curve='c2', group_sizes=None, prob_saturday_night=False, prob_num_days=[], deterministic=False, overrides=[])]
Customers from these two segments have quite different purchase preferences, and arrive to book seats (or walk away without a booking) with quite different time distributions.
cfg.fig_booking_curves()
Each of these markets is served by two carriers, who fly identical schedules. Each carrier offers two flights per day from BOS to ORD, and two more from ORD to LAX.
from passengersim.config.dataframes import legs_to_dataframe
legs_to_dataframe(cfg.legs)
| leg_id | orig | dest | orig_timezone | dest_timezone | carrier | distance | capacity | date | dep_time | arr_time | dep_time_offset | arr_time_offset | time_adjusted | dep_hour_local | arr_hour_local | duration_minutes | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 101 | BOS | ORD | America/New_York | America/Chicago | AL1 | 863.753282 | 100 | 2020-03-01 00:00:00+00:00 | 1583067600 | 1583078400 | -18000 | -21600 | True | 8.0 | 10.0 | 180.0 |
| 1 | 102 | BOS | ORD | America/New_York | America/Chicago | AL1 | 863.753282 | 100 | 2020-03-01 00:00:00+00:00 | 1583089200 | 1583100000 | -18000 | -21600 | True | 14.0 | 16.0 | 180.0 |
| 2 | 201 | BOS | ORD | America/New_York | America/Chicago | AL2 | 863.753282 | 100 | 2020-03-01 00:00:00+00:00 | 1583067600 | 1583078400 | -18000 | -21600 | True | 8.0 | 10.0 | 180.0 |
| 3 | 202 | BOS | ORD | America/New_York | America/Chicago | AL2 | 863.753282 | 100 | 2020-03-01 00:00:00+00:00 | 1583089200 | 1583100000 | -18000 | -21600 | True | 14.0 | 16.0 | 180.0 |
| 4 | 111 | ORD | LAX | America/Chicago | America/Los_Angeles | AL1 | 1739.799337 | 120 | 2020-03-01 00:00:00+00:00 | 1583082000 | 1583096400 | -21600 | -28800 | True | 11.0 | 13.0 | 240.0 |
| 5 | 112 | ORD | LAX | America/Chicago | America/Los_Angeles | AL1 | 1739.799337 | 120 | 2020-03-01 00:00:00+00:00 | 1583103600 | 1583118000 | -21600 | -28800 | True | 17.0 | 19.0 | 240.0 |
| 6 | 211 | ORD | LAX | America/Chicago | America/Los_Angeles | AL2 | 1739.799337 | 120 | 2020-03-01 00:00:00+00:00 | 1583082000 | 1583096400 | -21600 | -28800 | True | 11.0 | 13.0 | 240.0 |
| 7 | 212 | ORD | LAX | America/Chicago | America/Los_Angeles | AL2 | 1739.799337 | 120 | 2020-03-01 00:00:00+00:00 | 1583103600 | 1583118000 | -21600 | -28800 | True | 17.0 | 19.0 | 240.0 |
cfg.fig_route_map()
Each carrier offers six fare classes in each market, labeled as "Y0" through "Y5". The prices and restrictions imposed are consistent across the carriers within each market.
from passengersim.config.dataframes import fares_to_dataframe
fares_to_dataframe(cfg.fares)
| carrier | orig | dest | booking_class | price | advance_purchase | restrictions | category | cabin | min_stay | saturday_night_required | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | AL1 | BOS | ORD | Y0 | 400.0 | 0 | None | Y | 0 | False | |
| 1 | AL1 | BOS | ORD | Y1 | 300.0 | 0 | R2 | None | Y | 0 | False |
| 2 | AL1 | BOS | ORD | Y2 | 200.0 | 3 | R1 | None | Y | 0 | False |
| 3 | AL1 | BOS | ORD | Y3 | 150.0 | 7 | R1|R2 | None | Y | 0 | False |
| 4 | AL1 | BOS | ORD | Y4 | 125.0 | 14 | R1|R3 | None | Y | 0 | False |
| 5 | AL1 | BOS | ORD | Y5 | 100.0 | 21 | R1|R2|R3 | None | Y | 0 | False |
| 6 | AL1 | ORD | LAX | Y0 | 500.0 | 0 | None | Y | 0 | False | |
| 7 | AL1 | ORD | LAX | Y1 | 400.0 | 0 | R2 | None | Y | 0 | False |
| 8 | AL1 | ORD | LAX | Y2 | 300.0 | 3 | R1 | None | Y | 0 | False |
| 9 | AL1 | ORD | LAX | Y3 | 225.0 | 7 | R1|R2 | None | Y | 0 | False |
| 10 | AL1 | ORD | LAX | Y4 | 175.0 | 14 | R1|R3 | None | Y | 0 | False |
| 11 | AL1 | ORD | LAX | Y5 | 150.0 | 21 | R1|R2|R3 | None | Y | 0 | False |
| 12 | AL1 | BOS | LAX | Y0 | 750.0 | 0 | None | Y | 0 | False | |
| 13 | AL1 | BOS | LAX | Y1 | 625.0 | 0 | R2 | None | Y | 0 | False |
| 14 | AL1 | BOS | LAX | Y2 | 450.0 | 3 | R1 | None | Y | 0 | False |
| 15 | AL1 | BOS | LAX | Y3 | 325.0 | 7 | R1|R2 | None | Y | 0 | False |
| 16 | AL1 | BOS | LAX | Y4 | 250.0 | 14 | R1|R3 | None | Y | 0 | False |
| 17 | AL1 | BOS | LAX | Y5 | 200.0 | 21 | R1|R2|R3 | None | Y | 0 | False |
| 18 | AL2 | BOS | ORD | Y0 | 400.0 | 0 | None | Y | 0 | False | |
| 19 | AL2 | BOS | ORD | Y1 | 300.0 | 0 | R2 | None | Y | 0 | False |
| 20 | AL2 | BOS | ORD | Y2 | 200.0 | 3 | R1 | None | Y | 0 | False |
| 21 | AL2 | BOS | ORD | Y3 | 150.0 | 7 | R1|R2 | None | Y | 0 | False |
| 22 | AL2 | BOS | ORD | Y4 | 125.0 | 14 | R1|R3 | None | Y | 0 | False |
| 23 | AL2 | BOS | ORD | Y5 | 100.0 | 21 | R1|R2|R3 | None | Y | 0 | False |
| 24 | AL2 | ORD | LAX | Y0 | 500.0 | 0 | None | Y | 0 | False | |
| 25 | AL2 | ORD | LAX | Y1 | 400.0 | 0 | R2 | None | Y | 0 | False |
| 26 | AL2 | ORD | LAX | Y2 | 300.0 | 3 | R1 | None | Y | 0 | False |
| 27 | AL2 | ORD | LAX | Y3 | 225.0 | 7 | R1|R2 | None | Y | 0 | False |
| 28 | AL2 | ORD | LAX | Y4 | 175.0 | 14 | R1|R3 | None | Y | 0 | False |
| 29 | AL2 | ORD | LAX | Y5 | 150.0 | 21 | R1|R2|R3 | None | Y | 0 | False |
| 30 | AL2 | BOS | LAX | Y0 | 750.0 | 0 | None | Y | 0 | False | |
| 31 | AL2 | BOS | LAX | Y1 | 625.0 | 0 | R2 | None | Y | 0 | False |
| 32 | AL2 | BOS | LAX | Y2 | 450.0 | 3 | R1 | None | Y | 0 | False |
| 33 | AL2 | BOS | LAX | Y3 | 325.0 | 7 | R1|R2 | None | Y | 0 | False |
| 34 | AL2 | BOS | LAX | Y4 | 250.0 | 14 | R1|R3 | None | Y | 0 | False |
| 35 | AL2 | BOS | LAX | Y5 | 200.0 | 21 | R1|R2|R3 | None | Y | 0 | False |