DimaKudosh / pydfs-lineup-optimizer

Daily Fantasy Sports lineup optimzer for all popular daily fantasy sports sites
MIT License
424 stars 157 forks source link

Issue with Soccer #388

Closed PochynokB closed 1 year ago

PochynokB commented 2 years ago

I am having an issue with soccer where I am returning the following error message:


LineupOptimizerException Traceback (most recent call last) Input In [4], in <cell line: 2>() 2 for i in range(n): 3 lineups = optimizer.optimize(iterations, randomness=True) ----> 4 for lineup in lineups: 5 print (lineup) 6 if socket.gethostname() != 'DESKTOP-PO8T8H3':

File ~\anaconda3\lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py:425, in LineupOptimizer.optimize(self, n, max_exposure, randomness, with_injured, exposure_strategy, exclude_lineups) 423 lineup_players.append(player) 424 variables_names.append(solved_variable.name) --> 425 lineup = self._build_lineup(lineup_players, context) 426 previous_lineup = lineup 427 context.add_lineup(lineup)

File ~\anaconda3\lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py:534, in LineupOptimizer._build_lineup(self, players, context, unswappable_players) 532 positions.remove(locked_position) 533 lineup.append(LineupPlayer(locked_player, locked_position.name)) --> 534 players_with_positions = link_players_with_positions(players, positions) 535 for player, position in players_with_positions.items(): 536 lineup.append(LineupPlayer(player, position.name, used_fppg=context.players_used_fppg.get(player)))

File ~\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:109, in link_players_with_positions(players, positions) 107 break 108 else: --> 109 raise LineupOptimizerException('Unable to build lineup') 110 return players_with_positions

LineupOptimizerException: Unable to build lineup

I have looked for similar errors, however, there does not seem to be much talk about soccer in here. I have also double checked with other sports and my csv looks identical to working ones. Does anyone know of a fix?

PochynokB commented 2 years ago

I was able to resolve this bug in my own code.