FCFS with Product Restrictions¶
In this example, we add product restrictions to the simulation. These restrictions will cause some passengers to "buy up" to a fare product other than the lowest price.
In [1]:
Copied!
import passengersim as pax
pax.versions()
import passengersim as pax
pax.versions()
passengersim 0.51.dev11+g921f2a8 passengersim.core 0.51.dev2+g02d3ce20
This example adds the network/02-buyup.yaml configuration file, to enable the product restrictions.
In [2]:
Copied!
cfg = pax.Config.from_yaml(["network/01-base.yaml", "network/02-buyup.yaml"])
cfg = pax.Config.from_yaml(["network/01-base.yaml", "network/02-buyup.yaml"])
The configuration can be manipulated in Python after loading. This allows for a more interactive experience, where individual input values can readily be altered for a given analysis.
In [3]:
Copied!
cfg.simulation_controls.num_trials = 4
cfg.simulation_controls.num_trials = 4
After all the desired changes have been completed, we use the Config
to initialize the Simulation
.
In [4]:
Copied!
sim = pax.Simulation(cfg)
sim = pax.Simulation(cfg)
In [5]:
Copied!
summary = sim.run()
summary = sim.run()
Task Completed after 11.12 seconds
In [6]:
Copied!
summary.fig_carrier_revenues()
summary.fig_carrier_revenues()
Out[6]:
In [7]:
Copied!
summary.fig_carrier_load_factors()
summary.fig_carrier_load_factors()
Out[7]:
In [8]:
Copied!
summary.fig_fare_class_mix()
summary.fig_fare_class_mix()
Out[8]:
In [9]:
Copied!
summary.fig_bookings_by_timeframe()
summary.fig_bookings_by_timeframe()
Out[9]:
In [10]:
Copied!
summary.to_xlsx("outputs/3mkt-02.xlsx")
summary.to_xlsx("outputs/3mkt-02.xlsx")
Comparing against Targets¶
In [11]:
Copied!
import targets
target = targets.load(2, cfg)
import targets
target = targets.load(2, cfg)
In [12]:
Copied!
from passengersim import contrast
comps = contrast.Contrast(
{
"simulation": summary,
"target": target,
}
)
from passengersim import contrast
comps = contrast.Contrast(
{
"simulation": summary,
"target": target,
}
)
In [13]:
Copied!
comps.fig_bookings_by_timeframe(by_carrier="AL1")
comps.fig_bookings_by_timeframe(by_carrier="AL1")
Out[13]:
In [14]:
Copied!
comps.fig_carrier_revenues()
comps.fig_carrier_revenues()
Out[14]:
In [15]:
Copied!
comps.fig_fare_class_mix()
comps.fig_fare_class_mix()
Out[15]:
In [16]:
Copied!
comps.fig_segmentation_by_timeframe("bookings", by_carrier="AL1", by_class=True)
comps.fig_segmentation_by_timeframe("bookings", by_carrier="AL1", by_class=True)
Out[16]:
In [17]:
Copied!
comps.fig_leg_forecasts(of=["mu", "sigma"], by_leg_id=111)
comps.fig_leg_forecasts(of=["mu", "sigma"], by_leg_id=111)
Out[17]:
In [18]:
Copied!
comps.fig_leg_forecasts(of=["mu", "sigma"], by_leg_id=111, agg_booking_classes=True)
comps.fig_leg_forecasts(of=["mu", "sigma"], by_leg_id=111, agg_booking_classes=True)
Out[18]:
In [19]:
Copied!
comps.fig_leg_forecasts(of=["mu", "sigma"], by_leg_id=101)
comps.fig_leg_forecasts(of=["mu", "sigma"], by_leg_id=101)
Out[19]: