How to divide people into groups to maximize happiness

218 Views Asked by At

I need to split about 100 people into n number of groups:

  1. There should be equal numbers of freshmen, sophomores, juniors and seniors in each group.

  2. There are certain preferences, such as the inclination to drink, that a person fills out in the survey from numbers 1 ~ 5. There are maybe three to four preferences.

How could I design an algorithm that could show the general happiness of people in each group, or maybe the general happiness of people overall?

Most essentially, how would I calculate a person's happiness within his group?

I'm looking to implement this in code, but I can't find a suitable algorithm through research.