lagrangian
lagrangian
¶
Lagrangian dual decomposition for FPL squad selection.
Relaxes the budget constraint into the objective and solves via subgradient ascent. The inner problem decomposes into per-position sorting problems, each solvable in O(n log n).
This provides: - A dual upper bound on the ILP optimum - A near-optimal primal solution via rounding - Convergence diagnostics for the 18-660 report
LagrangianResult
dataclass
¶
LagrangianResult(
full_squad: Optional[FullSquad] = None,
primal_objective: float = 0.0,
dual_bound: float = 0.0,
duality_gap: float = 0.0,
n_iterations: int = 0,
converged: bool = False,
solve_time: float = 0.0,
dual_history: list[float] = list(),
primal_history: list[float] = list(),
lambda_history: list[float] = list(),
budget_slack_history: list[float] = list(),
)
Convergence diagnostics for the Lagrangian solver.
LagrangianOptimizer
¶
LagrangianOptimizer(
budget: float = 100.0,
max_from_team: int = 3,
max_iter: int = 200,
tol: float = 0.01,
risk_aversion: float = 0.0,
)
Lagrangian relaxation for the FPL squad selection ILP.
Relaxes the budget constraint into the objective:
L(lambda) = max_{x in X} sum_i (mu_i - lambda * c_i) * x_i + lambda * B
where X encodes squad size, position quotas, and team caps. The inner maximization decomposes: for each position, select the top-k players by modified score (mu_i - lambda * c_i).
The dual problem min_{lambda >= 0} L(lambda) is solved via subgradient ascent.
| PARAMETER | DESCRIPTION |
|---|---|
budget
|
Total budget (default 100.0).
TYPE:
|
max_from_team
|
Maximum players from same club.
TYPE:
|
max_iter
|
Maximum subgradient iterations.
TYPE:
|
tol
|
Convergence tolerance on duality gap.
TYPE:
|
risk_aversion
|
Mean-variance penalty (same as ILP).
TYPE:
|
Source code in fplx/selection/lagrangian.py
solve
¶
solve(
players: list[Player],
expected_points: dict[int, float],
expected_variance: Optional[dict[int, float]] = None,
best_known_primal: Optional[float] = None,
) -> LagrangianResult
Solve via Lagrangian relaxation with subgradient ascent.
| PARAMETER | DESCRIPTION |
|---|---|
players
|
TYPE:
|
expected_points
|
TYPE:
|
expected_variance
|
TYPE:
|
best_known_primal
|
Best known primal objective (e.g., from ILP). Used for better step size computation.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LagrangianResult
|
|
Source code in fplx/selection/lagrangian.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |