Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Can't generate lineups" when I set "player.min_exposure" #190

Open
oraj92 opened this issue Aug 26, 2020 · 7 comments
Open

"Can't generate lineups" when I set "player.min_exposure" #190

oraj92 opened this issue Aug 26, 2020 · 7 comments

Comments

@oraj92
Copy link

oraj92 commented Aug 26, 2020

The Error Code

File "C:\Users\Me\Desktop\NC\Optimizer\pydfs_lineup_optimizer\lineup_optimizer.py", line 422, in optimize
raise LineupOptimizerException('Can't generate lineups')

LineupOptimizerException: Can't generate lineups

appears always when I set the min exposure of players (I tried different min exposures like 0.05 or 0.01). I do not believe that it is impossible to create my given number of Lineups (100) with this spec so there has to be another error that stops the algo. Has anyone experienced this issue? Do you have an idea how to fix this?

In general my Lineups are to heavy weighted for value players and for example in NBA the proj difference between 2 players is 3 points but that makes the higher projected player have an exposure of over 70% and the other one 0%. I want to have a more flat exposure outcome.

Any help is appreciated!

@oraj92
Copy link
Author

oraj92 commented Aug 26, 2020

The weird thing I just found out and is really interesting: I just ran 400 LUs with min 0.05 and max 0.35 and IT WORKED. Then SECOND try with the same specs!! and the error "Can´t generate lineups" appears. Both runs were with randomness=true

@DimaKudosh can you help here maybe?

@sansbacon
Copy link
Contributor

You can also use the randomize feature to solve this problem. If projections are close on a point-per-dollar basis, then it will even out your exposures. If you are generating a large number of lineups, you probably don't want to use identical projections for each lineup.

iterations = 150
min_deviation = 0
max_deviation = .15
optimizer.set_deviation(min_deviation, max_deviation)

for _ in range(iterations):
    for lineup in optimizer.optimize(1, randomness=True):
        lineups.append(lineup)

@tehseenkhan009
Copy link

sir this does not help and gives for this line for lineup in optimizer.optimize(n=number_lineups, max_exposure=max_exposure, exposure_strategy=exposure_strategy, randomness=True): this exception raise LineupOptimizerException('Can't generate lineups')

@sansbacon
Copy link
Contributor

My example is instead of using max_exposure and exposure_strategy - the idea is that you can accomplish the same end result (not too high % of player in your lineups) by randomizing their projections.

Take an example of Player A with projection of 10 and salary of 5000, player B has a projection of 9.6 and a salary of 5000. The optimizer will always choose Player A over Player B. If you randomize the projections by up to 15% over 150 lineups, you are going to get a mix of Player A and Player B.

Iteration 1, Player A is decreased by 5%, so projection is 9.5, Player B is increased by 10%, so projection is 10.55 and would be chosen over Player A.

Iteration 2, Player A increased by more than Player B, so player A would be chosen over Player B, and so on and so forth.

The bottom line is that most choices to limit ownership (I only want 40% of this player, etc.) are fairly arbitrary, so why not let randomization do the work for you?

@tehseenkhan009
Copy link

for lineup in optimizer.optimize(n=number_lineups, max_exposure=max_exposure, exposure_strategy=exposure_strategy):
for player in lineup.players:
player_usage[player.full_name] = player_usage[player.full_name] + 1
csv = csv + player.id + ','
lineups.append(lineup)
csv = csv[:-1] + '\n'
sir this is my code and i used the randomnes as well but that does not help out

@tehseenkhan009
Copy link

2020-10-07 01-41-41.zip

@tehseenkhan009
Copy link

sir i am waiting for ur response how can i make the lineups upto 150 in the minimum time in my scenario so request time out does not happen pr use the background worker for it?? @sansbacon @trevordavies095

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants