Suppose I have a class of 30 students and I want to give them 8 assignments to do in groups of 3. As far as possible I'd like the students to work with as many different students as possible. Ideally no two students would work with each other on more than one assignment.
In general I'd like to solve this for $n$ students in groups of size $k$ for $m$ assignments. I'd like pointers to when it is possible and suggestions for how to write a program to generate groups for a given list of students, assignments and group sizes.
Keywords here are "block design", "Steiner triple system" and "resolvable".
We want to find $8$ resolution classes: each partitioning $\{1,2,\ldots,30\}$ into $10$ sets of size $3$. This is going to be an ugly case, since $30 \not\equiv 1,3 \pmod 6$ (a condition for the existence of a Steiner triple system). [The question would be more mathematically interesting if you expel $3$ students from your class.]
Since any particular student partners with $2$ others for each test, we can't have more than $\lfloor (30-1)/2 \rfloor=14$ tests. I think, though, we'd be quite likely to succeed in finding $8$ tests by randomly searching.
Coincidentally, I just happen to have code left over from answering this question. It found a random $12$-test family:
My code basically attempts to extend the list by (a) creating a list of legal "triples", and (b) picks $10$ at random that don't clash. It keeps trying until it gets bored (I set it at $1000$ attempts), then backtracks and makes another random attempt. If we get enough rounds, the code switches to an exhaustive backtracking algorithm.
In some special cases, there's elegant constructions (in the sense of design theory). In general, it won't be so nicely behaved.
Here's my GAP code. I didn't attach it previously since it wasn't intended to be made public. It's not particularly neat nor optimized (and I've assumed the user would be able to edit it). It should be saved as a file and
Readinto GAP.