BenBrostoff / draftfast

A tool to automate and optimize DraftKings and FanDuel lineup construction.
277 stars 113 forks source link

never play these 2 players together #184

Closed ElijahFlomen closed 2 years ago

ElijahFlomen commented 2 years ago

Hi! I was having an issue where when I set this custom rule:

settings = OptimizerSettings( CustomRule( group_a=lambda p: p, group_b=lambda p: p.name == 'Patriots' or p.name == 'Jalen Hurts', comparison=lambda sum, a, b: sum(b) <= 1 )

I am getting multiple lineups with both Jalen Hurts and Patriots D/ST in my output, when I want to ensure that these two players are never together. Am I misusing the comparison to ensure that these two selections are never in the same lineup?

BenBrostoff commented 2 years ago

@ElijahFlomen So there is a test for this here:

https://github.com/BenBrostoff/draftfast/blob/master/draftfast/test/test_custom_rules.py#L84-L108

Which I think you've captured identically. Are you sure Patriots is the name of the "player" here? I'd try with some other examples and confirm this problem still happens.

BenBrostoff commented 2 years ago

Also if you post your CSV and a code snippet I can replicate with here I can debug much easier 👍

BenBrostoff commented 2 years ago

@ElijahFlomen Going to close this out. I tested in releasing 3.5.8 and I believe got this exact scenario tested and working, but feel free to open with snippet and CSV.