The Textbook Fix That Made My MILP Twice As Slow

The textbook move, when a mixed-integer program solves slowly, is to tighten the linear relaxation. Add the constraint that makes the LP bound closer to the integer optimum, give branch and bound less room to wander, watch it finish faster.

I did that to the stacking constraint in my hockey lineup optimizer last week. It got twice as slow. Same slate, same solver, same lineups out the other end — 2.20 seconds a lineup before, 4.38 after. I reverted it and left a comment telling future-me not to helpfully fix it again.

Bar chart of seconds per lineup by stacking formulation: naive 3.00, cover inequalities 2.20, two-sided counters 4.38
Three formulations of the same constraint, same slate and solver. The textbook tightening is the slowest of the three.

Continue reading “The Textbook Fix That Made My MILP Twice As Slow”

A Free NHL Lineup Optimizer for DraftKings

The NHL lineup optimizer is live. Free, no account, no email, no cap on lineups. You upload one file — the player pool exactly as it downloads from DraftKings — and it hands back a CSV formatted for re-upload.

It is the hockey version of the football optimizer and the baseball one, same solver underneath, a different rulebook on top. Hockey turned out to be the easiest of the four sports I have tried, which was a pleasant surprise after basketball, where the stacking rules turned out to barely exist at all.

NHL DFS lineup optimizer rules screen showing line and power-play stacking, goalie rules and diversity caps
The rules screen. Tier 1 is DraftKings’ own rules, Tier 2 shapes a single lineup, Tier 3 is how the set differs from itself.

Continue reading “A Free NHL Lineup Optimizer for DraftKings”