breeko / Fantasy_LP

20 stars 17 forks source link

Missing constraint #1

Closed michael-quinlan closed 6 years ago

michael-quinlan commented 6 years ago

Your missing an important constraint (at least in the python code) that you can't use the same player twice. In your notebook example you will notice that Jared Cook was selected as both the TE and the FLEX (in the medium article it's DeSean Jackson as a WR and Flex).

Note: Maybe DraftKings supports the same player twice but that would be surprising as I've never seen any other platform support it.

breeko commented 6 years ago

Thanks for bringing up. I did notice this and wrote my R code to reflect that constraint. I actually think the R implementation is a lot cleaner.

I updated my python code. I removed the part where I duplicated the players and increased the number of positions available for RB, WR and TE, and just imposed an additional constraint that says that the sum RB, WR and TE can be at most 5 (allowing for one flex)