What I hope to achieve is the ability to generate user “teams”. I will have x number of men weighted (decimal mental weight, for example 75.23 ) and y number of women (also with the weight value of the skill).
Given this list of users, I would take for input the number of commands to do (say, 6 teams). Then I go through the list of x and y and organize them so that the best average possible weighted teams are created. I would like the teams to be balanced (ratio of women to men)
I do not want the teams to be folded (best in one team). I would like an even distribution of weight.
Curious how could I achieve this in PHP? I would use a MySQL database to load users with weighted values. I would know in advance how many users I have and how many teams I would like to create.
I would appreciate any suggestions or links to a solution if someone found something similar. I'm just not a mathematical wiz, so I don’t know which formula will be applied here.
Thanks. I appreciate any input!
EDIT
After reviewing the answers, maybe I was not clear enough, so hopefully this helps a little more.
- I want the teams to be about the same size.
- I want the average (average) skill score for each team to be approximately equal.
- I want the ratio of men and women in each team to be about the same (that is, if we get a distribution of 5 men and 3 women in a team, I would like to keep it the same). It’s not quite a question if I sort men first and women second (or vice versa).
- I do not want a linear approach (command 1 becomes the highest, command 2, the highest second, command 3 .. so on). The Tim method of taking (if 6 teams) 6 people and randomizing and then spreading through a linear model seems to work fine.
source share