# Algorithms in the Real World: Committee Assignment

I recently had another chance to use a fancy algorithm to solve a real-world problem. These opportunities don’t come up all that often, but when they do, it’s pretty exciting!

Every year, MIT HKN has a bunch of eligible students who need to be matched to committees. As part of the assignment process, the officers decide how many spots are available on each committee, and then we have every eligible rank the committees. In the past, officers matched people manually, looking at the data and trying to give each person one of their 1st or 2nd choices. Unfortunately, this is time-consuming and unlikely to result in an optimal assignment if we’re trying to maximize overall happiness.

# Example

To see how assignments can be suboptimal, we can go through an example.

Committee | Capacity |
---|---|

Tutoring | 2 |

Outreach | 1 |

Social | 2 |

Person | Tutoring | Outreach | Social |
---|---|---|---|

Alice | 1 | 3 | 2 |

Bob | 1 | 3 | 2 |

Charlie | 1 | 2 | 3 |

Dave | 2 | 1 | 3 |

Eve | 2 | 1 | 3 |

In the above table, 1 means first choice, and 3 means third choice. We could imagine assigning people by going down the list and assigning each person to their highest-ranked committee that has available slots. This would result in assigning Alice to Tutoring (1st choice), Bob to Tutoring (1st choice), Charlie to Outreach (2nd choice), Dave to Social (3rd choice), and Eve to Social (3rd choice).

Not only is this algorithm unfair to the people at the bottom of the list, but it’s also suboptimal. If we want to minimize the sum of the rankings for committees we placed people on, we could go with Alice–Social, Bob–Social, Charlie–Tutoring, Dave–Outreach, Eve–Tutoring. This results in a “cost” of 8, which is optimal, rather than the cost of 10 we got with the first assignment, which was constructed greedily.

In the actual data set, there were 8 committees and 57 eligible members, so it wouldn’t have been feasible to manually find an optimal assignment.

# Problem Statement

More formally: we have $k$ committees and $n$ people. Each committee $j$ has a capacity of $c_j$ people, where we’re guaranteed that $\sum_{j = 1}^{k} c_j = n$. We know people’s preferences, which for any given person $i$ is a permutation of the committees, $\sigma_i$, mapping the highest ranked committee to $1$ and the lowest-ranked committee to $k$. Our goal is to find an assignment $A$ of people to committees that solves the following optimization problem:

Above, $\delta$ is the Kronecker delta. Essentially, we want to find the assignment that minimizes cost while satisfying our constraints of having a specific number of people on each committee.

# Algorithm

It turns out that the committee assignment problem can be transformed into an instance of the assignment problem (which can also be thought of as finding a minimum weight matching in a bipartite graph).

In the assignment problem, you have $n$ people, $n$ jobs, and a cost matrix $C$ where $C_{ij}$ is the cost of having person $i$ do job $j$, and you want to find the minimum cost assignment such that each person is assigned to a unique job.

The committee assignment problem can be trivially transformed into an instance of the assignment problem, simply by making $c_j$ copies of each committee $j$, counting each as a separate “job”, and constructing an appropriate cost matrix from the $\sigma_i$s.

Luckily, the assignment problem is well-studied in computer science, and there’s a known solution — the Hungarian algorithm solves this problem. There’s even an implementation of the algorithm built into SciPy. This makes solving the committee assignment problem really easy — it only requires a little bit of code to implement the transformation described above.

# Results

Using this algorithmic approach to solve the committee assignment problem worked really well for us! We made some slight modifications to the process — one of the committees hand-picked their members, and then we used the algorithm on the remaining 52 members and 7 committees. When running the program, we decided to minimize the sum of the squares of the costs rather than minimizing just the sum.

With 52 people and 7 committees, our implementation ran in less than half a second and gave us an assignment with 37 people getting their first choice, 13 getting their second choice, and 2 getting their third choice.