ProbabilisticBidPrice¶
-
class passengersim.rm.probp.ProbabilisticBidPrice(*, carrier: str =
'', cabins: str | list[str] | None =None, minimum_sample: int =10, cfg: Config | None =None, capacity_sharing: bool | None =False, capacity_sharing_start_dcp_index: int | None =0, capacity_sharing_start_lf: float | None =0.0, use_adjusted_fares: bool =False, bid_price_vector: bool | None =False, maxiter: int =10, use_sub_bp: bool =False, snapshot_filters: NetworkSnapshotFilter | list[NetworkSnapshotFilter] | None =None)[source]¶ Bases:
RmActionProBP (ProbabilisticBidPrice) is a path-based optimization algorithm.
Methods
__init__(*[, carrier, cabins, ...])apply_snapshot_filters(sim, days_prior, ...)Apply this action's snapshot filters, if any, and return the resulting instruction.
configure([fixed])Create an RmActionFactory for this action with the given configuration.
get_dcp_index(days_prior[, allow_between])init(sim)Initialize the action for the given simulation.
rm_engine(sim)run(sim, days_prior)Execute the action for the given simulation.
should_run(sim, days_prior)Determine if the action should run on the given days_prior.
Attributes
The frequency with which to run this action.
Optional list of cabin codes to optimize.
Capacity sharing flag between cabins.
We can optionally turn on capacity sharing when the coach cabin reaches a specified load factor.
If True, ProBP will use the adjusted fares for the optimization.
If True, we create a bid price vector in ProBP, rather than just keep a constant bid-price untiol daily re-optimization
The maximum number of iterations to run ProBP.
Whether to use SubBP (True) or ProBP (False).
Set of days prior to departure on which to run this action.
The carrier upon which to apply this action.
The minimum sample number before this action will run.
-
requires : set[str] =
{'path_forecast'}¶
-
frequency : Literal['dcp', 'daily', 'daily_pre_dep', 'non_dcp', 'begin_sample', 'end_sample', 'weekly'] =
'daily_pre_dep'¶ The frequency with which to run this action.
This can be one of the following values: - “dcp”: run only on the specified DCPs. - “daily”: run every day. - “daily_pre_dep”: run every day prior to departure (i.e., days_prior > 0).” - “non_dcp”: run on days that are not in the specified DCPs. - “begin_sample”: run only on the first DCP (i.e., the maximum days_prior). - “end_sample”: run only on the day of departure (i.e., days_prior == 0). - “weekly”: run every 7 days (i.e. when days_prior is a multiple of 7).
The run method of RM actions is actually called every day (as it is implemented as a daily callback), but the first thing the run method should do is check whether it should actually execute on that day, using the should_run method, which uses this frequency setting to determine whether to proceed.
- snapshot_filter_type¶
alias of
NetworkSnapshotFilter
- cabins¶
Optional list of cabin codes to optimize.
If not provided, this tool will optimize on the leg as a whole.
- capacity_sharing¶
Capacity sharing flag between cabins.
When set to True, will use method 3 from Peter Belobaba’s presentation. Higher cabin(s) will get max of combined cabins or itself alone. Lower cabin(s) will get min of combined cabins or itself alone.
- capacity_sharing_start_lf¶
We can optionally turn on capacity sharing when the coach cabin reaches a specified load factor. Based on a suggestion by Darius (PROS)
- use_adjusted_fares¶
If True, ProBP will use the adjusted fares for the optimization.
The default is False, which means that ProBP will use the original fares. This should be set to True if fare adjustment is being used for this carrier.
- apply_snapshot_filters(sim: Simulation, days_prior: int, *args, **kwargs) SnapshotInstruction | None¶
Apply this action’s snapshot filters, if any, and return the resulting instruction.
If there are no snapshot filters, or if none of the filters trigger, then this returns None.
-
classmethod configure(fixed: dict[str, Any] | None =
None, **kwargs) RmActionFactory¶ Create an RmActionFactory for this action with the given configuration.
Each keyword argument name should correspond to a parameter in the RmAction subclass’s __init__ method. The value of each keyword argument will be the keyword argument used in the RmSys that uses this factory.
Fixed values can be provided via the fixed parameter, which is a dictionary of parameter names to fixed values. These values will always be passed to the RmAction constructor, and cannot be overridden via the RmSys.
-
get_dcp_index(days_prior: int, allow_between: bool =
False) int¶
- init(sim: Simulation)¶
Initialize the action for the given simulation.
This is a hook called once at the beginning of the simulation, after the entire network and all core data structures have been set up but before any simulation samples have been run. It can be used to perform any necessary setup before the first call to run. By default, this does nothing, but subclasses can override it if needed.
-
produces : set[str] =
{}¶
- should_run(sim: Simulation, days_prior: int) bool¶
Determine if the action should run on the given days_prior.
- bid_price_vector¶
If True, we create a bid price vector in ProBP, rather than just keep a constant bid-price untiol daily re-optimization
- dcps : set[int]¶
Set of days prior to departure on which to run this action.
- carrier¶
The carrier upon which to apply this action.
- minimum_sample¶
The minimum sample number before this action will run.
- maxiter¶
The maximum number of iterations to run ProBP.
If the algorithm has not converged by the time this number of iterations has been reached, it will stop and return the current results.
- use_sub_bp : bool¶
Whether to use SubBP (True) or ProBP (False).
- rm_engine(sim: Simulation) ProBP[source]¶
- run(sim: Simulation, days_prior: int)[source]¶
Execute the action for the given simulation.
Subclasses must implement this method.
-
requires : set[str] =