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

Using GameStack and TeamStack together #406

Open
austinjohnson opened this issue Apr 4, 2023 · 1 comment
Open

Using GameStack and TeamStack together #406

austinjohnson opened this issue Apr 4, 2023 · 1 comment

Comments

@austinjohnson
Copy link

austinjohnson commented Apr 4, 2023

I am using GameStack and TeamStack together. I aim to create a 5-3 stack from the same game.
Here is my code:

from pydfs_lineup_optimizer import Site, Sport, get_optimizer, TeamStack
from pydfs_lineup_optimizer.stacks import GameStack

optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASEBALL)
optimizer.load_players_from_csv("/Users/aus10/Downloads/DKSalaries.csv")
optimizer.add_stack(GameStack(8, min_from_team=3))
optimizer.add_stack(TeamStack(5, for_teams=['TEX', 'STL', 'TOR', 'TB', 'WAS'], for_positions=['C', 'SS', 'OF', '1B', '2B', '3B']))
optimizer.add_stack(TeamStack(3, for_positions=['C', 'SS', 'OF', '1B', '2B', '3B']))
optimizer.restrict_positions_for_opposing_team(['SP', 'RP', 'P'], ['C', 'SS', 'OF', '1B', '2B', '3B'])

lineup_generator = optimizer.optimize(1)
for lineup in lineup_generator:
    print(lineup)

raise SolverInfeasibleSolutionException(invalid_constraints)
pydfs_lineup_optimizer.solvers.exceptions.SolverInfeasibleSolutionException: ['_C21', '_C167', '_C196', '_C445', '_C615', '_C781', '_C786', '_C811', '_C817', '_C823', 'budget', 'total_players', 'positions_2B_OF', 'positions_2B_C_OF', 'positions_2B_3B_OF', 'positions_2B_OF_SS', 'positions_2B_3B_C_OF', 'positions_2B_C_OF_SS', 'positions_1B_2B_3B_OF', 'positions_2B_3B_OF_SS', 'positions_1B_2B_3B_C_OF', 'positions_2B_3B_C_OF_SS', 'positions_1B_2B_3B_OF_SS', 'positions_1B_2B_3B_C_OF_SS']

raise GenerateLineupException(solver_exception.get_user_defined_constraints())
pydfs_lineup_optimizer.exceptions.GenerateLineupException: Can't generate lineups. Following constraints are not valid: budget,total_players,positions_2B_OF,positions_2B_C_OF,positions_2B_3B_OF,positions_2B_OF_SS,positions_2B_3B_C_OF,positions_2B_C_OF_SS,positions_1B_2B_3B_OF,positions_2B_3B_OF_SS,positions_1B_2B_3B_C_OF,positions_2B_3B_C_OF_SS,positions_1B_2B_3B_OF_SS,positions_1B_2B_3B_C_OF_SS

@BenikaH
Copy link

BenikaH commented Jun 3, 2023

If you're doing a GameStack, do you need to specify the TeamStacks as well??? Have you tried using only GameStack and without the two TeamStacks? I was able to do this with only GameStack before.

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

2 participants