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

Multiple secondary bringback stacks #280

Open
lightninglarry opened this issue Jul 16, 2021 · 6 comments
Open

Multiple secondary bringback stacks #280

lightninglarry opened this issue Jul 16, 2021 · 6 comments

Comments

@lightninglarry
Copy link

how would u force a secondary game stack, i see the force opposing qb/wr rule, but what if u want something other than that rule, like wr/wr, or rb/wr, wr/te qb/rb scenario. It only allows for one,

@DimaKudosh
Copy link
Owner

You can pass as many stacks as you want: optimizer.force_positions_for_opposing_team(('QB', 'WR'), ('WR', 'WR'))

@lightninglarry
Copy link
Author

Fanduel, havent tried Draftkings.

lineups = optimizer.optimize(n=2)
optimizer.set_min_salary_cap(59500)
optimizer.set_max_repeating_players(7)
optimizer.restrict_positions_for_same_team(('RB', 'RB'))
optimizer.restrict_positions_for_same_team(('QB', 'D'), ('RB', 'D'))
optimizer.force_positions_for_opposing_team(('QB', 'WR'), ('WR', 'WR'))
for lineup in lineups:
print(lineup)

heres my output:

  1. QB Kyler Murray QB ARI ARI@CAR 28.38 8400.0$
  2. RB Alvin Kamara RB NO NO@DET 31.1 8800.0$
  3. RB Nick Chubb RB CLE CLE@DAL 99.0 8300.0$
  4. WR Kenny Golladay WR DET NO@DET 14.7 7300.0$
  5. WR Cedrick Wilson WR DAL CLE@DAL 25.2 5000.0$
  6. WR Andy Isabella WR ARI ARI@CAR 12.9 5000.0$
  7. TE Tyler Higbee TE LAR NYG@LAR 12.8 6000.0$
  8. FLEX Christian McCaffrey RB CAR ARI@CAR 29.0 6000.0$
  9. DEF Indianapolis Colts D IND IND@CHI 15.0 4900.0$

Fantasy Points 268.08
Salary 59700.00

  1. QB Dak Prescott QB DAL CLE@DAL 28.973 8200.0$
  2. RB Alvin Kamara RB NO NO@DET 31.1 8800.0$
  3. RB Nick Chubb RB CLE CLE@DAL 99.0 8300.0$
  4. WR Tyler Lockett WR SEA SEA@MIA 20.633 7500.0$
  5. WR Kenny Golladay WR DET NO@DET 14.7 7300.0$
  6. WR Cedrick Wilson WR DAL CLE@DAL 25.2 5000.0$
  7. TE Tyler Kroft TE BUF BUF@LV 16.4 4700.0$
  8. FLEX Christian McCaffrey RB CAR ARI@CAR 29.0 6000.0$
  9. DEF Arizona Cardinals D ARI ARI@CAR 99.0 3800.0$

while it is forcing a bringback(it might not be forcing, just optimal) In these 2 examples i would assume i should get wrs from opposing Wrs or Qbs.

@DimaKudosh
Copy link
Owner

This rule doesn't work for you because you set them after calling optimize method and lineups generator doesn't apply this rule for the current run you should move it to the end.

optimizer.set_min_salary_cap(59500)
optimizer.set_max_repeating_players(7)
optimizer.restrict_positions_for_same_team(('RB', 'RB'))
optimizer.restrict_positions_for_same_team(('QB', 'D'), ('RB', 'D'))
optimizer.force_positions_for_opposing_team(('QB', 'WR'), ('WR', 'WR'))
for lineup in optimizer.optimize(n=2):
    print(lineup)

Also you call restrict_positions_for_same_team twice and the second call will override the previous, so you should set up all in one call: optimizer.restrict_positions_for_same_team(('QB', 'D'), ('RB', 'D'), ('RB', 'RB'))

@lightninglarry
Copy link
Author

thanks @DimaKudosh will try this when i get home. Didnt catch that i had that restrict twice.

@siyu
Copy link

siyu commented Sep 12, 2021

Is it possible to set max_exposure on optimizer.force_positions_for_opposing_team(('QB', 'WR'))? thanks

@lightninglarry
Copy link
Author

Is it possible to set max_exposure on optimizer.force_positions_for_opposing_team(('QB', 'WR'))? thanks

my suggestion would be to just to run optimizer more than once. First run, with whatever pct you wanted for this. 50 %....run it 5 times if you want a total of 10 lineups. 2nd run just comment it out for another 5 lineups for 5/10.

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