Generating Lists in Mathematica - Solve Student Partnering Problem

  • Context: Mathematica 
  • Thread starter Thread starter sambroni
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around generating unique student pairings for a lab course using Mathematica. The goal is to create lists of pairs for 20 students over 11 weeks, ensuring that no two students are paired more than once throughout the term. The focus is on the technical implementation of list generation and the constraints involved in the pairing process.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes their initial approach using Mathematica's list functions to generate pairings but struggles with refining the output to meet specific requirements.
  • Another participant seeks clarification on the problem, indicating confusion about the intended use of the lists.
  • A later reply clarifies that the goal is to create 11 lists of 10 pairs each, ensuring that each student is paired uniquely each week without repetition.
  • One participant expresses doubt about the feasibility of the problem, noting the limited number of possible pairs (190) compared to the required pairs (110) and the strict constraints on pairing.
  • Another participant shares a Mathematica code snippet attempting to explore random permutations of pairs but reports unsuccessful outcomes in finding a valid solution.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the feasibility of the problem, with some expressing skepticism about finding a valid solution given the constraints, while others are focused on the technical implementation of the pairing process.

Contextual Notes

The discussion highlights the complexity of generating unique pairings under strict constraints, including the limitations of the number of possible combinations and the requirement for each student to be paired exactly once per week.

sambroni
Messages
3
Reaction score
0
Hi-

I TA two lab sections, for which I need to have different partners for every student throughout the term. It's sort of a headache to do this by hand and it seemed like the Mathematica list function should be able to do this in a snap; but I'm having trouble writing the rules and syntax I need. I've been able to generate the lists via:
Table[Thread[{Table[i, {i, 16}],
Table[Mod[j + k, 16] + 1, {j, 16}]}], {k, 0, 10}]
but have had trouble winnowing down the lists.

Any help on this problem would be very appreciated. Thanks!
 
Physics news on Phys.org
Any thoughts?
 
I didn't understand your problem description. I get that you want to use lists, but not what you want to do with them.
 
Thanks for your response.

The issue is that I need to pair up students each week (2 per group) from a class of 20. I have 11 weeks, and no two students may be in the same pair over the course of the semester. So I need to generate eleven lists of ten pairs such that 1-20 are paired up each week, and that no pairs are repeated.

e.g., week 1 could look like:
{{1,2},{3,4},{5,6},{7,8},{9,10},{11,12},{13,14},{15,16},{17,18},{19,20}}

and week 2 (up to week 11) couldn't reuse those pairs.

Thanks again!
 
I am not sure that there is a solution to this problem. There are only 190 possible pairs, and you have to use 110 of them. However, you have a very strong constraint that in each group of 10 pairs you must use each person exactly once. This severely constrains the number of possible combinations. I tried a few hundred thousand random permutations and didn't get a single successful one.

nStudents = 20;
nWeeks = 11;

lst = Table[
tmp = With[{pairs = KSubsets[Range[nStudents], 2]},
Take[Partition[
Permute[pairs, rnd = RandomPermutation[Length[pairs]]],
nStudents/2], nWeeks]]; {Table[nStudents, {nWeeks}] ==
Map[Length, Map[Union, Flatten[tmp, {{1}, {2, 3}}]]],
rnd}, {100000}];
Union[lst[[All, 1]]]
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 2 ·
Replies
2
Views
7K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K