Leg

class passengersim.core.Leg

Bases: object

Leg objects

Methods

__init__(*args, **kwargs)

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

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).

bucket_number

Return bucket_number object, either by class name (string) or index (int)

capture_dcp

Grab a snapshot of important variables

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, ...)

compute_simple_fare_adjustments

Compute simple fare adjustments for the leg

detruncate_demand

Demand untruncation

emsrb

EMSRb protection calculations

emsrc

EMSRc critical value

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

info

Get a string with leg information

littlewood

Simple protection calculation using Littlewood's Rule

new_forecast

Create a ForecastGroup object that follows this leg.

next_departure

Move history buffers to the next departure

print_bucket_detail

Print a bunch of debugging info

print_bucket_history

Print a bunch of debugging info

reset_counters

Reset the counters for the leg

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)

update_forecasts

Update forecasts for the leg

Attributes

action_state

action_timestamp

arr_time

Arrival time, Unix timestamp, (seconds since 1970-01-01

arr_time_offset

Difference between local arrival time and GMT, in minutes

bid_price

Bid Price used for O&D controls.

bid_price_gradient

BP = BP + (gradient * num_in_party)

bp_index

buckets

Iterator for the Bucket objects

cabins

Iterator for the Cabin objects

capacity

Capacity for the leg.

capacity_sharing

For cabin capacity sharing in multi-cabin

carrier

carrier_name

Carrier code

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

displacement

distance

Distance, usually in nautical miles

duration

Duration, in minutes

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

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

leg_id

Unique integer ID

local_revenue

Total revenue, local only, is reset after each sample

local_sold

Total sold, local only, is reset after each sample

num_objects

Number of Leg objects allocated, was used to find memory leaks

orig

Origin Airport code, readonly

pathclass_identifiers

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.

revenue

Total revenue, is reset after each sample

sold

Total sold, is reset after each sample

tags

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