Page, E.S.; (1963)A note on assigment problems."

UNIVERSITY OF NORTH CAROLINA
Department of Statistics
Chapel Hill , N. C.
A NOTE ON ASSIGNMENT PROBLEMS
e.
by
E. S. page
March, 1963
This research was supported by the Office of Naval
Research under contract No. Nonr-855(09) for research
in probability and statistics at the University of
North Carolina 1 Chapel Hill , N. C. Reproduction in
whole or in part is permitted for any purpose of the
United states Government.
Institute of Statistics
Mimeo Series No. 357
A NOTE ON ASSIGNMENT PROBLEMS
by
E. S. page *
University of North Carolina**
==== • = = = = === = == = = = = ==== = == = == = ====== = = = == =
Introduction
Assignment problems deal with the allocation of items to locations, one to
each, in such a way that some optimum return is obtained.
Four examples are the
following:
lAo
The expected value of orders that will be obtained by salesman i
(i = 1,2, ••• ,n)
in sales area
(j = 1,2, ••• ,n)
is known to be f ij •
Assign the salesmen one to each area so that the total expected value is
j
greatest.
lB.
The comfort and convenience of class
index f.".
J.J
i
in room
j
is assessed by an
It is 'Wished to assign the classes, one to each room, so
that the least index assigned is maximised.
2A.
In 1A suppose that f
reach area
j.
is the distance salesman i has to travel to
ij
Assign the sa.lesmen, one to each area, so that the total
distance travelled is a minimum.
2B.
Mechanics have to repair pieces of equipment; the time,
mechanic
i
to repair equipment
j
is known.
ij , for
Assign the mechanics one
f
/by
to each equipment to minimise the time which all equipments are repaired.
Thus, given the n x n matrix (f
) the four examples require the selection of
ij
n elements of the matrix, one from each row and each column f " , f 2. , ••• f ."
l JI
J
n,J n
2
*This research was supported by the Office of Naval Research under contract No.
Nonr-855(09) for research in probability and statistics at the University of
North Carolina, Chapel Hill, N. C. Reproduction in whole or in part is permitted
for any purpose of the United states Government.
**Present
address:
University Computing Laboratory, Newcastle upon Tyne.
2
'~
where
(jl' j2' ••• jn)
is some permutation, n, of
lB.
Maximise (f lj + f , + ••• + f nj )
2J
n
1
n
2
Maximise Minimum (f l' , r 2' , ... f , )
n
J
J2
nJ n
l
2A.
Minimise
n
2B.
Minimise Maximum (f , , f 2' , . . . f , )
lJ
n
J
nJ n
l
2
lAo
(1,2, ••• n) in order to:
(f , + f , + ••• + f , )
2J
lJ
nJ n
l
2
The usual forms of the assignment problem are
lA and
problems as follows.
is assigned to location
otherwise.
Then
Let
1A and
x
= 1 if item
ij
2A
i
2A.
We can restate these
require the optimisation of
n
n
!:
!:
i=l j=l
x
ij
j, and 0
f i'
sub-
J
ject to the conditions
n
!:
i=l
n
!:
j=l
X'j
= 1
,
j
,
i = 1,2, ••• n
J.
xi'
=
1
x
>
0
= 1,2, •••
n
J
ij
Accordingly problems
i,j = 1,2, ••• n •
lA and
2A are special cases of the transportation
problem which itself is a special case of the more general linear programming
problem.
While the algorithms for the general problems could be used to solve
these assignment problems special methods have been devised which take advantage
of the simplifying features. (KUhn, 1955)
We now show how a simple transformation exhibits
of
1A and
lB and 2B as special cases
2A.
The Transformations.
We can suppose that all the
optimum assignment for the
f!, = f
J.J
IDatrix
, + C , for any constant
iJ
r 'j > 0
J.
-
without loss of generality since any
(f ij ) is also optimum for
c.
In
lA, 2A
(f lj ) where
the optimum is increased by
nc
:3
and in
lB, 2B by
Let M
= max
i,j
c.
f. .; then problems
J.,J
another by writing f!.
J.J
1A with cost 'Y
=M -
f .•
iJ
1A
and
lB, 2B
are transformed into one
That is, an optimum assignment for problem
2A 'With cost
is an optimum assignment for
For the problems
2A
nM - 'Y •
we can in addition suppose the elements
rank of f ij
same rank,
in the ordering.
rij
= fit(.
Any ties
i. e.
1j
= f ij
where fi j
r ij = r k(
where
to
in ascending
be positive integers since if they are not we can rank the f ij
order of magnitude and make the transformation f
r ij
is the
will have the
For example the matrix
1.8
becomes
4
2
4
5
6
1
:3
7
1
2
to be positive integers in the range (1,n ).
ij
Then the transformation ri = n2 + 1 - f
transforms lB and 2B into one
j
ij
another.
Thus, we can suppose the
r
Consider now how to transform problem 2B
into
2A.
If we can arrange that
any sum of elements of the matrix is dominated by the greatest element in the sum
(or equal greatest elements) then we shall be able to solve
used for
out.
2A.
We therefore need to replace the
r ij
2B by
the methods
by numbers widely spread
This task is similar to that of isolating the root of largest modulus of a
polynomial equation and can be tackled by methods similar to those of the root
squaring technique.
Suppose we form a new matrix rij
that
= r aij
where
a is to be chosen. We require
4
(1)
••• + f'11k
•••
n
should imply
• • • f'nJ
r
0
Choose
a
< Max
-
(2)
(f ' , ••• f nk
' ) •
lk
r
1
so that
a
s ~ n(s-l)
where
)
a
for
s
m is the greatest element of
= 1,2, •••
(3)
m
(fij ). With this choice of a (1) certainly
implies (2).
Alternatively the new matrix can be foxmed f
of K.
The requirement that
(1)
s
(s-l)
K ~ n K
i. e.
take K > n
f iJo
j
=
K
1
for a suitable choice
implies (2) is met if
for
.
= 1,2,...
s
(4)
m
nxn.
where the matrix is
Thus either of these transformations reduces problem 2B
into
2A and so
may be solved by knovm algorithms.
The transformation of problem
lB -> 2B -> 2A -> lAo
f~Jo
...
lB
where K', K' r
lA
now follows easily.
We go from
Thus the transformations are
= K'
- (M - f ij )a
(M or
into
fij = Kit -K
r. 0)
~J
are large enough intege!}3 to make
f Ij
>0 •
Example
Consider the example given by Kuhn to illustrate the Hungarian method of solution to problem lAo
min (flo , ••• f
Jl
nJ n
0
We modify it to get a solution of
)
•
lB
Le. to maximize
5
=
(r ij )
7
2
1
3
r..
The elements
9
8
9
7
4
2
9
6
are already consecutive integers 'With repetitions beginning
~J
at unity so we have no need to rank them and replace 'With the ranks.
Problem 2B
problem 2A we can use the matriX
ri~) =
(ri~» where ri~)
(r~~» where
= 9 - r ij
considers the matrix
r(l)
4 ij • Finally problem
and then for
~J
JJ\. uses
(ri~»
where
ri~) =
65536 -
ri~)
•
Thus
(ri~»
=
1
4
2
0
2
7
8
6
3
7
ri~) =
,
0
1
0
5
7
3
65532
65280
65472
49152
65520
49152
0
61440
r(2)
ij
=
16
16384
65536
4096
4
256
64
16,84
65535
65520
64512
49152
1
16
1024
16384
1
4
1
64
65535
65532
65535
65472
Accordingly this matrix could form the imput to a program for the more
general solution to problem
optimum for problem lB
directly from (r .. )
~J
lA and an optimum assignment so obtained 'Will be
on matrix
Cri J.);
the optimum cost can then be obtained
.
or by reversing the transformations.
Modification of the Hungarian Method.
In this section we assume familiarity 'With the Hungarian method and refer to
Kuhn's paper (1955) for the details and a flow diagram of the solution.
The disadvantage of trying to solve
lB and 2B by the algorithm of JJ\., 2A
on the transformed matrix is the very large size of the matrix elements.
Even for
6
qUite small problems, say 10 x 10, the transformed numbers have far outstripped
single length working in a computer.
size.
For example, the element of
Some minor steps can be taken to reduce the
(r ij)
giving the optimum for
greater than the n-th largest element of the matrix.
elements of
nn.
Accordingly the
cannot be
n
largest
(rij ) can be replaced by their minimum without affecting either an
optimum assignment or its value.
numb~rs
lB
by about a factor of
In the example given this device reduces the
4 and in the nxn case by a factor of at most
Constants can be subtracted from rows or columns of
the value of an assignment but not its optimality.
(rij ) changing only
Even after all these adjustments
large numbers still remain.
They can however be avoided by changing the direction
jthe
instead of transforming the matrix for lB to fit Hungarian method
of attack:
for
lA we consider transforming (very slightly) the Hungarian method to make it
,
applicable for lB.
The Hungarian method first marks the positions in the matrix of row (or column)
maxima and attempts to complete an assignment with the marked positions.
If this
fails it gives rules for selecting areas, R, of the matrix in which further items
to be marked should be found together with a rule for picking those to be marked.
More positions are marked until finally a complete assignment can be made.
The only section of this algorithm which needs modification to deal with
problem
is:
lB
is the rule for picking the items to be marked.
mark the item or items in
The appropriate rule
R which are the greatest in R.
I"In the modified
algorithm it is not necessary to compute explicitly the cover (u." v.) required
.
for
1.!::7.
~
J
We illustrate the procedure on the previous example; marked i te.ms are
replaced by
X, items in the selected area are shown with their numerical values,
and other i terns are replaced by - .
the areas are selected.
We refer to Kuhn for an explanation of how
The stages are as follows:
7
x
7
2
->
X
.
X
X
cv
X
X
X
2
(j)
X
2
1
X
1
4
x
1
X
3
x
3
2
X
3
XI
X
X
2
X
->
X
X
1]
X
X
3
X
@
(7, 7, 6, 6)
X
X
1
actual assignment is shown by squares, i.e.
min
0
•
The greatest elements in the selected areas
=
X
2
->
value
->
are enclosed in a circle and the
r 12' r 23' r 31' r 44
with optimum
= 6.
Comments on the Method.
The modification above has as its greatest virtue the slight changes it
requires to an already established algorithm.
If a computer program for the
Hungarian method is available a program for the solution of
easily.
If, however, only problems of types
lB, 2B
lB
can be derived
are likely to be encountered
and a program has to be written afresh the method developed by Porsching (1963)
has undoubted advantages as it is much easier to program.
This latter method pro-
ceeds by marking the elements starting with all the largest, then all the next
largest and so on, and providing at each stage all easy, although possibly long,
rule for deciding whether a complete assignment can be formed from the marked
items.
The modified Hungarian method tends only to mark items that may be useful
in completing an assignment and has another way of deciding whether a complete
assignment is yet possible •
.An entirely different approach would be necessary to deal with very large
problems.
terms.
The problems considered can easily be formulated in Dynamic Programming
Let
c
1iI' i 2 ,
••• \ ; jl,j2' H. jk
1 be the cost or value of an optimum
8
assignment of items
i
l
C [ i l , ...
\i
best, of
assignments of
assignment of
to places
jl' ••• jk.
Then clearly this cost
jl' ... jk \ can be obtained by examining the costs, and picking the
i
l
\
to
jl' j2' ••• jk
in turn together with an optimum
... ~-l to the (k-l) places not filled.
where the "Optimum" and
being solved.
••• \
G)
Thus
operations depend on which of the four problems is
Thus, to solve an
nxn
problem we need to build up successively
a table of optimum costs of all the m:xm problems, m = 1,2, ... n
that can be
formed by selecting items and. places. The number of such problems is largest
2
2n l
when m = n/2 and. is (n/2) r--v 2 + /7(!J. and their costs need to be available
for cOIllJ?uting the next stage.
A practical method is obtained by grouping the items
and places into problems of a size that can be tackled and switching the components
between groups in some way similar to that of Held and Karp (1962) in another
problem in order to :l.m.prove the solution already found.
Acknowledgements.
I wish to thank my friends, \'1. J. Hall and W. L. Smith, for discussions
relevant and irrelevant but always entertaining during my stay at Chapel Hill.
References.
Held, M. and Karp, R. M. (1962'). A Dynamic Programming" approach to sequencing
problems. J. Soc. Indust. Appl. Math. 10, 196-210.
Kuhn, T. W. (1955). The Hungarian method for the assignment problem.
Log. Q,uart. ,g, 83-97.
Nav. Res.
Porsching, T. A. (1963). Matrix assignments and an associated min-max problem.
Math. Comp. E.' 81-84.