ProBP¶
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/10-probp.yaml")
show_file("network/10-probp.yaml")
include: - 08-untrunc-em.yaml scenario: 3MKTproBP db: write_items: - leg_final - fare_final - demand_final - bookings - bucket - pathclass - leg - demand simulation_controls: num_trials: 10 show_progress_bar: false rm_systems: rm_probp: availability_control: bp processes: DCP: - step_type: untruncation name: untruncation algorithm: em kind: path - step_type: forecast name: path_forecast algorithm: additive_pickup kind: path - step_type: probp name: optimization - step_type: aggregation # not needed for algorithm, but gives leg forecast data for output name: aggregate airlines: - name: AL1 rm_system: rm_probp - name: AL2 rm_system: rm_probp snapshot_filters: - type: pro_bp title: ProBP Snapshot sample: [120, 290, 499] dcp: [63, 56, 21] flt_no: 111 airline: AL1 directory: snapshots/probp outputs: reports: - fare_class_mix - load_factors - bookings_by_timeframe - total_demand - leg_forecasts - path_forecasts - [od_fare_class_mix, BOS, ORD] - [od_fare_class_mix, BOS, LAX] - [od_fare_class_mix, ORD, LAX] - demand_to_come - carrier_history - bid_price_history
In [4]:
Copied!
cfg = pax.Config.from_yaml([
"network/10-probp.yaml",
])
cfg = pax.Config.from_yaml([
"network/10-probp.yaml",
])
In [5]:
Copied!
sim = pax.Simulation(cfg)
sim = pax.Simulation(cfg)
In [6]:
Copied!
summary = sim.run()
summary = sim.run()
In [7]:
Copied!
summary.fig_carrier_revenues()
summary.fig_carrier_revenues()
Out[7]:
In [8]:
Copied!
summary.fig_carrier_load_factors()
summary.fig_carrier_load_factors()
Out[8]:
In [9]:
Copied!
summary.fig_fare_class_mix()
summary.fig_fare_class_mix()
Out[9]:
In [10]:
Copied!
summary.fig_bookings_by_timeframe()
summary.fig_bookings_by_timeframe()
Out[10]:
In [11]:
Copied!
summary.to_xlsx("outputs/3mkt-10.xlsx")
summary.to_xlsx("outputs/3mkt-10.xlsx")
Comparing against Targets¶
In [12]:
Copied!
import targets
target = targets.load(10, cfg)
import targets
target = targets.load(10, cfg)
In [13]:
Copied!
from passengersim import contrast
comps = contrast.Contrast({
"simulation": summary,
"target": target,
})
from passengersim import contrast
comps = contrast.Contrast({
"simulation": summary,
"target": target,
})
In [14]:
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[14]:
In [15]:
Copied!
comps.fig_bookings_by_timeframe(by_carrier="AL1")
comps.fig_bookings_by_timeframe(by_carrier="AL1")
Out[15]:
In [16]:
Copied!
comps.fig_carrier_revenues()
comps.fig_carrier_revenues()
Out[16]:
In [17]:
Copied!
comps.fig_carrier_load_factors()
comps.fig_carrier_load_factors()
Out[17]:
In [18]:
Copied!
comps.fig_fare_class_mix()
comps.fig_fare_class_mix()
Out[18]:
In [19]:
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[19]:
In [20]:
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[20]:
In [21]:
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[21]:
In [22]:
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[22]:
In [23]:
Copied!
comps.fig_bid_price_history(by_carrier="AL1", cap="some")
comps.fig_bid_price_history(by_carrier="AL1", cap="some")
Out[23]:
In [24]:
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[24]:
In [25]:
Copied!
from passengersim.extra.forecast_viz import fig_forecasts_and_bid_prices
from passengersim.extra.forecast_viz import fig_forecasts_and_bid_prices
In [26]:
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[26]:
fig_forecasts_and_bid_prices( sim, trial = 0, rrd = 63, flt_no = 101, )