I would like to create a tool to split a group of persons into multiple teams "randomly". Here is a mockup that shows the UI: https://ibb.co/jDHFkdH
Inputs
To generate the teams, the tool takes as input:
- dataset of persons (firstname, lastname, any other fields as gender, level, year,...)
- number of team to generate
- constraints with weight
Constraints
There are 2 types of constraints:
- Field constraint: each team will have the same distribution of the field values. Ex: if I have a team with 60% of women and 40% of men, a Field constraint on "Gender" will make the tool trying to have each team with the same ratio
- Group contraint: use as many persons as needed from the dataset
- Should be together: the generator will create teams where the persons of this constraint will BE together
- Should not be together: the generator will create teams where the persons of this constraint will NOT BE together
The constraints are SOFT constraints. The goal is to find solutions even if it does not respect every constraints or try to respect the constraint as much as possible. For example, if I have 60% women and 40% men, a field constraint on gender would try to create teams with this ratio. A 55%/45% ratio could still be OK but this would be a less good solution.
Each constrain has a weight. This is used to order constraints by importance. If I use a scoring function, not respecting a constraint with a big weight will reduce much more the score than not respecting a constraint with a small weight.
Goal
The tool gives back the best combinations. If multiple combinations have the same score, one is randomly chosen. The user can ask the tool to give more results.
Algorithm
I have no idea how to start it. I thought first I could use a brute force approach by generating all combinations and give each one a score based on the constraints (and multiplied by the constraint's weight).
I'm not asking for a complete solution but maybe some tips, ideas, terms to search. Maybe I should use math functions, matrices, probability, etc... Or maybe a brute force approach combined to some logic to improve the speed. Thanks