Simulation Engine
Attributes
choice_set_sampling_probability
instance-attribute
Used to randomly sample the choice set, especially useful for large networks
num_trials_completed
instance-attribute
Number of trials actually completed with this simulation.
When multiprocessing, this typically will be just 1, as each process will complete only one trial.
prorate_revenue
instance-attribute
When set to True, O&D revenue is prorated by mileage to the leg level
tf_k_factor
instance-attribute
Timeframe k-factor, controls variance in the passenger arrival curves
Functions
_book_offer
_book_offer(
dmd: Demand, offer: Offer, num_pax: int = 1
) -> None
Exercise the bookOffer method in CoreSim, this is ONLY for unit testing !!!
Trying to do anything else with this method may result in pain, mental anguish and gnashing of teeth
_get_event
Pop the next event from the queue and return the timestamp.
Only used for unit testing.
add_dcp
Add dcp_index and days_prior. Must be added in ascending order of dcp_index
additional_settings
Set additional settings for the simulation.
allocate_demand_to_tf
allocate_demand_to_tf(
dmd: Demand,
num_pax: int,
tf_k_factor: float,
endTS: int,
debug: bool = False,
) -> tuple[int]
Generate events for a single demand
Parameters:
-
dmd
(Demand
) – -
num_pax
(int
) – -
tf_k_factor
(float
) – -
endTS
(int
) – -
debug
(bool
, default:False
) –
Returns:
-
int
–Number of events allocated.
allocate_demand_to_tf_pods
allocate_demand_to_tf_pods(
dmd: Demand,
num_pax: int,
tf_k_factor: float,
endTS: int,
) -> tuple[int]
Generate events for a single demand (used to simulate PODS processing)
Parameters:
-
dmd
(Demand
) – -
num_pax
(int
) – -
tf_k_factor
(float
) – -
endTS
(int
) – -
debug
(bool
, default:False
) –
Returns:
-
tuple[int]
–Number of events allocated by DCP.
build_connections
build_connections(
dmd: Demand, debug: bool | None = False
) -> None
Build connections for the demands.
This will create Path
objects for each demand, if the network is given
only by the Leg
objects.
capture_forecast_accuracy
Capture EDGAR-like forecast accuracy data
distribution_local_leg_passengers
Return the distribution of percent local passengers by leg for this carrier.
fraction_local_by_carrier_and_place
Return the fraction of local passengers by place for this carrier.
get_airport_carrier_share
Get the seat share for this carrier at the specified airport
get_choice_set
Get the choice set for the all, or subset for the specified carrier
get_preferred_carrier
get_preferred_carrier(
dmd: Demand, z_val: float, debug: bool
)
Calls the code to set preferred carrier. This is for unit tests
license_info
Access license info as a human-readable string.
Parameters:
-
user_cert
(Certificate
, default:None
) –The license.
Returns:
-
str
–
path_2_leg
Aggregate PathClass forecasts to Leg/Bucket
The dcp_index is used to adjust forecast revenues when fare adjustment is used.
record_daily_statistics
Record daily statistics.
Parameters:
-
days_prior
(int
) –The current number of days prior to departure.
Returns:
-
int
–1 if statistics were recorded (i.e. the sample is after the burn period), or 0 otherwise.
record_dcp_statistics
Record DCP statistics.
Parameters:
-
days_prior
(int
) –The current number of days prior to departure.
Returns:
-
int
–1 if statistics were recorded (i.e. the sample is after the burn period), or 0 otherwise.
record_departure_statistics
Record departure statistics.
Returns:
-
int
–1 if statistics were recorded (i.e. the sample is after the burn period), or 0 otherwise.
shop
Shop all carriers for this O-D pair, return a list of (carrier, price)
validate_license
Validate a user's license certificate.
Parameters:
-
user_cert
(Certificate
, default:None
) –The license.
-
future
(int
, default:0
) –Validate as if it is this many days in the future. This is primarily used for debugging and testing. This is treated as an unsigned integer internally, so negative values will not go back in time.
Raises:
-
RuntimeError
–If the license certificate is not valid.