DLP¶
-
class passengersim.rm.linear_program.DLP(carrier: str, *, cabin_code: str =
'', set_bp: bool =False, debug: bool =False)[source]¶ Bases:
LpBaseDeterministic LP, can be used to get displacement for UDP Can also set bid-prices as a demo of why deterministic LP isn’t used for this purpose in any real RM system as the answer will suck :-)
The LP is:
max sum_j fare_j * x_j s.t. sum_{j uses leg l} x_j <= remaining capacity of leg l 0 <= x_j <= forecast mean demand of path class jThe duals of the capacity constraints are written to
leg.displacement(and toleg.bid_priceifset_bpis True).- Parameters:
- carrier : str¶
Name of the carrier whose network is optimized.
- cabin_code : str, default ""¶
If not empty, only path classes in this cabin are included, and each leg’s capacity constraint uses the remaining capacity of that cabin. Legs without this cabin get no constraint and zero displacement.
- set_bp : bool, default False¶
Also write the duals to
leg.bid_price.- debug : bool, default False¶
Print diagnostic output.
Methods
__init__(carrier, *[, cabin_code, set_bp, debug])get_remaining_capacity(base)Remaining (unsold) capacity of a leg or cabin, never negative.
initialize(eng)Build the LP from the current forecasts and remaining capacities.
solve(eng[, debug])Solve the LP and write the capacity duals to each leg's displacement.
test_status(status, eng[, debug])update(eng)Refresh the demand bounds and remaining capacities, keeping the LP structure.
Attributes
- carrier¶
- cabin_code¶
- set_bp¶
- debug¶
- solver¶
- objective¶
- lp_vars¶
- constraints¶
- initialize(eng: SimulationEngine) None[source]¶
Build the LP from the current forecasts and remaining capacities.
- update(eng: SimulationEngine) None[source]¶
Refresh the demand bounds and remaining capacities, keeping the LP structure.
- get_remaining_capacity(base) float[source]¶
Remaining (unsold) capacity of a leg or cabin, never negative.