Student

Topics: Harshad number, Operations research, Assignment problem Pages: 25 (1558 words) Published: December 1, 2012
The Assignment Problem
and
the Hungarian Method

1

Example 1: You work as a sales manager for a toy
manufacturer, and you currently have three salespeople on
the road meeting buyers. Your salespeople are in Austin, TX; Boston, MA; and Chicago, IL. You want them to ﬂy to three
other cities: Denver, CO; Edmonton, Alberta; and Fargo,
ND. The table below shows the cost of airplane tickets in
dollars between these cities.
From \ To

Denver

Edmonton

Fargo

Austin

250

400

350

Boston

400

600

350

Chicago

200

400

250

Where should you send each of your salespeople in order to
minimize airfare?
2

We can represent the table above

250 400

400 600

200 400

3

as a cost matrix.

350

350

250

Let’s look at one possible assignment.

250
400
350

 400
600
350

250
200
400
The total cost of this assignment is
\$250 + \$600 + \$250 = \$1100.

4

Here’s another possible assignment.

250
400
350

 400
600
350

200
400
250
The total cost of this assignment is
\$250 + \$350 + \$400 = \$1000.

5

After checking all six possible assignments we can determine that the optimal one is the following.

250
400
350

 400
350 
600

200
400
250
The total cost of this assignment is
\$400 + \$350 + \$200 = \$950.
Thus your salespeople should travel from Austin to
Edmonton, Boston to Fargo, and Chicago to Denver.

6

Trial and error works well enough for this problem, but
suppose you had ten salespeople ﬂying to ten cities? How
many trials would this take?
There are n! ways of assigning n resources to n tasks.
That means that as n gets large, we have too many trials
to consider.

7

7
6
5
4
3
2
1

n

2

3

4

8

5

6

7

40
30
20

n2

10

n
1

2

3

4

9

5

6

7

1000
800
600

en

400

n2

200

n
1

2

3

10

4

5

6

7

5000
4000

n

3000

en

2000

n2

1000

n
1

2

3

11

4

5

6

7

Theorem: If a number is added to or subtracted from all
of the entries of any one row or column of a cost matrix,
then on optimal assignment for the resulting cost matrix
is also an optimal assignment for the original cost matrix.

12

The Hungarian Method: The following algorithm applies the above theorem to a given n × n cost matrix to ﬁnd an optimal assignment. Step 1. Subtract the smallest entry in each row from all the entries of its row.

Step 2. Subtract the smallest entry in each column from all the entries of its column.
Step 3. Draw lines through appropriate rows and columns so that all the zero entries of the cost matrix are covered and the minimum number of such lines is used.
Step 4. Test for Optimality: (i) If the minimum number of covering lines is n, an optimal assignment of zeros is possible and we are ﬁnished. (ii) If the minimum number of covering lines is less than n, an optimal assignment of zeros is not yet possible. In that case, proceed to Step 5. Step 5. Determine the smallest entry not covered by any line. Subtract this entry from each uncovered row, and then add it to each covered column. Return to Step 3.

13

Example 1: You work as a sales manager for a toy
manufacturer, and you currently have three salespeople on
the road meeting buyers. Your salespeople are in Austin, TX; Boston, MA; and Chicago, IL. You want them to ﬂy to three
other cities: Denver, CO; Edmonton, Alberta; and Fargo,
ND. The table below shows the cost of airplane tickets in
dollars between these cities.
From \ To

Denver

Edmonton

Fargo

Austin

250

400

350

Boston

400

600

350

Chicago

200

400

250

Where should you send each of your salespeople in order to
minimize airfare?
14

Step 1. Subtract 250
200 from Row 3.

250 400

400 600

200 400

from Row 1, 350 from...