Recursive lagrange
RecursiveLagrangeCalculator()
¶
Bases: TrackableProcessor
Compute recursive Lagrange multipliers for the PC-HLP model.
Groups clients on the same route \((i,j)\) that have already been
sorted by
LinearClientRanker,
then merges adjacent client segments where the Lagrange-to-weight
ratio is non-increasing. The merged groups form aggregated clients
indexed by \((i,j,z)\) where \(z\) is now a group index.
Adds four entities to the dataset:
Source code in src/oracle_paper/data/calculator/base.py
process(dataset)
¶
Compute recursive Lagrange multipliers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
MultiEntityDataset
|
Dataset with Lagrange multipliers, weights, budgets, and client keys (modified in-place). |
required |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If required entities are missing. |
Source code in src/oracle_paper/data/calculator/recursive_lagrange.py
sort_lagrange_multipliers_dict(dict_lagrange, dict_keys, dict_a)
staticmethod
¶
Merge adjacent clients where Lagrange/weight ratio is non-increasing.
Uses a stack-based algorithm: iterates over sorted clients and merges when \(\lambda_k/a_k > \lambda_{k+1}/a_{k+1}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_lagrange
|
dict[int, float]
|
\(\{z: \lambda_{ij}^z\}\). |
required |
dict_keys
|
dict[int, int]
|
\(\{z: \text{original client IDs}\}\). |
required |
dict_a
|
dict[int, float]
|
\(\{z: a_{ij}^z\}\). |
required |
Returns:
| Type | Description |
|---|---|
dict[int, float]
|
|
dict[int, list[int]]
|
and grouped client ID lists. |