I will put this here as as refence https://github.com/FAForever/fa/pull/2903
The method I used to find the Fairest Teams is to get each player's Trueskill and then bruit force all combinations dividing players into 2 teams. For 8 players and under it can find that result instantly, however once you start going to 10, 12 players it starts to take some time, 16 players takes a very long time.
There are a few options though.
The script could be optimised to not repeat combinations that are mirrored
e.g
team 1 | team 2 team 1 | team 2
1000 | 1200 1200 | 1000
This can half the amount of combinations
Another idea is to find the max amount of players the script can support, say 8, and use the bruit force method for that. For player numbers > then the max use another method.
Another idea is to have the script stop once over 90% is found when over 8 players or X amount of time passes.
So it does not need to go through all combinations with lots of players, just when a good % is found or a calc time passes.