Say I have 100 users, each with varying strength, and each with a top 5 set of "preferred teammates" and a top 5 set of "preferred enemies". I want to sort the users into two teams.
User
{
int Id;
int strength;
List<int> PreferredTeammatesIds; // arbitrary limit of 5
List<int> PreferredEnemiesIds; // arbitrary limit of 5
}
I am trying to come up with an algorithm where the total strength of each team is near equal, and as many of each user's preferences are achieved.
First, I assume a perfect everyone-gets-what-they-want is highly unlikely, especially with 100 users. But is there a way to calculate the optimal alignment, or would I just have to do some sort of random mutations or genetic algorithm and keep the best lineup found in N number of generated solutions?