BenBrostoff / draftfast

A tool to automate and optimize DraftKings and FanDuel lineup construction.
282 stars 112 forks source link

Support player pools #82

Closed BenBrostoff closed 5 years ago

BenBrostoff commented 5 years ago

The idea here would be to be able to pass the optimizer a subset of the slate and have these be the only players the optimizer can choose from.

The next part here (which would be substantially more difficult) would be to allow passing a pool and maximum exposures as a CSV that looks something like this:

name, exposure
Player A, 0.90
Player B, 0.35
Player C, 0.5

Any player with a percentage not specified would be assumed to be allowed to be 100% of lineups, and at minimum would need to be in at least 1%.

BenBrostoff commented 5 years ago

After discussing, this would be:

name, min_exposure, max_exposure
Player A, 0.1, 0.3
sharkiteuthis commented 5 years ago

I made a branch that builds on yours -- instead of locking players in deterministically, it uses random.random to decide when to enforce a lock while still respecting the maximum exposure. That way if you have a lot of exposure constraints, they aren't all forced into the first lineups generated.

I'm thinking of my use case here because I tend to start with a smallish player pool (2-4 QB, 10 pricey skill players, ~30 cheaper skill players) and then use exposure limits to mix those up over 100-150 lineups.

It's still not great, because if I want 5-10% Nick Mullens and >35-50% Lamar Jackson and random.random() spits out <0.5, it will try to lock both. That could be fixed by e.g. taking Mullens for r<=0.1 and Jackson for r>0.1 and r<=0.6, but then you have to enforce sum(mins) <= 1 or be clever about scaling the bounds on each iteration.

It would also be nice to have group constraints. E.g. I want at least 30% each of MG3, CMC, Saquon, DJ, Chubb and I want each lineup to have at least 2 of those 5.

BenBrostoff commented 5 years ago

@sharkiteuthis I think the deterministic and random approach are both valuable and we should have flags where the user can choose either. The group constraints I agree would be awesome but let's handle that in a separate issue.

Let me get my branch merged in first and then you can PR onto develop.

sharkiteuthis commented 5 years ago

I'll leave keep the deterministic approach and add flags (-random_exposure and -random_exposure_seed?) for my approach when I put in the PR.

BenBrostoff commented 5 years ago

👍 , those flag names are good by me.

sharkiteuthis commented 5 years ago

I also added an exposure table:: image