7
Pergamon Computers Ops Rex. Vol. 24. No. I 1, pp. 1017-1023, 1997 0 1997 Elsevier Science Lid PII: S0305-0548(97)0(1019-1 All rights reserved. Printed in Great Britain 0305-0548/97 $17.00+0.00 A NEW ALGORITHM FOR THE ASSIGNMENT PROBLEM: AN ALTERNATIVE TO THE HUNGARIAN METHOD Ping Ji,lt:l: W. B. Lee'§ and Hongyu Li~ Department of Manufacturing Engineering, The Hong Kong Polytechnic University, Hung Horn, Kowloon, Hong Kong ' Department of Decision Sciences, National University of Singapore, 10 Kent Ridge Crescent, Singapore 119260, Singapore (Received July 1996; in revisedform March 1997) Scope and Purpose---The classic assignment problem is to assign n jobs to n machines at the least total cost. This paper proposes a new algorithm for the assignment problem. This algorithm is very simple since all operations are performed on a 2n × 2n matrix. This algorithm can be an alternative to the well-known Hungarian method, Abstract--This paper presents a new algorithm for the well-studied assignment problem. Our assignment algorithm is based on a 2n × 2n matrix. The dual to the assignment problem is considered in this paper by relaxing the constraints of the original assignment problem. A 2.n x 2n matrix is formed for an initial feasible solution to the dual. Then operations are performed on the matrix until an optimal solution is found. © 1997 Elsevier Science Ltd I. INTRODUCTION The usual assignment problem is considered in this paper. The problem is defined as follows: assign n jobs to n machines with the least total cost, if job i is assigned to machinej with a non-negative integer cost c 0. This problem is a special case of the linear programming problem, defined as follows: Minimize ~= Z E cijxij i=l j=l subject to ~ xij= 1 (i= 1 ..... n), (1) 1= I xi/= 1 (j= 1 ..... n), (2) i=l x~j=0 or I (i,j= 1 ..... n), (LPI) where xi/= 1 means job i is assigned to machine j, otherwise x0=0, job i is not assigned to machinej. The costs c o form a cost matrix, denoted C. Due to its structure, some special algorithms have been developed, which can solve the problem very efficiently, compared with the general methods for linear programming problems. The most well-known is the Hungarian method, introduced by Kuhn [ 1 ]. This method needs to find a minimum number of lines to cover all of the zeros in the reduced cost matrix. As pointed out by Lotfi [2], finding the minimum number of lines to cover all of the zeros can become a tedious task, and he developed a labeling algorithm for this task [2]. Besides the Hungarian method, the Simplex method for linear programming was modified to solve the assignment problem [3-6]. Also, the signature method for the assignment problem was presented by Balinski [7]. Other relevant research solutions can be found from Odin and Ahuja [8], and Hung and Rom [9]. 1"To whom all correspondence should be addressed(email: [email protected]). :J: Ping Ji is an Assistant Professor in the Department of Manufacturing Engineering, the Hong Kong Polytechnic University. He received his Ph.D. in Industrial Engineering from West Virginia University. His research interests are in production management, operations research, and CAD/CAM. § W. B. Lee is the Chair Professor of Manufacturing Engineering, and Head of the Department of Manufacturing Engineering, the Hong Kong Polytechnic University. He got his Ph.D. from the Hong Kong University. His rese~,'chinterests are in material and manufacturing technology, and global manufacturing. ~] Hongyu Li is a Senior Lecturer in the Department of Decision Sciences, National University of Singapore. He got his Ph.D. from the University of Texas at Austin. He has published papers in the International Journal of Production Economics, and the European Journal of Operational Research. His research interests are in production management and operations research. 1017

A new algorithm for the assignment problem: An alternative to the Hungarian method

  • Upload
    ping-ji

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A new algorithm for the assignment problem: An alternative to the Hungarian method

Pergamon Computers Ops Rex. Vol. 24. No. I 1, pp. 1017-1023, 1997

0 1997 Elsevier Science Lid PII: S0305-0548(97)0(1019-1 All rights reserved. Printed in Great Britain

0305-0548/97 $17.00+0.00

A N E W A L G O R I T H M F O R T H E A S S I G N M E N T P R O B L E M : A N

A L T E R N A T I V E TO T H E H U N G A R I A N M E T H O D

Ping Ji,lt:l: W. B. Lee'§ and Hongyu Li~ Department of Manufacturing Engineering, The Hong Kong Polytechnic University, Hung Horn,

Kowloon, Hong Kong ' Department of Decision Sciences, National University of Singapore, 10 Kent Ridge Crescent,

Singapore 119260, Singapore

(Received July 1996; in revised form March 1997)

Scope and Purpose---The classic assignment problem is to assign n jobs to n machines at the least total cost. This paper proposes a new algorithm for the assignment problem. This algorithm is very simple since all operations are performed on a 2n × 2n matrix. This algorithm can be an alternative to the well-known Hungarian method,

Abst rac t - -This paper presents a new algorithm for the well-studied assignment problem. Our assignment algorithm is based on a 2n × 2n matrix. The dual to the assignment problem is considered in this paper by relaxing the constraints of the original assignment problem. A 2.n x 2n matrix is formed for an initial feasible solution to the dual. Then operations are performed on the matrix until an optimal solution is found. © 1997 Elsevier Science Ltd

I. I N T R O D U C T I O N

The usual assignment problem is considered in this paper. The problem is defined as follows: assign n jobs to n machines with the least total cost, if job i is assigned to machinej with a non-negative integer cost c 0. This problem is a special case of the linear programming problem, defined as follows:

Minimize ~= Z E cijxij i=l j=l

subject to ~ xij= 1 (i= 1 ..... n), (1) 1= I

xi/= 1 ( j= 1 . . . . . n) , (2) i=l

x~j=0 or I (i,j= 1 ..... n), (LPI)

where xi/= 1 means job i is assigned to machine j, otherwise x0=0, job i is not assigned to machinej. The costs c o form a cost matrix, denoted C.

Due to its structure, some special algorithms have been developed, which can solve the problem very efficiently, compared with the general methods for linear programming problems. The most well-known is the Hungarian method, introduced by Kuhn [ 1 ]. This method needs to find a minimum number of lines to cover all of the zeros in the reduced cost matrix. As pointed out by Lotfi [2], finding the minimum number of lines to cover all of the zeros can become a tedious task, and he developed a labeling algorithm for this task [2]. Besides the Hungarian method, the Simplex method for linear programming was modified to solve the assignment problem [3-6]. Also, the signature method for the assignment problem was presented by Balinski [7]. Other relevant research solutions can be found from Odin and Ahuja [8], and Hung and Rom [9].

1" To whom all correspondence should be addressed (email: [email protected]). :J: Ping Ji is an Assistant Professor in the Department of Manufacturing Engineering, the Hong Kong Polytechnic University. He

received his Ph.D. in Industrial Engineering from West Virginia University. His research interests are in production management, operations research, and CAD/CAM.

§ W. B. Lee is the Chair Professor of Manufacturing Engineering, and Head of the Department of Manufacturing Engineering, the Hong Kong Polytechnic University. He got his Ph.D. from the Hong Kong University. His rese~,'ch interests are in material and manufacturing technology, and global manufacturing.

~] Hongyu Li is a Senior Lecturer in the Department of Decision Sciences, National University of Singapore. He got his Ph.D. from the University of Texas at Austin. He has published papers in the International Journal of Production Economics, and the European Journal of Operational Research. His research interests are in production management and operations research.

1017

Page 2: A new algorithm for the assignment problem: An alternative to the Hungarian method

1018 Ping Ji et al.

We present a new algorithm for the assignment problem. The approach for this algorithm is to relax the constraints of the assignment problem into a general linear programming model, then the dual to this linear programming model is presented. A 2n × 2n matrix is formed during the formulation of an initial feasible solution. The duality theory is used to check the optimality of a solution. If a solution is not optimal, the matrix is updated to get the next better solution, until the optimal solution is obtained.

2. THE MODELS

As a matter of fact, the problem LPI is an integer programming model, precisely, a zero--one integer programming model. The constraints in LPI can be relaxed to form a general linear programming model, expressed as follows:

Minimize ~= E E ciyxi~ i=1 j= l

subject to ~ x0-< 1 (i= 1 ..... n), (3) j= l

xii-- > 1 (j= 1 ..... n), (4) i=1

xo.>--O ( i j= 1 ..... n). (LP2)

Here, firstly, the costs c~j are required to be integers. If not, they can be easily converted into integers by multiplying by an appropriate constant, and the optimal solution of the assignment model LPI remains the same. Secondly, the constraints (1) and (2) in LP 1 are relaxed as less than or equal to and greater than or equal to, respectively, as stated in (3) and (4), instead of both being equal to in LP1. Thirdly, now x~j is relaxed to be any non-negative real value in LP2. However, due to the constraints in LP2, x~j cannot be greater than 1. Moreover, xjj can only be 0 or 1 since the coefficients in (3) and (4) are all 1, and all costs cij are integers. As a matter of fact, the feasible solution area of the model LP2 is the entire convex region, while LPI considers only the boundary of the region. However, according to the theory of linear programming, the optimal solution is always at an extreme point (comer), and the extreme points for both models LPI and LP2 are the same, so model LP2 has the same optimal solution as model LP1.

If the model LP2 is considered as primal, the dual to LP2 can be formulated as follows.

Maximize ~b=- E ui+ E vj i : l j * l

subject to - ui+vi<-c~ ~ ( i j= 1 ..... n),

ui,vj>-O ( i j= 1 ..... n).

Here, all u~ and vj are dual variables. The dual to the original assignment problem LPI is generally stated as follows.

Maximize ¢= ]~ ui+ ~, vj i=l j z l

(5)

(6, LP3)

subject to ui+vj<-c o ( i j= 1 ..... n),

ul, v j unrestricted ( i j= 1 ..... n). (LP4)

By comparing the two duals, they are found to be the same, except for the sign of ui and the value range of all ui and vj. As a matter of fact, the dual variables are restricted to be non-negative values in LP3 because of the inequalities in (3) and (4). All u~ being non-negative in LP3 should be non-positive, but the signs of ui have been changed in the objective and the constraint set (5) in LP3 during the formulation of the dual. That is why the signs of all u~ in both duals are different. The duals LP3 and LP4 are equivalent in terms of the optimal solution.

3. THE ALGORITHM

Similar to the definitions of the Simplex method, an occupied cell is called a basic cell, and an empty (unoccupied) cell is defined as a non-basic cell. A feasible solution to the assignment problem should have n basic cells. The algorithm is presented as follows.

Step O. Initialization.

Page 3: A new algorithm for the assignment problem: An alternative to the Hungarian method

A new algorithm for the assignment problem 1019

Step 0.1. Set u~=0 (i= 1,2 ..... n) and let vj=~ij=min {%, i= 1,2 ..... n}; j= 1,2 ..... n. Ties can be broken arbitrarily. The corresponding cells to ?~ are (ij#') (j= 1,2 ..... n), respectively. As a matter of fact, v~ is the minimum cost in thejth column of the cost matrix C. Step0.2. Let the basic cell set A={(ij,I),(i2,2) ..... ( i , ,n) , ( l ,O),(2,0) ..... (n,0)}. The cells (1,0),(2,0) ..... (n,0) are called virtual cells because they do not exist in the cost matrix. Step 0.3. Let the matrix D=[d~/]; i,/= 1,2 ..... 2n; where

1 ( i , j ) E { ( 1 , 1 ) , ( 2 , 2 ) . . . . . ( n , n ) } ;

-- 1 ( i j ) ~ { ( l , n+ iO , (2 ,n+i2 ) . . . . . (n ,n+i , ) } ; do =

- i ( i d ) E { ( n + l , n + l ) , ( n + 2 , n + 2 ) . . . . . (2n,2n)};

0 otherwise;

and compute the objective ¢ t=- E ui+ ~, vj. /=1 j = l

2n

Step 1. Determination of the leaving cell. )~=min {y,; k= 1,2 ..... 2n}, where yk= Z d~ - E dj~. Ties i=1 j = n + l

can be broken arbitrarily. If y~->0, the solution is optimal (both the dual and the primal), STOP.

Otherwise. the leaving cell is the kth cell in A.

Step 2. Determination of the entering cell. Step 2.1. For all non-basic cells, if d,.~.k - d # > 0 , compute O~j=c~j+u~- v i. Step 2.2. Find the smallest value 0~, in all 00, and the cell (s,t) is the entering cell. Ties can be broken arbitrarily.

Step 3. Updating. Step 3.1. Update the matrix D.

Step 3.1.1. For the elements of column k in D:

dtk = - d,~ l= 1,2 ..... 2n.

Step 3.1.2. For the elements of other columns in D:

f r = 1,2 k - l,k+ 1 2n; d/r=d/r+(d ...... -d, , . )d, , (1=1,2 ..... ..... 2n.

Step 3.2. Update the basic cell set A: replace the kth cell (i,j~) in A with the entering cell (s,t). Step 3.3. Update the objective value. Compute:

fii=ui+0,~,+ia i=1,2 ..... n; ^

fJJ=vi+O~#li~ j = l , 2 ..... n;

and the objective

6 = - ui+ J v i i=1 "=

Go to Step 1.

The main idea of this algorithm is first to obtain a feasible solution to the dual problem (LP3) and its corresponding matrix (Step 0). Then the duality theory is used to check the optimal condition and to get the leaving cell (Step 1). All non-basic cells are evaluated in order to get the entering cell (Step 2). Finally, the entering cell replaces the leaving cell and the matrix is updated (Step 3).

The dual LP3 has 2n variables, that is, all u~ and vj. The basic principle behind this algorithm is to find 2n equations (cells) in all constraints (5) and (6) in the dual LP3. If the solution of these equations can minimize the objective of the primal LP2, an optimal solution is obtained. Otherwise, find a better cell (equation) to replace an equation in the solution and update the matrix. The 2n × 2n matrix is actually the inverse of the coefficient matrix of these equations. We will explain this point in the following numerical example.

4. NUMERICAL EXAMPLE

Let us consider the following 4 × 4 assignment problem. The cost matrix C of this problem is:

Page 4: A new algorithm for the assignment problem: An alternative to the Hungarian method

1020 ~ngJietal.

1 2 3 4

I 2 15 13 4

2 10 4 14 15

3 9 14 16 13

4 7 8 11 9

Step O. U | - ~ / A 2 ~ ' l ~ 3 - - ~ / ~ 4 - - ~ O , and v,=2, v2=4, v3= 11, V4=4;

A = { (1,1),(2,2),(4,3),( 1,4),( 1,0),(2,0),(3,0),(4,0) };

D =

1 0 0 0 - 1 0 0 0

0 1 0 0 0 - 1 0 0

0 0 1 0 0 0 0 - 1

0 0 0 1 - 1 0 0 0

0 0 0 0 - 1 0 0 0

0 0 0 0 0 - l 0 0

0 0 0 0 0 0 - l 0

.0 0 0 0 0 0 0 - l

and

,p=- ~, u,+ E vj=21 i=l j=l

Step 1. Determination of the leaving cell. ~=min { 1,1,1,1, - 1,0,1,0} = - 1, so k=5 and the 5th cell (1,0) in A is the leaving cell.

Step 2. Determination of the entering cell. 0~,=min { 02,,024,03,,034,04,0~} =min {8,1 1,7,11,5,5} =5; so the entering cell (s,t) is (4,1) or (4,4). Let (s,t) be (4,1 ).

Step 3. Updating.

^

d2!

^ I . ~

d5 i ^

dst

djj

d~,

d. ds,

- .

^

dis ^

d25 ^

d35 ^

d~ d.,

i d6s A

d75 ^

ds5

+(ds , -d , , )

" ^

d~3 ^

d~ ^

d33

d53 d~.

^

d73 ^

ds3

Similarly, other elements in D can be updated and

dis ~s

d55 d65 d75 da5

1

0

0

1

1

0

0 1

0

+ ( o - 1)

1 0

0 0

0 0

1 - 1

1 1

0 0

0 0

0 0

Page 5: A new algorithm for the assignment problem: An alternative to the Hungarian method

A 1021

D =

new algorithm for the assignment problem

- 0 0 0 0 1 0 0 - 1

0 1 0 0 0 - 1 0 0

0 0 1 0 0 0 0 - 1

- 1 0 0 1 1 0 0 - I

- 1 0 0 0 1 0 0 - 1

0 0 0 0 0 - 1 0 0

0 0 0 0 0 0 - 1 0

0 0 0 0 0 0 0 - I

A= 1(1,1),(2,2),(4,3),(1,4),(4,1),(2,0),(3,0),(4,0)} Eul u: = u2 + 0,, ~ u3

a, ,,, L

02 _- v2 +0,, d~

03 v3 " 5

o, v, L J

I 0

0

0

0 1151 + 5 x 0 0 0 = 0

0 0

[i] 5xL!l [i] and

¢ = - Y- u,+ ~ vj=26 i=l j=l

Now ~k=min {0,1,1,1,1,0,1,- 1} = - 1, so k=8 and the 8th cell (4,0) in A is the leaving cell. Other relevant information in this iteration is as follows:

0,,=2, and the entering cell (s,t) is (3,1).

D =

- 0 0 0 0 0 0 - 1 1

0 1 0 0 0 - 1 0 0

0 0 1 0 - 1 0 - 1 1

- 1 0 0 1 0 0 - 1 1

- 1 0 0 0 0 0 - 1 1

0 0 0 0 0 - 1 0 0

0 0 0 0 0 0 - 1 0

0 0 0 0 - 1 0 - 1 1

A = { ( 1,1 ),(2,2),(4,3),(1,4),(4,1),(2,0),(3,0),(4,0) }

ELI71 I IEI u2 0 02 u3 = 0 and v3 = 13

u4 2 04 1 1

with the objective ¢=28 .

Now we have yk= {0,1,1,I,0,0,0,1 }, so this solution is optimal with the objective 28 for both the primal LPI or LP2 and the dual LP3 or LP4. Corresponding to A, we have x22=x43=x~4=x3~ = 1 and all other x~j are zero.

5. E X P L A N A T I O N OF THE MATRIX

Let us take the final solution to explain the matrix D. According to the final basic cells in A, a linear equation set can be formed as follows:

Page 6: A new algorithm for the assignment problem: An alternative to the Hungarian method

1022 Ping Ji et al.

- - U I + V I = C l l

- - /A2 + V2---- C22

- - /~4 + V3 = C43

- - Ul +V4--___Cl 4

- - / ~ 4 + V I =C41

- - U 2 + Y 0 = C20

-- U3+V0=C30

- - U 3 + V I =C31

This equation set has eight equations but nine variables. However, since the cells (2,0) and (3,0) are virtual cells, the corresponding costs for virtual cells are always zero, so c~0=C3o=0 and Vo=0 (always). Now we have eight equations and eight variables. In fact, these equations are from the constraint (5) in LP3. Solving the equation set, we have Ut=7, u2=0, u3=0, U4=2, vt=9, v2=4, v3= 13, v4= l l, which are the same results obtained previously by the algorithm. The equation set can also be expressed in a matrix format as follows:

0 0 0 - l 0 0 0

1 0 0 0 - i 0 0

0 l 0 0 0 0 - 1

0 0 1 - 1 0 0 0

0 0 0 0 0 0 - 1

0 0 0 0 - 1 0 0

0 0 0 0 0 - l 0

0 0 0 0 0 - 1 0

~hasbeenrep laced

1

0

0

0

I

0

0

1

It should be noticed that the variable matrix form.

q

v, I I ' 2

I' 3

I,' 4

Ut

l'/2

U 4

e l l

¢22

C43

C14

c41

C2~

C31

by 0 so we have only eight variables in this

Let B be the 2n x 2n coefficient matrix in the above equation set, then it can easily be verified that:

B - i = D . (7)

That is, B is the inverse of D, and D is the inverse of B. This is true not only for this final solution, but also for all other iterations (feasible solutions), including the initial feasible solution. This also means that the algorithm presented previously is correct since a feasible solution is obtained by 2n equations from the constraints of the dual.

6. EXPLANATION OFTHEALGORITHM

The algorithm presented in this paper can be explained by the dual Simplex method. In general, the dual Simplex method has three major steps, which are: (l) initialization, (2) feasibility test, and (3) iteration [10]. The initialization step is to find an infeasible solution to the primal (but feasible to the dual) and its corresponding basic variables. The feasibility test is to check whether all the basic variables are non-negative. If these basic variables are non-negative, the solution is feasible to the primal (also feasible to the dual), and so optimal to both the primal and the dual according to the duality theory. If one of the basic variables is negative, the iteration step is necessary. The iteration step has three substeps [10], that is, determining the leaving basic variable, determining the entering basic variable, and determining the new basic solution.

The steps of the algorithm in this paper are similar to the dual Simplex method. The basic cell set A represents the basic variables in the primal LP2. The Yt values in Step 1 represent the solution of these basic variables. Step 0 in the algorithm is to find a feasible solution from the dual LP3 (but infeasible to the primal LP2), which is exactly the same as the initialization step in the dual Simplex method. Moreover, the feasible solution obtained in Step 0.1 also satisfies (7). At Step 0.3, the matrix D can be rewritten as:

I,,×. G.×. ] D= LO.× . -I.×.

Page 7: A new algorithm for the assignment problem: An alternative to the Hungarian method

A new algorithm for the assignment problem 1023

where submatrix I is an identity matrix, submatrix 0 is a zero matrix, and submatrix G is a general matrix. It is very easy to verify (7), that is:

B=B-'=D

in this case in the initialization step. Step l in this algorithm is to test the feasibility (the dual Simplex method) and determine the leaving variable, if the solution is not optimal. Step 2 is to obtain the leaving variable and Step 3 is to obtain a new solution, corresponding to the iteration step in the dual Simplex method.

From the above explanation, the algorithm in the paper follows the idea of the dual Simplex method. However, the algorithm uses the matrix form to represent the solution of the basic cells (variables) instead of the Simplex tableau in the dual Simplex method. This is one of the advantages of the algorithm over the dual Simplex method.

7. C O N C L U S I O N S

A new algorithm for the assignment problem was proposed in this paper, which is based on matrix operations. The rationale of the algorithm is to find 2n equations from the dual constraints of an n × n assignment problem. The principle of the algorithm is similar to the dual Simplex method. However, it adopts a compact matrix format instead of the Simplex tableau in the dual Simplex method. Moreover, compared with the Hungarian method, the algorithm does not need to find the minimum number of lines in a reduced cost matrix, and it can be an alternative to the Hungarian method. The disadvantage of the algorithm is that a 2n × 2n matrix is required in order to solve an n × n assignment problem.

R E F E R E N C E S

1. Kuhn, H. W., The Hungarian method for the assignment problem. Naval Research Logistics, 1955.2, 83-97. 2. Lotfi, V., A labeling algorithm to solve the assignment problem. Computers and Operations Research, 1989, 16, 397--408. 3. Balinski, M. L,, A competitive (dual) simplex method for the assignment problem. Mathematical Programming, 1986, 34.

125-141. 4. Goldfarb, D., Efficient dual simplex methods for the assignment problem. Mathematical Programming, 1985, 33, 187-203. 5. Hung, M. S., A polynomial simplex method for the assignment problem. Operations Research, 1983.31,595--600. 6. Paparrizos, K., An infeasible (exterior point) simplex algorithm for assignment problems. Mathematical Programming, 1991,

51, 45-54. 7. Balinski, M. L.. Signature methods for the assignment problem. Operations Research, 1985, 33, 527-536. 8. Orlin, J. B. and Ahuja, R. K., New scaling algorithms for the assignment and minimum mean cycle problems. Mathematical

Programming, 1992, 54, 41-56. 9. Hung, M. S. and Rom, W. O., Solving the assignment problem by relaxation. Operations Research, 1980, 28, 969-982.

10. Hillier, E S. and Lieberman, G. J., Introduction to Operations Research, 6th edn. McGraw-Hill, New York. 1995.