Presentation is loading. Please wait.

Presentation is loading. Please wait.

University Housing & The Hungarian Algorithm

Similar presentations


Presentation on theme: "University Housing & The Hungarian Algorithm"— Presentation transcript:

1 University Housing & The Hungarian Algorithm
Vidit Bhatwadekar

2 Background Info This is about a thesis I wrote when I was 16
At Hong Kong Polytechnic University - This is a link to the pdf of the paper So this entire presentation is about a paper or thesis kind of thing that I wrote under the supervision of a Professor at Hong Kong Polytechnic University in Hong Kong (Professor Girish Gujur). It might sound like a massive achievement, but I was 16 or 17 and didn’t nearly have enough knowledge to do any real applied maths research, so I was basically given a free role to write anything I wanted, and the hungarian algorithm was something that had recently caught my eye since it was something I could easily understand and even use.

3 What is the Hungarian Algorithm?
Definition: The Hungarian method is a combinatorial optimization algorithm that solves the assignment problem (Wikipedia) Sounds scary right? Very much related to Graph Theory Well, the formal definition of the Hungarian Algorithm or the Hungarian Method is a combinatorial optimization algorithm that solves the assignment problem in Polynomial Time. For those of you who know about polynomial time problems and non polynomial time problems Now this sounds really scary at first, right? Well it isn’t really because it’s very much related to a field we were exposed to this semester: graph theory That is a picture of Harold Kuhn who published the algorithm in 1955. Harold Kuhn

4 Explanation of the Algorithm
Solves the Assignment Problem The algorithm solves the assignment problem: the problem when you have a finite number of jobs and a finite number of people, and you have to assign a job to a person.

5 Explanation of the Algorithm
So Imagine you own a farm or a ranch and you have 4 jobs that have to be completed and you have 4 workers, and need to assign 1 job to one person. All the combinations of jobs assignments can be visualised with a graph

6 Explanation of the Algorithm
Does anyone anyone know what type of graph this is? Where there are two sets of nodes and there is an edge join every node from one set to every node in the other set?

7 Explanation of the Algorithm
Complete Bipartite Graph K4,4 A bipartite graph, specifically a complete bipartite graph, meaning that every node in one set has an edge joining to every node in the other set. In this example, the graph is a complete bipartite graph K(4,4) In total there are 4 edges coming out of 4 different people so the number of edges is 16. However, the total possible number of ways to make these assignments is 4! = 24. However, the workers expect to get paid for their labor, and for each worker, there is a different cost associated with each of the different tasks.

8 Explanation of the Algorithm
$80 $40 $50 $46 For example, we can say that Emma demands $80 for shoveling, $40 for cutting the weeds, $50 for chainsawing, and $46 for watering the plants. Similarly, all the other workers demand a certain amount for each of the different tasks too. So the graph is a weighted graph..

9 Explanation of the Algorithm
What now has to be done is we have to make the assignments and reduce the entire graph to this, so that the total cost is minimised. Now this is what the hungarian Algorithm does

10 Explanation of the Algorithm
It converts it from this complete bipartite graph to a series of connections from worker to job.

11 Explanation of the Algorithm
Job 1 Job 2 Job 3 Job 4 Person A 80 40 50 46 Person B 70 20 25 Person C 30 10 Person D 35 And you don’t need to know the specifics of this conversion, but it involves the converting the graph to a matrix and then some sort of reduction of that matrix

12 Explanation of the Algorithm
Job 1 Job 2 Job 3 Job 4 Person A 24 9 Person B 5 51 Person C 4 14 Person D 1 Then you do the assignments so that the job is assigned to the person who’s cell contains the zero. The algorithm itself is fairly straightforward: anyone can do it using pencil and paper, but I used excel spreadsheet to do it in my paper. This part isn’t the important part.

13 Application of The Algorithm to University Housing
Unit 3 Triple (Male) Unit 2 Double (Female) Blackwell Double (Male) Clark Kerr Triple (Female) Well, that’s all well and good, but how do we apply this algorithm to allocate housing to incoming freshmen. Freshmen housing allocation is also a form of the assignment problem involving a bipartite graph. How we can visualise the assignment problem is like this. As a bipartite graph where each incoming freshman has a node from themselves to each one of the rooms. To make sure that double rooms and triple rooms are accounted for, there will be three nodes for every triple room and two nodes for every single room.

14 Application of The Algorithm to University Housing
Unit 3 Triple (Male) Unit 2 Double (Female) Blackwell Double (Male) Clark Kerr Triple (Female) However to make the assignments of students to rooms as successfully as possible we need to somehow ads weights to each node so that the hungarian algorithm can do its thing to make the allocations so that the total weight of all the assignment edges is minimised. So how I proposed going about implementing the weights to the edges is by surveying the incoming freshmen.

15 Application of The Algorithm to University Housing
So how I proposed going about implementing the weights to the edges is by surveying the incoming freshmen. In original questionnaire I designed, I gave them a choice of sex, what type of room they wanted (single or double) - or in the case of Cal freshmen (double or triple) and their first three choices of Halls. I then later used the rubrik on the right to allocate the weights of each node.

16 Application of The Algorithm to University Housing
Unit 3 Triple (Male) = 21 Preferences Room Type: Triple Gender: Male Hall Preference: Unit 3 Unit 2 Clark Kerr = 1090 Clark Kerr Double(Female) For example say Edward had these preferences in his questionnaire. So the weight of the node pointing to a unit 3 triple for males will be = 21. This rubrik makes the graph so that the the close the students preferences match the room, the lower the weight of the edge. This means that after the Hungarian Algorithm is done on the graph, the allocations are as close to people’s preferences as possible.

17 Experiment - Just to show that it works
I also conducted an experiment sort of thing at my high school, just to see if it would work. I sent out a questionnaire to some of my friends regarding classrooms they would chose to live in (IK it made no sense, but I just wanted to make sure that it worked). And this is the matrix that I came up with. Each cell in the matrix represents one edge from a student to a possible room, and the values in the cells represent the weights of the edges. Also, I applied dummy positions to the rows since there weren’t as many students as there were rooms, since I need this criteria for the algorithm to work, but I made the weights of all the edges coming from Dummy nodes 5000, just so that it isn’t the case that a dummy is assigned a room that another person wants.

18 Experiment - Just to show that it works
And then I used the Excel solver to apply the Hungarian Algorithm to the matrix and everywhere you see a one is where the assignments are, that’s why you don’t see more than 1 in any row or column. For example, Vidit Bhatwadekar was assigned the room H1SM.

19 Final Thoughts Ways of Making Process better?
Can’t use Excel for bigger data sets Applicable at Cal? There are many ways that I could make this process better. For example, have more criteria on the questionnaire to accomodate more preferences like the floor that you want to live on or if people want to live with a specific other person. Also the weights of the preferences can be changed to make it more efficient according to what people think are the most important preference. On bigger scales it will not be possible to use excel to do this, since excel can only solve for graphs upto 100 nodes. It is possible to use MATLAB for this Also, this is an outline for any university to implement it; it can easily be applied to Berkeley (I’m not sure how Berkeley allocates its housing to incoming freshmen?). Thanks for listening to my presentation.


Download ppt "University Housing & The Hungarian Algorithm"

Similar presentations


Ads by Google