Leg¶
- class passengersim.core.Leg¶
Bases:
objectLeg objects
Methods
__init__(*args, **kwargs)Add an inventory control Bucket to the Leg
Add a cabin to the Leg
Adjust forecast means based on external data
Allocate Q-equivalent demand back to Bucket level
Get the average load factor for the leg
Get the average percentage of passengers on this leg who are local (no connections).
Return bucket_number object, either by class name (string) or index (int)
Grab a snapshot of important variables
Clear forecast means adjustment
Combine forecasts for the leg
Compute the conditional forecast for the leg
Compute fare adjustments for the leg
Run the forecasting method on the leg and on the buckets
compute_hybrid_forecasts(dcp_index, ...)Compute simple fare adjustments for the leg
Demand untruncation
EMSRb protection calculations
EMSRc critical value
Get a copy of the bid price array.
Get the authorization for a bucket_number, either by class name (string) or index (int)
Get the demand forecast for a bucket_number, either by class name (string) or index (int)
Get the revenue for a bucket_number, either by class name (string) or index (int)
Get the forecast std dev for a bucket_number, either by class name (string) or index (int)
Get the revenue for a bucket_number, either by class name (string) or index (int)
Get the seats sold for a bucket_number, either by class name (string) or index (int)
Get a cabin by numeric index
Get forecast data
Get the number of buckets on this leg
Get the number of cabins on this leg
Get a string with leg information
Simple protection calculation using Littlewood's Rule
Create a ForecastGroup object that follows this leg.
Move history buffers to the next departure
Print a bunch of debugging info
Print a bunch of debugging info
Reset the counters for the leg
Get the number of seats sold by demand
Set the authorization for a bucket_number, either by class name (string) or index (int)
Set the default prorated value and forecast revenue for a bucket_number, either by class name (string) or index (int)
Set the demand forecast for a bucket_number, either by class name (string) or index (int)
Set the revenue for a bucket_number, either by class name (string) or index (int)
Set the fcst std dev for a bucket_number, either by class name (string) or index (int)
Set the revenue for a bucket_number, either by class name (string) or index (int)
Set the seats sold for a bucket_number, either by class name (string) or index (int)
Update forecasts for the leg
Attributes
Arrival time, Unix timestamp, (seconds since 1970-01-01
Difference between local arrival time and GMT, in minutes
Bid Price used for O&D controls.
BP = BP + (gradient * num_in_party)
Iterator for the Bucket objects
Iterator for the Cabin objects
Capacity for the leg.
For cabin capacity sharing in multi-cabin
Carrier code
Departure time, Unix timestamp (seconds since 1970-01-01
Difference between local departure time and GMT, in minutes
Destinatino Airport code, readonly
Distance, usually in nautical miles
Duration, in minutes
Equipment code for the Leg, i.e. '744', '738', etc.
Airline flight number, integer and not limited to 4 digits
Accessor to the forecasts for this leg, exposing ForecastGroup API
Number of samples in the Grand Total numbers
Grand Total revenue, excluding burn samples
Grand Total sold, excluding burn samples
Grand Total sold as locals (no connection), excluding burn samples
Unique integer ID
Total revenue, local only, is reset after each sample
Total sold, local only, is reset after each sample
Number of Leg objects allocated, was used to find memory leaks
Origin Airport code, readonly
The Q-forecast for priceable demand on this leg.
Bid Price used for reporting, will be the same as bid_price unless leg is sold out.
Total revenue, is reset after each sample
Total sold, is reset after each sample
Dictionary of string tags for the leg, allowing arbitrary metadata to be stored
- action_state¶
- action_timestamp¶
- add_bucket()¶
Add an inventory control Bucket to the Leg
- add_cabin()¶
Add a cabin to the Leg
- adjust_forecast_means()¶
Adjust forecast means based on external data
- allocate_q_demand()¶
Allocate Q-equivalent demand back to Bucket level
- arr_time¶
Arrival time, Unix timestamp, (seconds since 1970-01-01
- arr_time_offset¶
Difference between local arrival time and GMT, in minutes
- avg_load_factor()¶
Get the average load factor for the leg
- avg_local()¶
Get the average percentage of passengers on this leg who are local (no connections).
- bid_price¶
Bid Price used for O&D controls. Will be overriden by Cabin in multi-cabin scenarios
- bid_price_gradient¶
BP = BP + (gradient * num_in_party)
- Type:
Gradient for the bid price. After a sale
- bp_index¶
- bucket_number()¶
Return bucket_number object, either by class name (string) or index (int)
- buckets¶
Iterator for the Bucket objects
- cabins¶
Iterator for the Cabin objects
- capacity¶
Capacity for the leg. Will be overridden by Cabin when Cabin is used
- capacity_sharing¶
For cabin capacity sharing in multi-cabin
- capture_dcp()¶
Grab a snapshot of important variables
- carrier¶
- carrier_name¶
Carrier code
- clear_forecast_means_adjustment()¶
Clear forecast means adjustment
- combine_forecasts()¶
Combine forecasts for the leg
- compute_conditional_q_forecast()¶
Compute the conditional forecast for the leg
- compute_fare_adjustments()¶
Compute fare adjustments for the leg
- compute_forecasts()¶
Run the forecasting method on the leg and on the buckets
- compute_hybrid_forecasts(dcp_index, algorithm, frat5, ...)¶
–
Run the hybrid forecast models for this leg and its buckets items.
- Parameters:
- dcp_index : int¶
Only compute forecasts only from this DCP to departure.
- algorithm : {'exp_smoothing', 'additive_pickup'}¶
Forecasting algorithm to use.
- frat5 : Frat5¶
Frat5 object to use for Q-forecasting.
- snapshot_instruction : SnapshotInstruction, optional
If not None, a snapshot of the forecast will be written based on these instructions.
- recompute : bool, default True
If True, recompute the entire forecast. Otherwise, the forecast cached values will be moved to a new dcp_index.
- max_cap : float, default 10.0
Maximum capacity inflation for Q-forecasting.
- pods_init : bool
- alpha : float, default 0.15
Smoothing factor for exponential smoothing. This is a keyword-only argument.
- compute_simple_fare_adjustments()¶
Compute simple fare adjustments for the leg
- dep_time¶
Departure time, Unix timestamp (seconds since 1970-01-01
- dep_time_offset¶
Difference between local departure time and GMT, in minutes
- dest¶
Destinatino Airport code, readonly
- detruncate_demand()¶
Demand untruncation
- displacement¶
- distance¶
Distance, usually in nautical miles
- duration¶
Duration, in minutes
- emsrb()¶
EMSRb protection calculations
- emsrc()¶
EMSRc critical value
- equipment¶
Equipment code for the Leg, i.e. ‘744’, ‘738’, etc.
- flt_no¶
Airline flight number, integer and not limited to 4 digits
- forecast¶
Accessor to the forecasts for this leg, exposing ForecastGroup API
- get_bid_price_array()¶
Get a copy of the bid price array.
- get_bucket_auth()¶
Get the authorization for a bucket_number, either by class name (string) or index (int)
- get_bucket_fcst_mean()¶
Get the demand forecast for a bucket_number, either by class name (string) or index (int)
- get_bucket_fcst_revenue()¶
Get the revenue for a bucket_number, either by class name (string) or index (int)
- get_bucket_fcst_std_dev()¶
Get the forecast std dev for a bucket_number, either by class name (string) or index (int)
- get_bucket_revenue()¶
Get the revenue for a bucket_number, either by class name (string) or index (int)
- get_bucket_sold()¶
Get the seats sold for a bucket_number, either by class name (string) or index (int)
- get_cabin()¶
Get a cabin by numeric index
- get_forecast_data()¶
Get forecast data
- get_num_buckets()¶
Get the number of buckets on this leg
- get_num_cabins()¶
Get the number of cabins on this leg
- gt_capacity¶
- gt_n¶
Number of samples in the Grand Total numbers
- gt_revenue¶
Grand Total revenue, excluding burn samples
- gt_sold¶
Grand Total sold, excluding burn samples
- gt_sold_local¶
Grand Total sold as locals (no connection), excluding burn samples
- history¶
- info()¶
Get a string with leg information
- leg_id¶
Unique integer ID
- littlewood()¶
Simple protection calculation using Littlewood’s Rule
- local_revenue¶
Total revenue, local only, is reset after each sample
- local_sold¶
Total sold, local only, is reset after each sample
- new_forecast()¶
Create a ForecastGroup object that follows this leg.
- next_departure()¶
Move history buffers to the next departure
- num_objects¶
Number of Leg objects allocated, was used to find memory leaks
- orig¶
Origin Airport code, readonly
- pathclass_identifiers¶
- print_bucket_detail()¶
Print a bunch of debugging info
- print_bucket_history()¶
Print a bunch of debugging info
- q_demand¶
- q_forecast¶
The Q-forecast for priceable demand on this leg.
- report_bid_price¶
Bid Price used for reporting, will be the same as bid_price unless leg is sold out.
- reset_counters()¶
Reset the counters for the leg
- revenue¶
Total revenue, is reset after each sample
- sales_by_demand()¶
Get the number of seats sold by demand
- set_bucket_auth()¶
Set the authorization for a bucket_number, either by class name (string) or index (int)
- set_bucket_blank_value()¶
Set the default prorated value and forecast revenue for a bucket_number, either by class name (string) or index (int)
- set_bucket_fcst_mean()¶
Set the demand forecast for a bucket_number, either by class name (string) or index (int)
- set_bucket_fcst_revenue()¶
Set the revenue for a bucket_number, either by class name (string) or index (int)
- set_bucket_fcst_std_dev()¶
Set the fcst std dev for a bucket_number, either by class name (string) or index (int)
- set_bucket_revenue()¶
Set the revenue for a bucket_number, either by class name (string) or index (int)
- set_bucket_sold()¶
Set the seats sold for a bucket_number, either by class name (string) or index (int)
- sold¶
Total sold, is reset after each sample
- tags¶
Dictionary of string tags for the leg, allowing arbitrary metadata to be stored
- update_forecasts()¶
Update forecasts for the leg