Give them Jobs

The local employment exchange has received 20 applications from 20 different people. They also had 20 different positions (numbered 1 through 20) they could employ people as.

After going through the applications, they made a list of which person is suitable for which position. Below is the list, where each line contains the positions each applicant is suited for.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
1 3 7 8 9 10 11 12 14 15 17 20
10 11 12 14 15 17 18 20
3 4 6 7 9 13 15 17 20
1 2 6 7 9 10 14 17
5 7 8 11 12 16 17
2 3 4 7 12 17 19 20
1 2 3 4 7 9 11 13 17
1 2 3 8 12 14 17 20
2 3 4 9 10 11 12 13 15 17 18 19
4 11 14 15 16 17
2 7 9 11 13 17
1 2 3 8 14 15 20
1 3 5 7 11 12 17 18 20
1 4 6 8 10 11 12 13 17 18 19
1 5 6 9 15 16 17 18
6 12 13 14 17 18 19 20
2 6 8 10 13 14 15 17
1 3 4 5 6 7 9 10 11 12 13 16 18 20
1 3 5 11 15 18 20
1 7 10 11 12 13 15

Unfortunately, since each position can be offered to at most one candidate, not all candidates might end up getting a position.

What is the maximum number of people who can each be assigned a position?


The answer is 20.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Piero Sarti
Dec 26, 2017

Unfortunately LaTeX doesn't let me draw bipartite graphs so I'll try explaining this the best I can.

Let the matching of a person to a job be denoted as ( P e r s o n , J o b ) (Person, Job) .

Going down the list and selecting the first available job, we find an initial matching:

( 1 , 1 ) , ( 2 , 10 ) , ( 3 , 3 ) , ( 4 , 2 ) , ( 5 , 5 ) , ( 6 , 4 ) , ( 7 , 7 ) , ( 8 , 8 ) , ( 9 , 9 ) , ( 10 , 11 ) , ( 11 , 13 ) , ( 12 , 14 ) , ( 13 , 12 ) , ( 14 , 6 ) , ( 15 , 15 ) , ( 16 , 17 ) , ( 17 , N o n e ) , ( 18 , 16 ) , ( 19 , 18 ) , ( 20 , N o n e ) (1, 1), (2, 10), (3, 3), (4, 2), (5, 5), (6, 4), (7, 7), (8, 8), (9, 9), (10, 11), (11, 13), (12, 14), (13, 12), (14, 6), (15, 15), (16, 17), (17, None), (18, 16), (19, 18), (20, None) .

Using the maximum matching algorithm we construct a path from an unassigned person to an unassigned job.

20 1 = 1 3 = 3 20 20 - 1 = 1 - 3 = 3 - 20 \rightarrow 20 = 1 1 = 3 3 = 20 20 = 1 - 1 = 3 - 3 = 20

Where ( = ) (=) means is assigned to and ( ) (-) means could be assigned to.

We now have an improved matching:

( 1 , 3 ) , ( 2 , 10 ) , ( 3 , 20 ) , ( 4 , 2 ) , ( 5 , 5 ) , ( 6 , 4 ) , ( 7 , 7 ) , ( 8 , 8 ) , ( 9 , 9 ) , ( 10 , 11 ) , ( 11 , 13 ) , ( 12 , 14 ) , ( 13 , 12 ) , ( 14 , 6 ) , ( 15 , 15 ) , ( 16 , 17 ) , ( 17 , N o n e ) , ( 18 , 16 ) , ( 19 , 18 ) , ( 20 , 1 ) (1, 3), (2, 10), (3, 20), (4, 2), (5, 5), (6, 4), (7, 7), (8, 8), (9, 9), (10, 11), (11, 13), (12, 14), (13, 12), (14, 6), (15, 15), (16, 17), (17, None), (18, 16), (19, 18), (20, 1) .

We use the maximum matching algorithm once more and get:

17 2 = 4 1 = 20 7 = 7 17 = 16 19 17 - 2 = 4 - 1 = 20 - 7 = 7 - 17 = 16 - 19 \rightarrow 17 = 2 4 = 1 20 = 7 7 = 17 16 = 19 17 = 2 - 4 = 1 - 20 = 7 - 7 = 17 - 16 = 19 .

This gives us a final and complete matching of:

( 1 , 3 ) , ( 2 , 10 ) , ( 3 , 20 ) , ( 4 , 1 ) , ( 5 , 5 ) , ( 6 , 4 ) , ( 7 , 17 ) , ( 8 , 8 ) , ( 9 , 9 ) , ( 10 , 11 ) , ( 11 , 13 ) , ( 12 , 14 ) , ( 13 , 12 ) , ( 14 , 6 ) , ( 15 , 15 ) , ( 16 , 19 ) , ( 17 , 2 ) , ( 18 , 16 ) , ( 19 , 18 ) , ( 20 , 7 ) (1, 3), (2, 10), (3, 20), (4, 1), (5, 5), (6, 4), (7, 17), (8, 8), (9, 9), (10, 11), (11, 13), (12, 14), (13, 12), (14, 6), (15, 15), (16, 19), (17, 2), (18, 16), (19, 18), (20, 7) .

Since everyone is assigned, the answer is 20 \boxed{20}

Mark Hennings
Dec 22, 2017

A complete matching is possible, making the answer 20 \boxed{20} :

C a n d . P o s t C a n d . P o s t C a n d . P o s t C a n d . P o s t 1 1 6 12 11 11 16 19 2 20 7 13 12 14 17 8 3 9 8 2 13 5 18 3 4 6 9 17 14 4 19 18 5 7 10 16 15 15 20 10 \begin{array}{|cc|cc|cc|cc|}\hline Cand. & Post & Cand. & Post & Cand. & Post & Cand. & Post \\\hline 1 & 1 & 6 & 12 & 11 & 11 & 16 & 19 \\ 2 & 20 & 7 & 13 & 12 & 14 & 17 & 8 \\ 3 & 9 & 8 & 2 & 13 & 5 & 18 & 3 \\ 4 & 6 & 9 & 17 & 14 & 4 & 19 & 18 \\ 5 & 7 & 10 & 16 & 15 & 15 & 20 & 10 \\ \hline \end{array}

That is nice. Great job on finding a constructive solution.

I posted a new version of this problem with slightly different data, here

Agnishom Chattopadhyay - 3 years, 5 months ago

https://clip2net.com/s/3S7578A i went row by row from the bottom ant got this one

Егор Наздрюхин - 3 years, 3 months ago
Vinicius Alves
Dec 26, 2017

The answer for this particular data is 20 \boxed{20} . I came up with a solution based on integer programming. Let X i , j X_{i,j} be a binary variable that assumes the value 1 1 if candidate i i is assigned for job j j and 0 0 otherwise. Then, our objective function is as follows:

M a x i m i z e : i = 1 20 j = 1 20 X i , j Maximize: \sum_{i=1}^{20}\sum_{j=1}^{20} X_{i,j}

Subject to the following contraints:

  • Each candidate gets only one job:

j = 1 20 X i , j = 1 , i = 1 , 2 , . . . , 20 \sum_{j=1}^{20} X_{i,j} = 1 , i = 1, 2, ... , 20

  • Each job is assigned to a single candidate:

i = 1 20 X i , j = 1 , j = 1 , 2 , . . . , 20 \sum_{i=1}^{20} X_{i,j} = 1 , j = 1, 2, ... , 20

  • Candidates'compatibility. Here we need to use the data provided for every single candidate. For example, considering candidate 18 18 , we exclude jobs 2 , 8 , 14 , 15 , 17 2, 8, 14, 15, 17 and 19 19 :

X 18 , 2 = 0 , X_{18,2}=0, X 18 , 8 = 0 , X_{18,8}=0, X 18 , 14 = 0 , X_{18,14}=0, X 18 , 15 = 0 , X_{18,15}=0, and X 18 , 17 = 0 X_{18,17}=0

And so on, for the other candidates.

Greg Grapsas
Dec 30, 2017

No complex algorithms used. I took the position with the fewest candidates qualified and assigned that position to the candidate that had the smallest skill set...from there i worked my way up till reaching skills found amongst more candidates but always tried to match that position to the candidate that had the fewest skills.

If you look at the eligible candidates, you realize that all positions can be filled by all the 20 candidates in a way that no one is left out. You need not do the arduous task of making a table and eliminating options.

While it is true that for this particular problem it is not too difficult to find such a matching by hand, this task of eliminating options might quickly get extremely tedious for some problems. Hence, it is important to develop an algorithmic approach.

You may try to solve this problem to see what I mean.

Agnishom Chattopadhyay - 3 years, 5 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...