Skip to content

Carrier

Carrier objects, mostly has counters and link to RM pipeline.

ancillaries instance-attribute

ancillaries: Iterator[Ancillary]

List of ancillaries that this airline will offer.

This attribute is read-only.

brand_preference instance-attribute

brand_preference: float

An array of Brand Preference information.

control instance-attribute

control: Literal[
    "leg", "cabin", "theft", "bp", "bp_loose", "vn", "none"
]

RM control technique, such as 'leg', 'bp', 'bp_loose', 'vn', 'cabin', 'theft', or 'none'.

This attribute is read-only.

cp_algorithm instance-attribute

cp_algorithm: Literal[
    "None", "BP", "CBC", "OPT", "CLASSLESS"
]

Algorithm to use for Continuous Pricing, defaults to 'None'.

cp_elasticity instance-attribute

cp_elasticity: dict[str, float]

For Continuous Pricing, estimate customer price elasticity.

cp_quantize instance-attribute

cp_quantize: int

For Continuous Pricing, round the value to this.

i.e. 10 will result in all prices being a multiple of 10.

cp_record instance-attribute

cp_record: Literal['lowest_open', 'highest_closed']

For Continuous Pricing, do we record in the highest_closed class or the lowest_open?

cp_record_highest_closed_as_open instance-attribute

cp_record_highest_closed_as_open: bool

For Continuous Pricing, do we record the highest closed class as open in the pathclass history?

Has no effect unless cp_record is set to highest_closed.

cp_scale instance-attribute

cp_scale: float

Scale the Continuous Pricing modifier.

Example, 0.5 will add 50% of the modifier to the bid price.

current_tf_index instance-attribute

current_tf_index: int

Current timeframe index.

dcp_days_prior instance-attribute

dcp_days_prior: tuple[int, ...]

Days prior for DCPs (i.e. the start time of each timeframe).

This attribute is read-only.

frat5 instance-attribute

frat5: Frat5 | None

Default Frat5 curve to use for this Carrier.

gt_available_seat_miles instance-attribute

gt_available_seat_miles: float

Grand total ASM.

This value is updated outside the burn period and is not reset by the reset methods.

gt_cp_revenue instance-attribute

gt_cp_revenue: float

Grand total Continuous Pricing revenue.

This value is updated outside the burn period and is not reset by the reset methods.

gt_cp_sold instance-attribute

gt_cp_sold: int

Grand total Continuous Pricing sales.

This value is updated outside the burn period and is not reset by the reset methods.

gt_demand instance-attribute

gt_demand: float

Grand total generated demand.

This value is updated outside the burn period and is not reset by the reset methods.

gt_revenue instance-attribute

gt_revenue: float

Grand total revenue.

This value is updated outside the burn period and is not reset by the reset methods.

gt_revenue_passenger_miles instance-attribute

gt_revenue_passenger_miles: float

Grand total RPM.

This value is updated outside the burn period and is not reset by the reset methods.

gt_sold instance-attribute

gt_sold: int

Grand total sold.

This value is updated outside the burn period and is not reset by the reset methods.

history_length instance-attribute

history_length: int

History length.

load_factor_curve instance-attribute

load_factor_curve: Any | None

Load Factor curve, was an experiment in used this type of RM control. (deprecated)

name instance-attribute

name: str

Name is usually the code, such as 'AL1' or 'DL'.

This attribute is read-only.

num_objects instance-attribute

num_objects: int

Number of Carrier objects allocated, was used for memory leak detection.

This attribute is read-only.

proration_rule instance-attribute

proration_rule: Literal[
    "distance", "sqrt_distance", "disabled", "off"
]

How do we prorate revenue between legs on connecting paths?

revenue instance-attribute

revenue: float

Revenue total, reset after each sample.

rm_system instance-attribute

rm_system: Any

An instance of RmSystem, called at each DCP to do detruncation forecasting / optimization.

sold instance-attribute

sold: int

Number sold, reset after each sample.

sold_priceable instance-attribute

sold_priceable: int

Number sold priceable, reset after each sample.

truncation_rule instance-attribute

truncation_rule: int

Do we mark a TimeFrame as closed if it's closed at the start, end, or both.

Values: 1=beginning, 2=end, 3=beginning_or_end

__init__

__init__(
    name: str,
    control: Literal[
        "leg",
        "cabin",
        "theft",
        "bp",
        "bp_loose",
        "vn",
        "none",
    ] = "leg",
) -> None

Initialize a new Carrier.

Parameters:

  • name (str) –

    Name of the carrier, usually the code such as 'AL1' or 'DL'.

  • control (('leg', 'cabin', 'theft', 'bp', 'bp_loose', 'vn', 'none'), default: "leg" ) –

    RM control technique to use.

add_ancillary

add_ancillary(anc: Ancillary) -> int

Add an ancillary (code & price).

Parameters:

  • anc (Ancillary) –

    The ancillary item to add.

Returns:

  • int

    Returns 0 on success.

add_carrier_history

add_carrier_history(
    trial: int,
    sample: int,
    sold: int,
    sold_priceable: int,
    revenue: float,
) -> int

Add an item to the carrier history.

ONLY USED FOR UNIT TESTING.

Parameters:

  • trial (int) –

    Trial number.

  • sample (int) –

    Sample number.

  • sold (int) –

    Number of items sold.

  • sold_priceable (int) –

    Number of priceable items sold.

  • revenue (float) –

    Revenue amount.

Returns:

  • int

    Returns 0 on success.

add_frat5_mkt

add_frat5_mkt(orig: str, dest: str, frat5: Frat5) -> None

Specify Frat5 for an O&D market.

Parameters:

  • orig (str) –

    Origin airport code.

  • dest (str) –

    Destination airport code.

  • frat5 (Frat5) –

    The Frat5 curve to use for this market.

get_ancillary_by_index

get_ancillary_by_index(index: int) -> Ancillary

Get ancillary by index.

ONLY USED FOR DEBUGGING.

Parameters:

  • index (int) –

    The index of the ancillary to retrieve.

Returns:

  • Ancillary

    The ancillary at the specified index.

get_ancillary_price

get_ancillary_price(name: str) -> float

Get the price for an ancillary, by code.

Parameters:

  • name (str) –

    The ancillary code to look up.

Returns:

  • float

    The price of the ancillary.

get_ancillary_sold

get_ancillary_sold(name: str) -> int

Get the sold for an ancillary, by code.

Parameters:

  • name (str) –

    The ancillary code to look up.

Returns:

  • int

    The number sold of the ancillary.

get_carrier_history

get_carrier_history() -> list[dict[str, int | float | str]]

Return carrier history, has an item for each sample.

Returns:

  • list

    List of dictionaries, each containing carrier history data for a sample.

get_forecast_accuracy

get_forecast_accuracy() -> (
    list[dict[str, int | float | str]]
)

Return forecast accuracy, as a dictionary.

Returns:

  • list

    List of dictionaries containing forecast accuracy data.

get_frat5_mkt

get_frat5_mkt(orig: str, dest: str) -> Frat5 | None

Get Frat5 for an O&D market.

Parameters:

  • orig (str) –

    Origin airport code.

  • dest (str) –

    Destination airport code.

Returns:

  • Frat5 or None

    The Frat5 curve for the specified market, or None if not found.

get_history_def

get_history_def() -> dict[str, int | bool]

Get the history definition, used to initialize the history for this carrier's buckets and pathclasses.

Returns:

  • dict

    Dictionary with history definition data including 'num_departures', 'num_timeframes', and 'store_priceable'.

raw_bid_price_trace

raw_bid_price_trace() -> dict[int, dict[str, float]]

Raw bid price trace.

Returns:

  • dict

    Dictionary with DCP keys and values containing bid price statistics.

raw_bookings_by_day

raw_bookings_by_day() -> dict[str, dict[int, int]]

Raw bookings by fare class by days prior.

Returns:

  • dict

    Dictionary with fare class keys and values containing day-prior bookings.

raw_bookings_by_segment_fare_dcp

raw_bookings_by_segment_fare_dcp() -> dict[str, Any]

Raw bookings by segment, fare class, and dcp.

Returns:

  • dict

    Dictionary containing booking data by segment, fare class and DCP.

raw_displacement_cost_trace

raw_displacement_cost_trace() -> (
    dict[int, dict[str, float]]
)

Raw displacement cost trace.

Returns:

  • dict

    Dictionary with DCP keys and values containing displacement cost statistics.

raw_fare_class_distribution

raw_fare_class_distribution() -> (
    dict[str, dict[str, int | float]]
)

Raw fare class distribution.

Returns:

  • dict

    Dictionary with fare class keys and values containing 'sold' and 'revenue' keys.

raw_load_factor_distribution

raw_load_factor_distribution() -> (
    ndarray[Any, dtype[int32]]
)

Raw load factor distribution.

Returns:

  • ndarray

    Array of load factor distribution data.

raw_revenue_by_segment_fare_dcp

raw_revenue_by_segment_fare_dcp() -> dict[str, Any]

Raw revenue by segment, fare class, and dcp.

Returns:

  • dict

    Dictionary containing revenue data by segment, fare class and DCP.

reset_bid_price_trace

reset_bid_price_trace() -> None

Reset bid price trace.

reset_displacement_cost_trace

reset_displacement_cost_trace() -> None

Reset displacement cost trace.