9 residents rank 9 tracks from 1-9, where 1 is the most desired track. Each resident is assigned to one track. Each track can hold 1 resident. Some tracks are more popular than others. How do we optimize assignment of resident to tracks, such that we minimize the total rank score (i.e. more residents have lower rank scores and are in more highly desired tracks)?

Currently, Loyola randomly assigns residents to an order to choose their preferred track. This can result in some residents being assigned to less-preferred tracks. Here, we explore whether solving the assignment problem using the Hungarian method results in overall minimized total rank score.

Creating a Dataset of Randomized Rankings

We can generate a dataset containing randomly assigned ranks. We will weight the first four tracks more heavily to simulate the popularity of some tracks. The remaining tracks will be weighted evenly.

We can plot an example dataset to ensure that there is a good distribution of track ranking. A few rows of the dataset are shown below:

##     track    resident rank
## 1 track01 resident001    2
## 2 track02 resident001    3
## 3 track03 resident001    1
## 4 track04 resident001    9
## 5 track05 resident001    4
## 6 track06 resident001    8

We plot the tracks by the number of students giving a certain rank. We see that the first four tracks have the highest ranks, but the remaining tracks have a good distribution of rankings.

Loyola Internal Medicine Method

We can then assign students to tracks using the Loyola method.

Using our example dataset, we look at the rankings of the tracks to which students were assigned using the Loyola method.

We see that most residents were assigned to a track that they had ranked in the top half of tracks. We can think of the total "cost" of the assignment to be the sum of the rankings for each student. The total cost for this Loyola assignment is 30.

Hungarian Method

We can then assign residents using the Hungarian Method. We utilize the solve_LSAP function from the clue package to perform the algorithm.

Using the same example dataset, we look at the rankings of the tracks to which residents were assigned using the Hungarian method.

We see that more residents were assigned to a higher priority track. The total cost for this Hungarian assignment is 23 (if everyone got their first choice the cost would be 9). This is lower than the Loyola method assignment cost.

Iterate Methods

We can now compare the methods across many example simulated datasets to see if either method consistently returns a lower total assignment cost.

Here, we compare 1000 iterations of the example dataset. We first plot the total cost of the methods across each iteration.

We can then plot the worst rank in each iteration.

We can also plot the number of times a resident got their first choice in each iteration.

We see that in nearly all iterations, the Hungarian method has a lower cost, lower worst rank, and greates number of frist choices. The Loyola method is not the best in any of these categories. This means that the Hungarian method completes the assignment problem more effectively than Loyola's methods.

Summary

Based on this study, it appears that the Hungarian method is more effective at minimizing cost than the Loyola method. Therefore, the Hungarian method would better assign residents to tracks than the Loyola method.