0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Well, if any one of the numbers of freshmen, sophomores, juniors and seniors is not a multiple of $n$, this is impossible. As their numbers apparently sum to $100$ (I assume there are no other categories of people?) it follows that $n$ must divide $100$. If each of these four groups is nonempty, it follows that $n$ must divide $25$, i.e. either $n=1$, $n=5$ or $n=25$. $\endgroup$ – Servaes Feb 7 at 5:04
  • $\begingroup$ Also, is there any relationship between general happiness of people individually, general happiness of the people in each group, and general hapiness of the people overall, and the preferences filled out in the survey? $\endgroup$ – Servaes Feb 7 at 5:05
  • $\begingroup$ Sorry for the confusion: I meant about 100 people, not exactly 100 people. Also, some discrepancies in the number of each grade in each group could happen. $\endgroup$ – Daniel Feb 7 at 5:21
  • $\begingroup$ My thinking is that if people are grouped together with other people with similar preference answers, then the happiness of that person will be high $\endgroup$ – Daniel Feb 7 at 5:22
  • $\begingroup$ This is a strong assumption that often turns out not to hold. I'm sure such algorithms exist, though this is not my field. If there aren't too many preferences (say a dozen) then a brute force check across the four groups shouldn't take too long. $\endgroup$ – Servaes Feb 7 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.