ProBP Deprecated Approach¶
In this example, ProBP is applied with daily re-optimization, using a forecast adjusted by linear interpolation between the forecast point and departure. This is provided as a technical demonstration, but for actual implementations and analysis of ProBP reoptimization, users are recommended to employ the timeframe-based adjustment algorithm instead.
In [1]:
Copied!
import passengersim as pax
pax.versions()
import passengersim as pax
pax.versions()
passengersim 0.18.1 passengersim.core 0.18.1
In [2]:
Copied!
from passengersim.utils.codeview import show_file
from passengersim.utils.codeview import show_file
In [3]:
Copied!
show_file("network/11-probp-daily.yaml")
show_file("network/11-probp-daily.yaml")
include: - 10-probp.yaml scenario: 3MKTproBP-Daily rm_systems: rm_probp: processes: DAILY: - step_type: forecastadjustment algorithm: timeframe kind: path - step_type: probp name: optimization simulation_controls: show_progress_bar: true db: write_items: - leg_final - fare_final - demand_final - bookings - bucket - pathclass - leg - demand - leg_daily - pathclass_daily snapshot_filters: - type: pro_bp title: ProBP Snapshot sample: [ 120, 290, 499 ] dcp: [ 63, 56, 21 ] flt_no: 111 airline: AL1 directory: snapshots/probp - type: forecast_adj title: Forecast Adj Snapshot sample: [ 120, 290, 499 ] flt_no: 111 airline: AL1 directory: snapshots/fcst-adj
In [4]:
Copied!
cfg = pax.Config.from_yaml([
"network/11-probp-daily.yaml",
])
cfg = pax.Config.from_yaml([
"network/11-probp-daily.yaml",
])
In [5]:
Copied!
cfg.rm_systems['rm_probp'].processes['daily'][0].algorithm = "days_to_departure"
cfg.rm_systems['rm_probp'].processes['daily'][0].algorithm = "days_to_departure"
In [6]:
Copied!
sim = pax.Simulation(cfg)
sim = pax.Simulation(cfg)
In [7]:
Copied!
summary = sim.run()
summary = sim.run()
Task Completed after 81.80 seconds
In [8]:
Copied!
summary.fig_carrier_revenues()
summary.fig_carrier_revenues()
Out[8]:
In [9]:
Copied!
summary.fig_carrier_load_factors()
summary.fig_carrier_load_factors()
Out[9]:
In [10]:
Copied!
summary.fig_fare_class_mix()
summary.fig_fare_class_mix()
Out[10]:
In [11]:
Copied!
summary.fig_bookings_by_timeframe()
summary.fig_bookings_by_timeframe()
Out[11]:
In [12]:
Copied!
summary.to_xlsx("outputs/3mkt-12.xlsx")
summary.to_xlsx("outputs/3mkt-12.xlsx")
Comparing against Targets¶
In [13]:
Copied!
import targets
target = targets.load(12, cfg)
import targets
target = targets.load(12, cfg)
In [14]:
Copied!
from passengersim import contrast
comps = contrast.Contrast({
"simulation": summary,
"target": target,
})
from passengersim import contrast
comps = contrast.Contrast({
"simulation": summary,
"target": target,
})
In [15]:
Copied!
comps.fig_demand_to_come("mean") | comps.fig_demand_to_come("std")
comps.fig_demand_to_come("mean") | comps.fig_demand_to_come("std")
Out[15]:
In [16]:
Copied!
comps.fig_bookings_by_timeframe(by_carrier="AL1")
comps.fig_bookings_by_timeframe(by_carrier="AL1")
Out[16]:
In [17]:
Copied!
comps.fig_carrier_revenues()
comps.fig_carrier_revenues()
Out[17]:
In [18]:
Copied!
comps.fig_carrier_load_factors()
comps.fig_carrier_load_factors()
Out[18]:
In [19]:
Copied!
comps.fig_fare_class_mix()
comps.fig_fare_class_mix()
Out[19]:
In [20]:
Copied!
comps.fig_bookings_by_timeframe(by_carrier="AL1", by_class=True, source_labels=True)
comps.fig_bookings_by_timeframe(by_carrier="AL1", by_class=True, source_labels=True)
Out[20]:
Interpolation to departure is not advised because customer arrival rates are often very far from uniformly distributed, resulting in forecasts that exhibit a sawtooth pattern.
In [21]:
Copied!
print(sim.path_names()[1])
comps.fig_path_forecasts(by_path_id=1, of=['mu', 'sigma', 'closed'])
print(sim.path_names()[1])
comps.fig_path_forecasts(by_path_id=1, of=['mu', 'sigma', 'closed'])
Path: BOS ORD (AL1:101 BOS-ORD)
Out[21]:
In [22]:
Copied!
print(sim.path_names()[5])
comps.fig_path_forecasts(by_path_id=5, of=['mu', 'sigma', 'closed'])
print(sim.path_names()[5])
comps.fig_path_forecasts(by_path_id=5, of=['mu', 'sigma', 'closed'])
Path: ORD LAX (AL1:111 ORD-LAX)
Out[22]:
In [23]:
Copied!
print(sim.path_names()[9])
comps.fig_path_forecasts(by_path_id=9, of=['mu', 'sigma', 'closed'])
print(sim.path_names()[9])
comps.fig_path_forecasts(by_path_id=9, of=['mu', 'sigma', 'closed'])
Path: BOS LAX (AL1:101 BOS-ORD, AL1:111 ORD-LAX)
Out[23]:
In [24]:
Copied!
comps.fig_bid_price_history(by_carrier="AL1", cap="some")
comps.fig_bid_price_history(by_carrier="AL1", cap="some")
Out[24]:
In [25]:
Copied!
comps.fig_bid_price_history(by_carrier="AL1", cap="some", show_stdev=1)
comps.fig_bid_price_history(by_carrier="AL1", cap="some", show_stdev=1)
Out[25]:
In [26]:
Copied!
from passengersim.extra.forecast_viz import fig_forecasts_and_bid_prices
from passengersim.extra.forecast_viz import fig_forecasts_and_bid_prices
In [27]:
Copied!
fig_forecasts_and_bid_prices(
sim,
trial = 0,
rrd = 63,
flt_no = 111,
)
fig_forecasts_and_bid_prices(
sim,
trial = 0,
rrd = 63,
flt_no = 111,
)
Out[27]:
In [28]:
Copied!
fig_forecasts_and_bid_prices(
sim,
trial = 0,
rrd = 63,
flt_no = 101,
)
fig_forecasts_and_bid_prices(
sim,
trial = 0,
rrd = 63,
flt_no = 101,
)
Out[28]: