I want to find all possible lineup combinations for a list of players with one at each position. However, the positions and player eligibilities aren't mutually exclusive.
In the below table I assigned player IDs (A-T) and position IDs (1-9), and made a table off of their eligibilities where 1 means they are eligible and 0 means they are not.
For a "lineup", I need the following quantity at each position. Note that MI is a combination of 2B + SS, CI is 1B + 3B, and UT is any player.
I want to find a way to compute all possible lineup combinations for positions 1-9 without duplicating (e.g. if player B is at 1B he cannot also play CI) . The order of the players does not matter, for instance if player B and F are both in the lineup, I don't care which is at 1B and which is at CI. I just want a list of all possible 13-player combinations.
What will the output look like? A string of player ID text showing letters of those in the lineup? (e.g. "ABCDEGFHIJKLM")
The end goal is to use projections to 1) optimize the lineup by points and 2) find out which positions need more options in order to optimize points, but this is how I envision the first step playing out.
In the below table I assigned player IDs (A-T) and position IDs (1-9), and made a table off of their eligibilities where 1 means they are eligible and 0 means they are not.
Player | ID | Eligiblility | C (1) | 1B (2) | 2B (3) | 3B (4) | SS (5) | MI (6) | CI (7) | OF (8) | UT (9) |
Willson Contreras | A | C | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Cody Bellinger | B | 1B,OF | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
Mike Moustakas | C | 2B,3B | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
Rafael Devers | D | 3B | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
Javier Baez | E | SS | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
Rhys Hoskins | F | 1B | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Fernando Tatis Jr. | G | SS | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
Kris Bryant | H | 3B,OF | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 |
Yordan Alvarez | I | OF | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Starling Marte | J | OF | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
J.D. Martinez | K | OF | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Victor Robles | L | OF | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Bo Bichette | M | SS | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
Joey Votto | N | 1B | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Nick Solak | O | 2B,3B | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
Carlos Correa | P | SS | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
Andrelton Simmons | Q | SS | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
Bryan Reynolds | R | OF | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Nick Senzel | S | OF | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Nick Madrigal | T | 2B,SS | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
For a "lineup", I need the following quantity at each position. Note that MI is a combination of 2B + SS, CI is 1B + 3B, and UT is any player.
Position ID | Position | Quantity Needed |
1 | C | 1 |
2 | 1B | 1 |
3 | 2B | 1 |
4 | 3B | 1 |
5 | SS | 1 |
6 | MI | 1 |
7 | CI | 1 |
8 | OF | 5 |
9 | UT | 1 |
I want to find a way to compute all possible lineup combinations for positions 1-9 without duplicating (e.g. if player B is at 1B he cannot also play CI) . The order of the players does not matter, for instance if player B and F are both in the lineup, I don't care which is at 1B and which is at CI. I just want a list of all possible 13-player combinations.
What will the output look like? A string of player ID text showing letters of those in the lineup? (e.g. "ABCDEGFHIJKLM")
The end goal is to use projections to 1) optimize the lineup by points and 2) find out which positions need more options in order to optimize points, but this is how I envision the first step playing out.