Leg bid-price vectors¶
Follow the bid-price schedule as the simulation updates it. Each day the tracer reads the current vector, which gives a price for each seats-sold level, and averages the vectors across retained samples.
Collect the data¶
Flight 211 in the Europa UPE demo uses bid prices. Attach the tracer before running that network:
import passengersim as pax
from passengersim.tracers.bid_price import LegBidPriceVectorTracer
cfg = pax.Config.from_yaml(pax.demo_network("europa/upe"))
cfg.simulation_controls.num_trials = 1
cfg.simulation_controls.num_samples = 800
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.Simulation(cfg) as sim:
LegBidPriceVectorTracer(leg_ids=[211]).attach(sim)
summary = sim.run()
table = summary.callback_data["leg_bid_price_vectors"]
╭─────────────────────────────────────╮ │ licensed for jpn │ │ until 2036-11-17 20:12:20+00:00 UTC │ │ maximum 42000 legs in network │ ╰─────────────────────────────────────╯
To enable the same tracer in YAML:
callbacks:
leg_bid_price_vectors:
parameters:
leg_ids: [211]
Read the results¶
Rows identify the leg, days before departure, and seats-sold level. The value is the mean bid price.
The optional daily priority defaults to 2. The tracer skips departure day. For the full schedule
as it stood at the start of the sample, see the array tracer.
Use a leg whose revenue-management system produces bid-price arrays. A leg without an array contributes no observations. To plot the mean prices as a heatmap, choose a collected leg:
table.loc[211].head()
| 0 | ||
|---|---|---|
| days_prior | SeatsSold | |
| 63 | 0 | 319.025422 |
| 1 | 321.198026 | |
| 2 | 323.598484 | |
| 3 | 326.012989 | |
| 4 | 328.250316 |
from passengersim.tracers.bid_price import fig_leg_bid_price_vectors
fig_leg_bid_price_vectors(summary, leg_id=211)
Pass raw_df=True to inspect the heatmap data. See also the
bid-price figures.