EM Untruncation with High Demand¶
In this example, we include product and advance purchase (AP) restrictions in the simulation, and have each airline use the leg-based EMSR-B algorithm to manage revenue. Additionally, the EM algorithm is employed to detruncate censored demand. Demand is simulated at a level 10% higher than normal.
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/09-untrunc-em-high-demand.yaml")
show_file("network/09-untrunc-em-high-demand.yaml")
include: - 08-untrunc-em.yaml simulation_controls: demand_multiplier: 1.1
In [4]:
Copied!
cfg = pax.Config.from_yaml([
"network/09-untrunc-em-high-demand.yaml",
])
cfg = pax.Config.from_yaml([
"network/09-untrunc-em-high-demand.yaml",
])
In [5]:
Copied!
sim = pax.Simulation(cfg)
sim = pax.Simulation(cfg)
In [6]:
Copied!
summary = sim.run()
summary = sim.run()
Task Completed after 23.64 seconds
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-09.xlsx")
summary.to_xlsx("outputs/3mkt-09.xlsx")
Comparing against Targets¶
In [12]:
Copied!
import targets
target = targets.load(9, cfg)
import targets
target = targets.load(9, 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_bookings_by_timeframe(by_carrier="AL1")
comps.fig_bookings_by_timeframe(by_carrier="AL1")
Out[14]:
In [15]:
Copied!
comps.fig_carrier_revenues()
comps.fig_carrier_revenues()
Out[15]:
In [16]:
Copied!
comps.fig_carrier_load_factors()
comps.fig_carrier_load_factors()
Out[16]:
In [17]:
Copied!
comps.fig_fare_class_mix()
comps.fig_fare_class_mix()
Out[17]:
In [18]:
Copied!
comps.fig_bookings_by_timeframe(by_carrier="AL1", by_class=True)
comps.fig_bookings_by_timeframe(by_carrier="AL1", by_class=True)
Out[18]:
In [19]:
Copied!
comps.fig_bookings_by_timeframe(by_carrier=False, by_class=True)
comps.fig_bookings_by_timeframe(by_carrier=False, by_class=True)
Out[19]:
In [20]:
Copied!
comps.fig_leg_forecasts(by_flt_no=101, of=["mu", "sigma"])
comps.fig_leg_forecasts(by_flt_no=101, of=["mu", "sigma"])
Out[20]:
In [21]:
Copied!
comps.fig_leg_forecasts(by_flt_no=111, of=["mu", "sigma"])
comps.fig_leg_forecasts(by_flt_no=111, of=["mu", "sigma"])
Out[21]:
In [22]:
Copied!
from passengersim.utils.targets import computed_targets
c_targets = computed_targets(cfg)
from passengersim.utils.targets import computed_targets
c_targets = computed_targets(cfg)
In [23]:
Copied!
contrast.fig_bookings_by_timeframe({
"c_targets": c_targets,
"simulation": summary,
"target": target,
}, by_carrier=False, by_class=True)
contrast.fig_bookings_by_timeframe({
"c_targets": c_targets,
"simulation": summary,
"target": target,
}, by_carrier=False, by_class=True)
Out[23]: