-
Notifications
You must be signed in to change notification settings - Fork 157
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
GenerateLineupException: Can't generate lineups. Following constraints are not valid #274
Comments
If you compare the versions you'll see that the SolverInfeasibleSolutionException was added I'm assuming to provide more context to the errors, rather than just a generic one you now get more information on which to take the appropriate action. |
Can you provide more information? What sport did you run? Did you have players for all positions? |
I had the same issue for DraftKings and Fanduel NFL. I was trying to import players from a dataframe using a |
Has anyone found a better solution for this, instead of reverting back to version 3.3 and pulp==2.2? |
Can you provide the ful code your using to load from dataframe
…On Tue, Jan 24, 2023, 12:10 PM dexter1964 ***@***.***> wrote:
Has anyone found a better solution for this, instead of reverting back to
version 3.3 and pulp==2.2?
thanks
—
Reply to this email directly, view it on GitHub
<#274 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANBWO7RPTAUB2L4YX645QDTWUAEHJANCNFSM46FIHVAQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I've actually opened an issue #402, Data returned from DB Query consists of: (Team, PlayerName, Position, Salary, FantasyPoints) FDplayers = [] and the errors that I'm getting... pydfs_lineup_optimizer.exceptions.GenerateLineupException: Can't generate lineups. Following constraints are not valid: positions_D Thank you so much for taking a look. |
Doesn't fanduel use / for position ?
RB/FLEX
…On Tue, Jan 24, 2023, 12:54 PM dexter1964 ***@***.***> wrote:
I've actually opened an issue #402
<#402>,
but here's my code.
My code is fairly generic:
Data returned from DB Query consists of: (Team, PlayerName, Position,
Salary, FantasyPoints)
[('SFO', 'Brock Purdy', 'QB', 6900.0, 15.43), ('SFO', 'Christian
McCaffrey', 'RB', 9000.0, 18.03), ('SFO', 'Elijah Mitchell', 'RB', 5600.0,
6.56),etc...]
optimizer = get_optimizer(Site.FANDUEL, Sport.FOOTBALL)
allPlayerInfo=mF.getNFLPlayerInfo('FanDuel') ## Query database and return
Player Data.
FDplayers = []
for i, player_info in enumerate(allPlayerInfo):
name = player_info[1].split(' ')
FDplayers.append(Player(
int(i),
name[0], #First Name
name[1], #Last name
player_info[2].split('-'), # Split Positions: for Fanduel use '-' for
Draftkings use '/'
player_info[0], # This should be TeamShort name.
float(player_info[3]), #This should be Fantasy Salary
float(player_info[4]) #This should be Fantasy Points
))
optimizer.player_pool.load_players(FDplayers)
lineup_generator = optimizer.optimize(3)
and the errors that I'm getting...
pydfs_lineup_optimizer.solvers.exceptions.SolverInfeasibleSolutionException:
['positions_D', 'budget', 'total_players', '_C1']
pydfs_lineup_optimizer.exceptions.GenerateLineupException: Can't generate
lineups. Following constraints are not valid:
positions_D,budget,total_players
Thank you so much for taking a look.
—
Reply to this email directly, view it on GitHub
<#274 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANBWO7RB4VK53CQHUEODEDDWUAJOTANCNFSM46FIHVAQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I think I figured it out, but haven't had a chance to test yet. |
This used to work. Now I run it (new version, 3.5) and only get the result:
This is the simplified command I ran:
for lineup in optimizer.optimize(n=10):
print(lineup)
*** Error text***
Traceback (most recent call last):
File "/xxx/lib/python3.9/site-packages/pydfs_lineup_optimizer/lineup_optimizer.py", line 394, in optimize
solved_variables = solver.solve()
File "/xxx/lib/python3.9/site-packages/pydfs_lineup_optimizer/solvers/pulp_solver.py", line 57, in solve
raise SolverInfeasibleSolutionException(invalid_constraints)
SolverInfeasibleSolutionException: ['positions_P', 'positions_C', 'positions_1B', 'positions_2B', 'positions_3B', 'positions_SS', 'positions_OF', 'total_players']
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
for lineup in optimizer.optimize(n=10):
File "/xxx/lib/python3.9/site-packages/pydfs_lineup_optimizer/lineup_optimizer.py", line 411, in optimize
raise GenerateLineupException(solver_exception.get_user_defined_constraints())
GenerateLineupException: Can't generate lineups. Following constraints are not valid: positions_P,positions_C,positions_1B,positions_2B,positions_3B,positions_SS,positions_OF,total_players
**** End***
When I try reverting to v 3.3, the only result I get is: "GenerateLineupException: Can't generate lineups."
Any idea what's happening here? Like I said it worked in previous years.
The text was updated successfully, but these errors were encountered: