This section will cover a demonstration of the proposed system. We will be using the Hungarian method for assignment. The process will be described below.

Hungarian method explained

  1. Create a square with the assignment option along the top of the matrix and student along the left side with the elements of each coordinate being the cost of making said assignment. This means that each column represents one possible dorm assignment option and each row represents one group that can possible be assigned to that room. The values associated with each column and row represents the cost of assigning row x group to column y dorm room.
  2. If the matrix is not square, create dummy rows (assignments) for students who will not be assigned.
  3. Find the smallest value in each row and subtract that value from every element in that row.
  4. Find the smallest value in each column and subtract that value from every element in that column.
  5. Draw the least amount of vertical and horizontal lines through the matrix so that each zero is crossed out. If the number of lines equals the number of rows, skip to step 9.
  6. Find the smallest element that is not crossed out and add that value to every value that is crossed out and add it twice if the value is crossed out twice.
  7. Find the smallest value in the matrix and subtract it from every value in the matrix.
  8. Go to step 5.
  9. Choose zeros so that each row and column only have one zero selected. These are the student assignments.
  10. Find the values for each element in the original matrix and add them together to find the assignment cost. Do not add the values for the dummy assignments

Assignment Cost

First, we must assign cost to each associated assignment. A student being assigned to their top preference will cost the least and their last preference will cost the most. The goal is to minimize the cost and thus maximize the top preferences assigned.

Preference Assignment Cost
1st Choice + 1
2nd Choice + 2
3rd Choice + 3
4th Choice + 4
5th Choice + 5
6th Choice + 6
7th Choice + 7
8th choice + 8
9th choice + 9

Sample Housing Data

For this implementation, we will focus on students who have a group of four. While there will be one housing round and deadline, each group size will go through the assignment process individually which allows us to focus on individual groups sizes. For the purposes of evaluation, we will simulate group four assignments with the following housing availability:

Group size

/Option

4
Modern

Double(s)

 

5 slots
Modern

Single(s)

 

5 slots
Traditional

Single(s)

 

5 slots
Village Single(s)

 

5 slots
Village East

 

5 slots
U. Drive

 

5 slots
Millbrook 5 slots
 

This demonstrates 7 different options with 35 total slots available.

Sample Group Data

We now need to get sample housing preferences from groups. We chose to do 35 groups to make the numbers easy. Normally we would use the google survey to get group preferences but for the demonstration we generated random preferences using the RANDBETWEEN(1,7) function in excel.

Group Modern Double Modern Single Trad. Singles Village Singles Village East U. Drive Millbrook
1 1 2 4 5 3 7 5
2 5 5 1 5 5 5 5
3 3 6 2 7 6 6 1
4 2 7 2 1 4 4 7
5 5 7 4 4 3 4 5
6 3 1 5 6 2 7 1
7 4 6 2 2 5 3 4
8 6 6 5 6 2 6 2
9 1 5 5 1 4 4 7
10 4 1 7 7 5 5 2
11 7 6 5 2 7 5 2
12 3 2 5 1 4 5 4
13 6 4 1 5 7 5 4
14 7 6 3 2 2 3 1
15 6 5 3 7 5 1 5
16 6 1 2 3 7 3 1
17 1 3 7 6 2 5 3
18 7 5 2 3 4 2 2
19 3 5 3 2 1 6 6
20 3 3 6 7 1 2 5
21 4 5 4 1 5 4 1
22 5 5 7 7 2 3 7
23 2 7 6 6 5 7 1
24 3 2 4 5 7 3 1
25 7 7 3 5 6 6 7
26 3 7 5 5 3 5 2
27 3 5 2 2 7 3 5
28 5 4 6 3 3 6 1
29 5 6 5 7 5 3 3
30 5 5 3 3 5 7 1
31 3 2 7 5 4 4 6
32 6 7 2 1 4 6 6
33 3 6 4 4 4 7 7
34 3 2 1 2 4 5 7
35 5 7 6 3 3 2 2

Formatting the Data

In order to use the MATLAB function munkres (Hungarian method code), we created a table in MATLAB similar to the one seen in the previous section. As stated in the Proposed Method section, the assignment options must be listed across the top of the matrix and the student groups along the left side, with each element being the associated cost; however, we stated before that there were five slots for each room type and the table in the previous section would only allow for one possible slot, as each column represents a possible assignment. In order to correct this, we copied each groups preference for each assignment five times. An example is shown below:

Group U. Drive U. Drive U. Drive U. Drive U. Drive Village East Village East Village East Village East Village East
1 1 1 1 1 1 3 3 3 3 3
2 5 5 5 5 5 5 5 5 5 5
3 3 3 3 3 3 6 6 6 6 6
4 2 2 2 2 2 4 4 4 4 4

In this example, we see that there are ten possible assignments with five being from U. Drive and five from Village East. One problem with this was that each cell returned a random value between one and seven. In order to maintain the same values for each group preference, we first created a column next to the first preference column and assigned the values from the first column to the second. We then copied this second column three more times. We did this by placing the code provided in the deliverables section into a new excel module.

Results

 After formatting the data correctly in a variable called “housing”, and applying the code for munkres found in the deliverables section, we used the following line of code to get our optimal solution:

[assignment,cost] = munkres(housing)

This code returned an associated assignment matrix and cost. The assignment matrix and cost are listed here:

Group 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
assignment 5 11 31 20 21 6 12 22 2 7 17 18 13 32 26 8 3 29 23 24
Group 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
Assignment 19 25 1 10 15 35 30 34 27 33 9 16 4 14 28

Cost: 55

As seen above, the total cost is 55 and we have a table with the chosen assignment. For example, there were five options for modern doubles, and they were listed first. This means that the groups assigned to values 1-5 are in modern doubles. This would be group 1, 9, 17, 23, and 33.

Comparison

In order to simulate a random selection, which is how the current housing method works, we decided to go in order by group number. This would assume that the random selection has already occurred and group one was selected to choose first and group thirty-five was selected to choose last. Each group will choose their top preference available until all assignments are made. We also did this random assignment in reverse order, meaning that group thirty-five would go first and group one would go last. After completing both of these methods, we obtained a cost of seventy and sixty-eight, respectively.

As we can see, the Hungarian method produces the most effective method for assignment.