Leg bid-price detail

Record the reported bid price for selected legs each day in every retained sample. Use this tracer when you want to inspect an individual sample or see the distribution across samples.

Collect the data

Load the europa/upe demo and attach the tracer before running it:

import passengersim as pax
from passengersim.callbacks.bid_price_detail import LegBidPriceDetailTracer

cfg = pax.Config.from_yaml(pax.demo_network("europa/upe"))
cfg.simulation_controls.num_trials = 3
cfg.simulation_controls.num_samples = 300
cfg.simulation_controls.burn_samples = 50
cfg.simulation_controls.show_progress_bar = False
cfg.db = None
cfg.outputs.reports.clear()
cfg.outputs._write_no_files()

with pax.MultiSimulation(cfg) as sim:
    LegBidPriceDetailTracer(leg_ids=[201, 202, 211, 212, 221, 232]).attach(sim)
    summary = sim.run()
table = summary.callback_data["leg_bid_price_detail"]
   ╭─────────────────────────────────────╮                                                                         
   │ licensed for jpn                    │                                                                         
   │ until 2036-11-17 20:12:20+00:00 UTC │                                                                         
   │ maximum 42000 legs in network       │                                                                         
   ╰─────────────────────────────────────╯                                                                         

╭───────────────── Summary revenue statistics · Europa ─────────────────╮
│                          Brat            Stroop            Tapas      │
│ Run      Samples   Mean  ~95% CI     Mean  ~95% CI   Mean  ~95% CI    │
│ Europa       750   972K   ±8,871   939.4K   ±9,037   291K   ±2,381    │
│ Post-burn-in only · Approx. 95% CI for mean                           │
╰───────────────────────────────────────────────────────────────────────╯

To enable the same tracer in YAML:

callbacks:
  leg_bid_price_detail:
    parameters:
      leg_ids: [201, 202, 211, 212, 221, 232]

Read the results

Rows identify the trial, sample, and days before departure. Columns are leg IDs. The optional priority (default 1) sets the timing of the daily observation.

By default the tracer includes the reporting price on sold-out legs. Set include_sold_out: false to leave those observations missing.

table.head()
leg_id 201 211 212 221 202 232
trial sample days_prior
0 50 63 731.965802 351.958851 200.0 45.624918 314.804848 52.240182
62 726.824093 409.807273 200.0 35.121308 370.958171 57.744214
61 731.097793 406.305985 200.0 35.520326 409.225281 55.703937
60 728.532557 406.672887 200.0 35.176502 394.488651 51.735482
59 691.149426 409.894647 200.0 36.428515 392.545148 51.623045
summary.leg_bid_price_detail.xs(211, level="leg_id").head()
metric mean q10 q25 q50 q75 q90
days_prior
0 300.135274 0.0 0.000000e+00 2.601133e-08 720.069711 1077.560623
1 257.018405 0.0 0.000000e+00 9.551656e-12 410.927867 1029.534372
2 266.392979 0.0 0.000000e+00 3.047831e-06 404.033045 1027.145475
3 271.079908 0.0 0.000000e+00 1.271929e-02 505.201123 1005.443904
4 263.548931 0.0 4.341251e-13 2.254630e-01 440.000000 925.998099
summary.fig_leg_bid_price_detail_rake(leg_id=211)

The summary property reports the mean and the 10th, 25th, 50th, 75th, and 90th percentiles for each leg and day. Missing observations are skipped; all six statistics are missing when a leg has no observations that day. The rake chart shows the median and percentile bands for a single leg. Use fig_leg_bid_price_history to compare a given measure across all the collected legs of a carrier.

summary.fig_leg_bid_price_history(carrier="Stroop", measure="median")

See the bid-price visualization guide for an additional example.