pydfs-lineup-optimizer icon indicating copy to clipboard operation
pydfs-lineup-optimizer copied to clipboard

Ownership Constraint?

Open Pro1spect opened this issue 2 years ago • 2 comments

Is there a way where you can have the opt pick like 3 players with 2.5% ownership projection, 2 players with 10%, and 2 players with 25%?

Something like this: ownershipprojection

Pro1spect avatar Sep 13 '21 23:09 Pro1spect

You can do this using player groups like this:

for (min_value, max_value, total) in [(0, 0.025, 3), (0.025, 0.1, 2), (0.1, 0.25, 2)]:
    optimizer.add_players_group(PlayersGroup(
        [player for player in optimizer.players if min_value <= player.projected_ownership < max_value],
        min_from_group=total,
        max_from_group=total,
    ))

DimaKudosh avatar Sep 27 '21 19:09 DimaKudosh

Lets say the ownerships are these 0.259 0.252 0.237 0.209 0.167 0.165 0.157 0.152 0.135 0.133 0.13 0.129 0.119 0.117 0.106 0.103 0.098 0.086 0.081 0.069 0.063 0.055 0.052 0.047 0.041 0.033 0.033 0.03 0.024 0.017 0 0 0 0 0 0 0 0 0 0

if i use the above code the optimizer cant generate lineups but if i enter it like this lets say

for (min_value, max_value, total) in [(0.000, 0.05, 1), (0.133, 0.259, 1)]:
    optimizer.add_players_group(PlayersGroup(
        [player for player in optimizer.players if min_value <= player.projected_ownership < max_value],
        min_from_group=total,
        max_from_group=total,
    ))

It worked fine, So i believe the logic here isnt right, second set of code i entered the exact values from the list and it can generate lineups.

The min Value has to be exact... If i use it like this [(0.000, 0.133, 1), (0.133, 0.300, 7)] That would result in error So im thinking id like to insert a range fuction here some how

If i entered .010 it wouldnt find that in the list of ownerships and result in error and cant generate a lineup

Denwen12 avatar Jan 30 '22 03:01 Denwen12