Skip to content

Commit

Permalink
Skip needless constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBrostoff committed Dec 27, 2023
1 parent 465bf34 commit c89d36d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions draftfast/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,10 @@ def _set_min_teams(self):
>= self.solver.Sum(players_on_team)
)

# If min matchups is more than 1, this constraint is redundant
if len(teams) > 0 and (self.min_matchups or 0) < 2:
# If min matchups is more than or equal to min_teams, this constraint is redundant
# Ex given min matchups of two, there will always be two teams,
# so adding this constraint is needless and we skip
if len(teams) > 0 and ((self.min_matchups or 0) < self.min_teams):
self.solver.Add(self.solver.Sum(teams) >= self.min_teams)

def _set_min_matchups(self):
Expand Down

0 comments on commit c89d36d

Please sign in to comment.