Assigning Partners
In several courses, students may work on labs or projects (sometimes other assignments) in small groups (usually pairs). These groups are assigned by the instructor, and groups are changed frequently. This problem seeks a program to determine these assigned groups. (Manual assignments are labor-intensive.) The basic requirements follow:
- Suppose there are N students in the class (where N is between 24 and 32). For the purposes of this problem, the students are numbered 1, …, N.
-
Early in the semester, students are given the option of indicating
- which 1–3 students they would like to work with a few times over the semester, and
- which 1–3 students they would like not to work with during the semester.
- Groups of 2 are preferred for an assignment, but a group of 3 is needed if N is odd.
- Students expressing an interest in working with another designated person may be assigned that person up to 3 times during the semester, and these repeated assignments should be spread out over several groupings. Otherwise, students should be working with someone different with each assignment.
- During the semester, a student should not be asked to work in a group of three more than once.
- Sometimes during the semester (but not often), a student drops the course. That is, the student may be assigned a group for the first several weeks, but the student should not be assigned a partner after a designated week.
Write a program that identifies and prints up to 14 assignments of students (i.e., up to one new assignment of pairs each week). The program should have the following features:
- The program is deterministic. That is, the program makes the same assignments every time it is run. (This allows the program to be run several times during the semester, if a few people drop.)
- The program provides the option that up to 8 students may drop the course after varying assignments. (In practice, there are rarely more than 2 drops, so allowing 8 is intended to be safe.)
- Under varying circumstances, it may not be possible to make different assignments each week. However, in all cases, a student should never have to work with someone they explicitly wanted to avoid. Also, the resulting assignments should have as few repeated pairs of students as possible, with students wanting to work together never having more than 4 assignments together.
