How DFS Lineup Optimizers Work — The Math, Explained Honestly
Every DFS optimizer — free, paid, whatever the marketing says — is solving the same formal problem: pick players to maximize total projection subject to exact roster slots and a salary cap. This page explains that problem, why the obvious greedy approach silently loses points, and how the exact algorithm on this site proves its answers. No calculus required; the whole thing is careful addition.
Quick answer: Lineup optimization is a multiple-choice knapsack problem: maximize the sum of projections subject to (a) exact per-position counts, (b) total salary ≤ cap, (c) each player used at most once. Exact solvers use dynamic programming to provably find the best legal lineup; greedy 'best value first' drafting fails because early picks constrain later ones. FLEX slots are handled by enumerating which position fills each FLEX, solving each case exactly.
The formal problem in one table
This is a multiple-choice knapsack problem, a cousin of the classic knapsack studied since the 1950s. It's NP-hard in general, but DFS instances are small enough (nine slots, ~150 players, salaries in $100 units) that exact dynamic programming solves them in milliseconds — which is why 'our optimizer uses advanced math' is marketing noise: at this scale, exactness is cheap and there's no excuse for heuristics.
| Piece | Meaning | DraftKings example |
|---|---|---|
| Objective | Maximize total projected points | max Σ projections of the 9 chosen |
| Slot constraints | Exact counts per position | 1 QB, 2 RB, 3 WR, 1 TE, 1 FLEX, 1 DST |
| Budget constraint | Sum of salaries ≤ cap | Σ salaries ≤ $50,000 |
| Uniqueness | Each player at most once | no double-rostering |
| Extras | User rules on top | lock, exclude, max per team |
Why greedy drafting silently loses
The intuitive approach — sort by value, draft until full — fails on a specific, fixable flaw: it makes early picks that make later slots unaffordable or understaffed. Take the classic crunch: greedy takes the cheap elite TE early, then the two value RBs, and arrives at 3 WRs needing to fit the remaining budget — and the best legal trio under what's left projects 2 points worse than a build that paid $500 more at TE. You cannot detect that by eyeball, because the loss happens three decisions after the cause. Exact solvers don't draft — they evaluate the entire legal space at once, so the TE decision is priced against every downstream consequence.
How exact solving actually works
Dynamic programming builds the answer from sub-problems: 'using only the WR list, the best 3 WRs costing at most $S' is computed for every S — a table built once, in one pass. Each position group gets its own such table; then the tables are combined under the shared budget: for every split of salary between RBs and WRs and TEs, best-plus-best. The best legal total is read off the combined table, and walking back through the decisions reconstructs the actual lineup. The FLEX slot adds one wrinkle: a FLEX can be an RB, WR or TE, so the solver solves the problem for each FLEX-position arrangement (3 options on DK, 6 on FD) and keeps the best. On this site's 146-player sample slate, the whole computation — proof included — runs in about 20 milliseconds.
What 'optimal' does and does not promise
Optimal means: no legal lineup has a higher sum of YOUR projections. It does not mean the lineup will score the most points — projections are estimates, and the contest is decided by outcomes. When two optimizers disagree, they're disagreeing about inputs (projections, rules, correlation adjustments), never about the arithmetic — the arithmetic is settled science. That's why this site puts its sample-slate math in the open: on our default numbers, DraftKings optimal is 114.8 points at exactly $50,000, and every number on every tool page is generated by that same engine at build time, so the copy can never drift from the code.
How 'alternative lineups' are generated
There's no clean closed-form for 'the 5 best distinct lineups' — near the optimum, near-ties explode combinatorially. Practical optimizers use perturbation: take the optimum, ban one of its players, re-solve exactly; that gives nine strong candidates, each provably the best lineup missing that specific player. Rank them, filter for meaningful differences (we require 2-3 changed players so you get actual choices, not permutations), repeat one level deeper if needed. Our sample slate's alternatives land within half a point of optimal — the visible signature of a slate where many builds are nearly equal.
Rules the math can't see
- Correlation between players (stack effects) — plain optimizers treat players as independent score sources; locking stacks is how you inject correlation by hand.
- News and injuries — a provably optimal lineup around a player who's inactive at kickoff is an 8-man roster.
- Ownership — the exact optimum is the most-found lineup in the field; uniqueness is a portfolio decision, not a solver output.
- Variance — a 20-projection stalwart and a 20-projection boom-bust wildcard look identical to the objective function; the Range of Outcomes tool exists to tell them apart.
Frequently Asked Questions
Do paid optimizers use better math?
What algorithm does this site's optimizer use?
Can I verify the optimizer is right?
Why do salaries get rounded to $100?
Is 20 milliseconds fast enough for real use?
More tools used in this guide
Build the highest-projected legal lineup under DraftKings ($50,000) or FanDuel ($60,000) rules — exact solver, lock/exclude players, CSV import, no signup.
Monte-Carlo simulate any 9-man lineup: floor (P5), median, ceiling (P95) and the odds of clearing your target score — deterministic and instant.
Turn any salary + projection into points per $1,000, the points needed at your target multiplier, and a surplus/deficit verdict.
More guides
The complete workflow: bring projections, lock your stack, read the alternatives, and avoid the four mistakes that make optimizer output worthless.
Every term this site uses, defined once: cash/GPP, ceiling/floor, chalk, punt, stack, bring-back, ownership, value multiplier, and the rest.