Random partner (n=10), no repeats.
Show older comments
I've been tasked with completing an activity where there are a total of 10 students in my class. I must be a partner with each student once for every homework assignment given. That being said, no two students are allowed to have repeat partners.
Are there any equations I can use in MATLAB to create this selection? I'm new to MATLAB and a bit unfamiliar on how I would go about this.
Thanks!
1 Comment
John D'Errico
on 31 Aug 2016
No. there are no "equations" to do this specific task. Anyway, asking for an equation to accomplish some programming task is meaningless. In fact, this is not a question about MATLAB at all, at least not at this point. And once you read the link I've given you below, the entire table is trivial to write down using paper, so again, no MATLAB content is involved.
I'd recommend that you do some reading. The place to look is under round-robin tournaments.
https://en.wikipedia.org/wiki/Round-robin_tournament
Read the section under scheduling algorithms. In fact, that is sufficient to write down the complete set of pairings using only pencil and paper.
Accepted Answer
More Answers (2)
Walter Roberson
on 31 Aug 2016
0 votes
No, in general this problem is impossible, because no upper bound is given on the number of homework assignments, and after 9 homework assignments each student would have run out of "unused" students to do homework with.
Image Analyst
on 31 Aug 2016
Why can't you just do
numberOfHomeworkAssignments = 9;
iWorkWith = randperm(numberOfHomeworkAssignments)
Results:
iWorkWith =
7 5 4 3 6 9 2 8 1
This gives the student ID# that you're supposed to work with for that homework assignment.
So, on homework assignment #1, you work with student #7.
On homework assignment #2, you work with student #5.
On homework assignment #3, you work with student #4.
On homework assignment #4, you work with student #3.
and so on. You never will work with the same student on more than 1 assignment.
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!