Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/lineup constraints #113

Merged
merged 41 commits into from
Dec 27, 2018
Merged

Feature/lineup constraints #113

merged 41 commits into from
Dec 27, 2018

Conversation

sharkiteuthis
Copy link
Collaborator

No description provided.

setup.py Show resolved Hide resolved
@sharkiteuthis
Copy link
Collaborator Author

Some tests still failing, just putting this up as a WIP so I can reference it

@sharkiteuthis sharkiteuthis changed the title [WIP] Feature/lineup constraints Feature/lineup constraints Dec 23, 2018
@sharkiteuthis
Copy link
Collaborator Author

this is ready except for tests, but the issue from #115 is blocking

Copy link
Owner

@BenBrostoff BenBrostoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, going to use for NBA Christmas games today. I released 2.2.0 if you want to give it a spin - here it is working on repl.it. My change requests are super minor, only important one to me is more detailed error messaging when no lineup solution is found.

draftfast/optimize.py Show resolved Hide resolved
draftfast/lineup_contraints.py Outdated Show resolved Hide resolved
draftfast/lineup_contraints.py Outdated Show resolved Hide resolved
draftfast/optimizer.py Show resolved Hide resolved
draftfast/lineup_contraints.py Show resolved Hide resolved
draftfast/optimizer.py Show resolved Hide resolved
@sharkiteuthis
Copy link
Collaborator Author

I think there's a bug here with multi position players and groups, I'm going to try to reproduce and create a testcase

@BenBrostoff
Copy link
Owner

FYI (this may be unrelated to the bug you're chasing) but I've noticed inconsistency in test runs with multi position players (maybe ortools related?). For NBA specifically, the same test will produce lineups with the same players but in different positions - I've worked around this just by hackily rewriting tests.

@sharkiteuthis
Copy link
Collaborator Author

yeah, it's because of that name to index map in the solver. i need to index on name+position or something

@sharkiteuthis
Copy link
Collaborator Author

can you commit a test (comment it out so it doesn't fail, i guess, or just send me the setup) that produces duplicate lineups?

@BenBrostoff
Copy link
Owner

Yep, it's this one. I think this started intermittently failing when I added the minimum 2 teams rule (which actually only really helps for Showdown, it's min 2 teams and max 4 players on one team for Classic). The roster tested here used to always be 3 guards, 4 forwards and 1 center. Sometimes this passes, but I've noticed occasionally it will be 4/3/1 or 3/3/2.

@sharkiteuthis
Copy link
Collaborator Author

It looks like that's an ortools thing, I noticed in the NFL tests, it will sometimes choose different DSTs with the same projections. I changed that test to generate a bunch of rosters and make sure they're all the same.

I changed Roster::__eq__ to use the set of player ids, so order doesn't matter when using ==, then added Roster::exact_equal which respects order and tightened up the existing tests to use exact_equal where appropriate.

There was definitely a bug for groups with multi position players, so the name->idx map is now a name->set(idx) map, which I think should fix things, but I need to write tests.

I should be ready to have this re-reviewed sometime later today.

@sharkiteuthis
Copy link
Collaborator Author

@BenBrostoff once the builds pass this should be good to go

Player count: {}
'''
.format(optimizer_settings, len(players or []))
OPTIMIZER CONSTRAINTS:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff 👍

Copy link
Owner

@BenBrostoff BenBrostoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I'll do another release once this is merged.

@BenBrostoff BenBrostoff merged commit e87c91a into master Dec 27, 2018
@BenBrostoff BenBrostoff deleted the feature/lineup-constraints branch December 27, 2018 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants