Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weekly group assignment algorithm

A friend of mine who who is a teacher has 23 students in a class. They want an algorithm that assigns students in groups of 2 and one group of 3 (handle the odd number of students) across 14 weeks such that no two pairs repeat across the 14 weeks (a pair is assigned to one week).

A brute force approach would be too inefficient, so I was thinking of other approaches, matrix representation sounds appealing, and graph theory. Does anyone have any ideas? The problems that I could find deal only with 1 week and this answer I could quite figure out.

like image 838
mihajlv Avatar asked Mar 07 '13 14:03

mihajlv


2 Answers

Round-robin algorithm will do the trick i think.

Add the remaining student to the second group and you are done.

First run
1   2   3   4   5   6   7   8   9   10  11  12
23  22  21  20  19  18  17  16  15  14  13

Second run
1   23  2   3   4   5   6   7   8   9   10  11  
22  21  20  19  18  17  16  15  14  13  12

...

like image 165
solidrevolution Avatar answered Oct 28 '22 11:10

solidrevolution


Another possibility might be graph matching, 14 distinct graph matchings would be needed.

like image 37
mihajlv Avatar answered Oct 28 '22 12:10

mihajlv