LpDisplacementSolver

class passengersim.rm.dynamic_prog.LpDisplacementSolver(sim: SimulationEngine, carrier: str, cabin_code: str, error_log: Path | None = None)[source]

Bases: object

Methods

__init__(sim, carrier, cabin_code[, error_log])

get_remaining_capacity(base[, leg])

Remaining seats for a leg or cabin in the displacement LP.

solve(sim, days_prior)

update(sim)

Attributes

carrier

solver

objective

lp_vars

constraints

cabin_code

warnings

error_log

carrier
cabin_code
solver
objective
warnings
error_log
lp_vars
constraints
update(sim: SimulationEngine)[source]
get_remaining_capacity(base, leg=None)[source]

Remaining seats for a leg or cabin in the displacement LP.

Parameters:
base : Leg or Cabin

The leg or cabin whose capacity constraint is being set.

leg : Leg, optional

The leg that base belongs to. When capacity sharing is on for this leg and base is an upper cabin (not Y), Y may have sold into its seats, so the result is limited to the leg’s remaining seats.

Returns:

int – Remaining seats, which may be negative if base is oversold.

solve(sim: SimulationEngine, days_prior: int) → int[source]