Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to develop a grouping system that takes in a bunch of data for when particular students are available to meet and then spits out the "best" groups based on that data. Here I am defining best as the set of four-person groups which has the highest average number of matching hours per group.

The problem is, I don't know how to find every permutation of sets of four-person groups.

I started thinking: I could find every possible group of four... but a person can only be in one group. How about I find every possible group of four, and then I make a set of groups based on that starting group, where I only add groups who don't contain members already existing in the set.

I'm pretty confused. Any help getting me out of this hole would be greatly appreciated!

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

I'm interpreting your question as "I want to list all partitions of a set of N distinguishable objects into partitions of size exactly 4." An easy way to do this is to list all permutations of the N objects then partitioning them into adjacent groups of 4, and throwing out the partitions that occurred already (you can do this by requiring that the partitioned parts are in lexicographic order, i.e. (abcdefgh) -> (abcd)(efgh) would pass put (efghabcd) -> (efgh)(abcd) would fail.)

share|improve this answer
    
Ahh... clever! I didn't think of finding all the permutations of N students first. Then I partition them into adjacent groups of 4... but I need to throw out the sets of partitions that have already occurred... I think I have it! I think... Yes! Thanks much! –  user13327 Jan 12 '12 at 3:48
add comment

Not sure if this what you want but as I understand, you are trying to find group(s) of $4$ from a population of $N$ where the best group has the highest common/average availibility.

By taking $4$ persons each time, the total possible number of groups you can form is $\binom{N}{4}=\frac{N!}{4!\times(N-4)!}$. So, it is indeed possible to go through all of them and check for the ones with highest average.

Alternatively, you can create sub-sets $(N_1, N_2, N_3, ...)$ out of $N$ where, for example person $(p_1,p_3,p_{10},p_{15},p_{19}, ...)$ in $N_1$, has the common hour of availibility. Now, start with the sub-sets where the population is equal or more than $4$. Find best group(s) for each of $N_1, N_2, N_3, ...$. This should give you the overall best group.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.