フィルターのクリア

Random partner (n=10), no repeats.

2 ビュー (過去 30 日間)
Dude
Dude 2016 年 8 月 31 日
コメント済み: Dude 2016 年 8 月 31 日
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 件のコメント
John D'Errico
John D'Errico 2016 年 8 月 31 日
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.

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2016 年 8 月 31 日
編集済み: John D'Errico 2016 年 8 月 31 日
Easy peasy, and very possible, as long as you stop after 9 rounds of problems.
Using pencil and paper. As I said, this is a round robin tournament. Fix student 1 in position. Then starting with the configuration in the first round, just rotate the students in a clockwise fashion.
Round 1:
1 2 3 4 5
10 9 8 7 6
Round 2:
1 10 2 3 4
5 6 7 8 9
Round 3:
1 5 10 2 3
6 7 8 9 4
Round 4:
1 6 5 10 2
7 8 9 4 3
Round 5:
1 7 6 5 10
8 9 4 3 2
Round 6:
1 8 7 6 5
9 4 3 2 10
Round 7:
1 9 8 7 6
4 3 2 10 5
Round 8:
1 4 9 8 7
3 2 10 5 6
Round 9:
1 3 4 9 8
2 10 5 6 7
In each "round" just pair the students in any given column. There are no repeats after 9 rounds. So, in round 1, student 1 pairs with student 10, 2 pairs with 9, etc.
If you prefer, you can write this in the form of a 9x10 array. However, I will NOT do your homework for you. If you want to do this in MATLAB, you need to write code to do exactly what I just did. But that part is easy, IF you make the effort. I've done all the work for you.
  1 件のコメント
Dude
Dude 2016 年 8 月 31 日
John, I appreciate your guidance on this. I wasn't necessarily asking for the answer, rather just some assistance on how I would go about this. You da man!

サインインしてコメントする。

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 8 月 31 日
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.
  1 件のコメント
Dude
Dude 2016 年 8 月 31 日
Okay. That's helpful. So If I change up the question a little bit by adding the upper bound of 9 homework assignments, would this problem now be possible?

サインインしてコメントする。


Image Analyst
Image Analyst 2016 年 8 月 31 日
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.
  1 件のコメント
Dude
Dude 2016 年 8 月 31 日
Yes, but I need to make sure that each of the other 9 students get pair with a classmate ensuring no two students get paired with a repeat partner.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by