Skip to content

Pc hlp

PC_HLP(n_hubs, alpha, data)

Bases: BaseModel

Fast Lagrange Model — recursive client-aggregated formulation.

Unlike PS_HLP, this model uses aggregated client keys \((i,j,z)\) where \(z\) indexes a group of original clients. Clients are grouped by route \((i,j)\), ranked, and Lagrange multipliers \(\lambda_{ij}^z\) are computed recursively over segments. Price is not a Gurobi variable — it is inferred post-solve from the budget/weight ratio of the marginal client.

Variables:

Symbol Reproduces Variable Domain
\(x_{ik}\) [AllocationVariable][bilevelpy.models.vars.hlp_vars.AllocationVariable] \(\{0,1\}\)
\(y_{ij}^z\) RecursiveClientDecisionVariable \(\{0,1\}\)
\(X_{ijkm}^z\) \(y_{ij}^z \cdot x_{ik} \cdot x_{jm}\) RecursiveLinearXYVariable \(\{0,1\}\)

Constraints:

Constraint Reference
HLP base [NumberOfHubs][bilevelpy.models.constraints.hlp_constraints.NumberOfHubsConstraint], [SingleAllocation][bilevelpy.models.constraints.hlp_constraints.SingleAllocationConstraint], [AssignmentRestriction][bilevelpy.models.constraints.hlp_constraints.AssignmentRestrictionConstraint]
\(y = \sum X\), \(X \leq x\) RecursiveLinearizationConstraint

Objective (maximizes Lagrange-adjusted profit):

\[\max \sum_{(i,j,z) \in K} \Bigl( \lambda_{ij}^z y_{ij}^z - a_{ij}^z \tilde{c}_{ij}(x) \Bigr)\]

where \(K\) is the set of aggregated client keys and \(\lambda_{ij}^z\) are the recursive Lagrange multipliers.

Parameters:

Name Type Description Default
n_hubs int

Number of hubs to open (\(p\)).

required
alpha float

Cost scaling factor (\(\alpha\)).

required
data MultiEntityDataset

Dataset with recursive Lagrange multipliers and grouped client keys.

required
Source code in src/oracle_paper/models/pc_hlp.py
def __init__(
        self,
        n_hubs: int,
        alpha: float,
        data: MultiEntityDataset,
) -> None:
    super().__init__(data)

    self._n_hubs = n_hubs
    self._alpha = alpha

    vars = [AllocationVariable,
            RecursiveClientDecisionVariable,
            RecursiveLinearXYVariable]

    constraints = [
        NumberOfHubsConstraint,
        SingleAllocationConstraint,
        AssignmentRestrictionConstraint,
        RecursiveLinearizationConstraint,
    ]

    self.build(
        variables=vars,
        constraints=constraints,
        n_hubs=n_hubs,
    )