I would like to make a group/rule where I incorporate a one-off from a specified list of players into each lineup. The primary problem in the example below is that when one player is incorporated from the player group (one_off) he can also be used in stacks, so I still get the expensive one-offs in lineups that I'm trying to avoid.
Hello all,
I would like to make a group/rule where I incorporate a one-off from a specified list of players into each lineup. The primary problem in the example below is that when one player is incorporated from the player group (one_off) he can also be used in stacks, so I still get the expensive one-offs in lineups that I'm trying to avoid.
`from pydfs_lineup_optimizer import get_optimizer, Site, Sport, TeamStack, AfterEachExposureStrategy, PlayersGroup,PlayerFilter,PositionsStack
from pydfs_lineup_optimizer.stacks import GameStack, Stack
optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASEBALL)
optimizer.load_players_from_csv("Data/DKSalaries_A.csv")
optimizer.restrict_positions_for_opposing_team(['SP', 'RP'], ['1B', '2B', '3B', 'SS', 'C', 'OF', 'SP', 'RP'])
optimizer.add_stack(TeamStack(5, for_positions=['1B','2B','3B','SS','C','OF'],max_exposure = .15, spacing= 7)) optimizer.add_stack(TeamStack(2, for_positions=['1B','2B','3B','SS','C','OF'],max_exposure = .15, spacing= 4))
one_off = PlayersGroup([optimizer.player_pool.get_player_by_name(name) for name in one_offs], min_from_group=1) optimizer.add_players_group(One_off)
for lineup in optimizer.optimize(n=1): print(lineup)`