Assign🔗

    1 What is This Assignment’s Purpose?

    2 Theme Song

    3 Problem Setup

    4 Assignment

    5 Testing

    6 Analysis

    7 Starter

1 What is This Assignment’s Purpose?🔗

One of the cornerstones of computer science is being able to use a computer to solve problems faster than pen and paper could. Whether assigning lab sections to over 60 students, or something else, we need something that not only solves the problem, but does so faster and/or more correctly and/or better than it’d normally be without technology. This assignment encourages you to think about computation applied to a real-life problem that should be very familiar to you.

2 Theme Song🔗

Priority by Bad Bad Hats

3 Problem Setup🔗

Imagine you are running this course. Each student has to attend a weekly lab, and they all need to be assigned to labs that fit their schedules and preferences. They provide you their preferences; you assign them to labs. There are too many students to do it by hand correctly and painlessly and in a reasonable amount of time.

4 Assignment🔗

The course you are running has three labs, each with the same maximum capacity.

The student preferences are given as a table, PreferenceTable, in the following format:

student-id :: Number, lab-1-pref :: Preference, lab-2-pref :: Preference, lab-3-pref :: Preference

If, for instance, students had filled out their preferences in a Google Drive form, their information can be saved as a Google Sheet, which can then be imported directly into Pyret…Just sayin’. A Preference is defined as follows:

data Preference:

  | first

  | second

  | third

  | unavailable

end

Your task is to assign every student to a lab. They should be given a lab for which they are available, through whatever process you deem best. Return a lab assignment solution represented as an AssignmentTable, in the following format:

table: student-id :: Number, lab-assigned :: Number

You should implement this function:

assign :: Number, PreferenceTable -> AssignmentTable

where the first parameter is the capacity of each lab.

You can assume:
  1. Each student has exactly one (no more, no fewer) row in the table.

  2. For a given student, first, second, and third will appear at most once in their preferences.

  3. The total number of students is no more than the total lab capacity. (That is, the number of rows in the table is no more than three times the first parameter to the function.)

You cannot assume anything else.

If you feel you cannot work with the contract of assign as written, and you want to change the output type, you are welcome to do so (and document it, as noted below). We do not want you to change the input type, because that would break the autograder, which will result in outcomes that will make you sad.

5 Testing🔗

Think about all the essential scenarios that need to be considered for this problem. For each scenario, please construct a small example PreferenceTable (no more than 5–7 rows) that would serve as an input to exercise it.If large size is itself something you think important, you can give a verbal description of the nature of the table rather than the actual table itself.

While of course one table can illustrate more than one scenario, cramming too many different situations into one can make the table too hard to understand. Your goal here is communication, not showing your cleverness. Thus, try to have separate examples that are each simple to understand in their own right, and only reuse them if it doesn’t make things too complicated.

6 Analysis🔗

In addition to your code, also write an analysis of your work, answering the following questions:

  1. If you changed the output type, tell us what you changed it to and why that change is important. If you didn’t, you can just say you made no change.

  2. Please show us your example tables. For each one, explain what interesting scenario(s) it covers and, unless it is obvious, how.

  3. What properties might make one solution better than another? What would constitute a “good” solution? What would constitute a “fair” solution? Are these the same?

  4. Briefly, what approach did you take to assigning students to labs, and which of your properties does it satisfy and fail to satisfy?

  5. How easy would it be to change your solution if there was a variable number of labs, and each lab was of a different size?

Your analysis should be submitted as PDF. (If you use Word, Google Docs, etc., please export to PDF.) It should have a clear indication of where your answer begins and ends for each of the above parts.

7 Starter🔗

Template