Closed sansbacon closed 7 years ago
I do not believe so. I looked at this in the past and ended up writing my own from scratch.
On Mon, Mar 13, 2017, 6:31 PM Eric Truett notifications@github.com wrote:
From reviewing the code, I can't tell if the optimizer handles multi-position eligibility
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AFpAH359ZN7PEZ7w5JKf0g-4qpWN5Y9pks5rldHDgaJpZM4Mb8kf .
What constraints did you add? No more than 1 of a player ID?
If you add a player multiple times to the pool for different positions, you could create a constraint like this. for pid in set([p.id for p in players]): prob += sum([x[player] for player in players if player.id == pid]) <= 1
I'll look into it on weekends.
Kudos to the optimizer that was created, it really is a great solution, efficien, is very customizable, and fits my exact needs. I just wanted to second that I am still encountering this issue where a player with multiple positions will be added to the lineup as a member of both those positions.
A work around I found was adding the player twice to the pool, assigning them a unique id, then creating a constraint in the optimizer listed above (this was inserted into the optimizer function):
for pid in set([p.id for p in players]):
prob += lpSum([x[player] for player in players if player.id == pid]) <= 1
What version of library you use? It should be fixed in latest version.
I'm running version 1.1.2 of the library and python 2.7
Can you provide info about site and sport and players list sample?
From reviewing the code, I can't tell if the optimizer handles multi-position eligibility