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.18.1 passengersim.core 0.18.1
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 9.80 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_bookings_by_timeframe(by_carrier="AL1", by_class=True)
comps.fig_bookings_by_timeframe(by_carrier="AL1", by_class=True)
Out[16]:
InĀ [17]:
Copied!
comps.fig_leg_forecasts(of=["mu", "sigma"], by_flt_no=111)
comps.fig_leg_forecasts(of=["mu", "sigma"], by_flt_no=111)
Out[17]:
InĀ [18]:
Copied!
comps.fig_leg_forecasts(of=["mu", "sigma"], by_flt_no=111, agg_booking_classes=True)
comps.fig_leg_forecasts(of=["mu", "sigma"], by_flt_no=111, agg_booking_classes=True)
Out[18]:
InĀ [19]:
Copied!
comps.fig_leg_forecasts(of=["mu", "sigma"], by_flt_no=101)
comps.fig_leg_forecasts(of=["mu", "sigma"], by_flt_no=101)
Out[19]: