0% found this document useful (0 votes)
15 views49 pages

The Assignment Problem: Math 20 Linear Algebra and Multivariable Calculus October 13, 2004

mnm n,m nm,

Uploaded by

Omer Fawad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views49 pages

The Assignment Problem: Math 20 Linear Algebra and Multivariable Calculus October 13, 2004

mnm n,m nm,

Uploaded by

Omer Fawad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 49

The Assignment Problem

Math 20
Linear Algebra and Multivariable
Calculus
October 13, 2004

Three air

conditioners need to
be installed in the
same week by three
different companies
Bids for each job are
solicited from each
company
To which company
should each job be
assigned?

The Problem
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Nave Solution
There are only 6

possible
assignments of
companies to jobs
Check them and
compare

Nave SolutionGuess #1
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Total Cost = 53 + 87+ 36 = 176

Nave SolutionGuess #2
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Total Cost = 53 + 92+ 41 = 186

Nave SolutionGuess #3
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Total Cost = 47 + 96 + 36 = 179

Nave SolutionGuess #4
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Total Cost = 47 + 92 + 37 = 176

Nave SolutionGuess #5
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Total Cost = 47 + 96 + 41 = 197

Nave SolutionGuess #6
Bldg1 Bldg2 Bldg3
A 53
B 47
C 60

96
87
92

37
41
36

Total Cost = 60 + 87 + 37 = 184

Nave SolutionCompletion
1

A 53

96

37

B 47

87

C 60

A 53

96

37

41

B 47

87

92

36

C 60

A 53

96

37

B 47

87

C 60

92

A 53

96

37

41

B 47

87

41

92

36

C 60

92

36

A 53

96

37

A 53

96

37

41

B 47

87

41

B 47

87

41

36

C 60

92

36

C 60

92

36

Disadvantages of Nave
Solution
How does the time-

6000
5000
4000

n
n2
en
n!

3000
2000
1000
0
0

10

to-solution vary
with problem size?
Answer: O(n!)

Rates of Growth
n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

log(n)
0.00000
0.30103
0.47712
0.60206
0.69897
0.77815
0.84510
0.90309
0.95424
1.00000
1.04139
1.07918
1.11394
1.14613
1.17609

n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

n2
1
4
9
16
25
36
49
64
81
100
121
144
169
196
225

en
2.7
7.4
20.1
54.6
148.4
403.4
1096.6
2981.0
8103.1
22026.5
59874.1
162754.8
442413.4
1202604.3
3269017.4

n!
1
2
6
24
120
720
5040
40320
362880
3628800
39916800
479001600
6227020800
8.7178E+10
1.3077E+12

Mathematical Modeling of
the Problem
Given a Cost Matrix C which lists for each

company i the cost of doing job j.


Solution is a permutation matrix X : all zeros
except for one 1 in each row and column
Objective is to minimize the total cost
n

c total =

i, j=1

ij

x ij

An Ideal Cost Matrix


All nonnegative

entries
An possible
assignment of
zeroes, one in each
row and column
In this case the
minimal cost is
apparently zero!

0 3 0

0
0
10

8 0 0

The Hungarian Algorithm


Find an ideal cost

matrix that has the


same optimal
assignment as the
given cost matrix
From there the
solution is easy!

QuickTime and a
TIFF (Uncompressed) decompressor
are needed to see this picture.

Critical Observation
Let C be a given cost

matrix and consider a


new cost matrix C that
has the same number
added to each entry of
QuickTime and a
a single row of C
TIFF (Uncompressed) decompressor
are needed to see this picture.
For each assignment,
the new total cost
differs by that constant
The optimal assignment
is the same as before

Critical Observation
Same is true of

columns
So: we can subtract
minimum entry
QuickTime and a
from each row and
TIFF (Uncompressed) decompressor
are needed to see this picture.
column to insure
nonnegative entries

On our given matrix


53

96 37

87 41a
47

60

92 36

16

13 0
59 0 10

6 46 0a 0 0 0
24

10 0
56 0 18

Still Not Done


No assignment of

zeros in this matrix

10
13 0

0
0
0

18
10 0

Still Not Done


No assignment of

zeros in this matrix

10
13 0

0
0
0

18
10 0

Still Not Done


No assignment of

zeros in this matrix

10
13 0

0
0
0

18
10 0

Still Not Done


No assignment of

zeros in this matrix

10
13 0

0
0
0

18
10 0

Still Not Done


No assignment of

zeros in this matrix

10
13 0

0
0
0

18
? 10 0

Still Not Done


No assignment of

zeros in this matrix


Still, we can create
new zeroes by
subtracting the
smallest entry from
some rows

0 3 10

0
0
0

8 0 10

Still Not Done


No assignment of zeros

in this matrix
Still, we can create new
zeroes by subtracting
the smallest entry from
some rows
Now we can preserve
nonnegativity by adding
that entry to columns
which have negative
entries

0 3 0

0
0
10

8 0 0

Solutions

0 3 0 0 3 0

0
0
10
0
0
10

8 0 0 8 0 0

Nave SolutionCompletion
1

A 53

96

37

B 47

87

C 60

A 53

96

37

41

B 47

87

92

36

C 60

A 53

96

37

B 47

87

C 60

92

A 53

96

37

41

B 47

87

41

92

36

C 60

92

36

A 53

96

37

A 53

96

37

41

B 47

87

41

B 47

87

41

36

C 60

92

36

C 60

92

36

The Hungarian Algorithm


1.

2.

Find the minimum


entry in each row and
subtract it from each
row
Find the minimum
entry in each column
and subtract it from
each column
Resulting matrix is
nonnegative

QuickTime and a
TIFF (Uncompressed) decompressor
are needed to see this picture.

The Hungarian Algorithm


3. Using lines that go
all the way across
or all the way upand-down, cross
out all zeros in the
new cost matrix
Find a way to do
this with a
minimum number
of lines (n)

10
13 0

0
0
0

18
10 0

The Hungarian Algorithm


4. If you can only do
this with n lines,
an assignment of
zeroes is possible.

10
13 0

0
0
0

18
10 0

The Hungarian Algorithm


5.

Otherwise,
determine the
smallest entry not
covered by any line.
Subtract this entry
from all uncovered
entries
Add it to all doublecovered entries
Return to Step 3.

10
00 331310
00

0
0
0
0
0
10
0
0

18
88 331010
00

The Hungarian Algorithm


3. Using lines that
go all the way
across or all the
way up-anddown, cross out
all zeros in the
new cost matrix

0 3 0

0
0
10

8 3 0

The Hungarian Algorithm


3. Using lines that
go all the way
across or all the
way up-anddown, cross out
all zeros in the
new cost matrix

0 3 0

0
0
10

8 3 0

The Hungarian Algorithm


3. Using lines that
go all the way
across or all the
way up-anddown, cross out
all zeros in the
new cost matrix

0 3 0

0
0
10

8 3 0

The Hungarian Algorithm


4. If you can only
do this with n
lines, an
assignment of
zeroes is
possible.

0 3 0

0
0
10

8 3 0

Solutions

0 3 0 0 3 0

0
0
10
0
0
10

8 0 0 8 0 0

Example 2
Customer

A cab company gets

four calls from four


customers
simultaneously
Four cabs are out in the
field at varying distance C
from each customer
a
Which cab should be
b
sent where to minimize
total (or average)
waiting time?

7.5

7.5

3.5

8.5

5.5

6.5

12.5 9.5

9.0

10.5

4.5

11.0 9.5

11.5

Integerizing the Matrix


9
7.5 7.5 8 90


3.5 8.5 5.5 6.5 a 35
12.5

9.5 9 10.5 125


4.5 10 9.5 11.5 45

75
85
95
10

75 80

55 65
90 105

95 115

Non-negativizing the Matrix


90

35
125

45

75
85
95
10

75 80 15
0 0 5 15
0 0 0

55 65 0 50 20 30 0 50 20 25
a
a

90 105 35
5 0 15 25
5 0 10

95 115 0 65 50 70 0 65 50 65

Covering the Zeroes

15

0 0 0

0
50
20
25

25

5 0 10

0 65 50 65
Can do it with three!

Find Smallest Uncovered Entry

15

0 0 0

0
50
20
25

25

5 0 10

0 65 50 65

Subtract and Add

30

0 0 0

0
30
0
5

55

5 0 10

0 45 30 45

Cover Again

30

0 0 0

0
30
0
5

55

5 0 10

0 45 30 45
Still three!

Find Smallest Uncovered

30

0 0 0

0
30
0
5

55

5 0 10

0 45 30 45

Subtract and Add

40

0 5 0

0
25
0
0

55

0 0 5

0 40 30 40

Cover Again

40

0 5 0

0
25
0
0

55

0 0 5

0 40 30 40
Done!

Solutions
40

0 5 0

0 25 0 0
55

0 0 5

0 40 30 40

Done!

40

0 5 0

0 25 0 0
55

0 0 5

0 40 30 40

Solutions
9
7.5 7.5 8 9
7.5 7.5 8

3.5 8.5 5.5 6.5 3.5 8.5 5.5 6.5


12.5

9.5 9 10.5 12.5


9.5 9 10.5

4.5 10 9.5 11.5 4.5 10 9.5 11.5


Total Cost = 27.5

Other Applications of AP
Assigning teaching

fellows to time slots


Assigning airplanes to
flights
Assigning project
members to tasks
Determining positions
on a team
Assigning brides to
grooms (once called the
marriage problem)

QuickTime and a
TIFF (Uncompressed) decompressor
are needed to see this picture.

You might also like