Skip to content

Commit

Permalink
Speedup max repeating player rule
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaKudosh committed Aug 19, 2019
1 parent 42ff34a commit 63be0a3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pydfs_lineup_optimizer/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ def apply_for_iteration(self, solver, players_dict, result):
max_repeating_players = self.optimizer.max_repeating_players
if max_repeating_players is None or not result:
return
for players_combination in combinations(result.players, max_repeating_players + 1):
self.exclude_combinations.append([players_dict[player] for player in players_combination])
self.exclude_combinations.append([players_dict[player] for player in result])
for players_combination in self.exclude_combinations:
solver.add_constraint(players_combination, None, SolverSign.LTE, max_repeating_players)

Expand Down

0 comments on commit 63be0a3

Please sign in to comment.