a simple dual algorithm for the generalised assignment problem

9
Journal of Heuristics, 2:303-311 (1997) © 1997 Kluwer Academic Publishers A Simple Dual Algorithm for the Generalised Assignment Problem JOHN M. WILSON Loughborough UniversityBusiness School, Loughborough, LE113TU, England Abstract A new algorithm for the generalised assignment problem is described in this paper. The dual-type algorithm uses a simple heuristic derived from a relaxation of the problem. The algorithm has been tested on generalised assignment problems of substantial size and compared to an exact integer programming approach and a well- established heuristic approach. Computational results look promising in terms of speed and solution quality. Key Words: assignment, generalised assignment, heuristics 1. Introduction The Generalised Assignment Problem (GAP) can be described using the terminology of Martello and Toth (1990) as follows. Given n items and m knapsacks with Pij = profit of item j if assigned to knapsack i, wij = weight of item j if assigned to knapsack i, ci = capacity of knapsack i, assign each item to exactly one knapsack so as to maximise the total profit, without assigning to any knapsack a total weight greater than its capacity, i.e., maximise Z=~-~PijXij (1.1) i=1 j : l n subject to ~ wijxij < ci i e M = {1, 2 ..... m}, (1.2) j:l m ~'-~xij = 1 jeN={1,2 ..... n}, (1.3) i=1 xij=Oorl icM, jEN, (1.4) where 1 if item j is assigned to knapsack i, (1.5) xij = 0 otherwise.

Upload: john-m-wilson

Post on 06-Jul-2016

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: A simple dual algorithm for the generalised assignment problem

Journal of Heuristics, 2:303-311 (1997) © 1997 Kluwer Academic Publishers

A Simple Dual Algorithm for the Generalised Assignment Problem

JOHN M. WILSON Loughborough University Business School, Loughborough, LE113TU, England

Abstract

A new algorithm for the generalised assignment problem is described in this paper. The dual-type algorithm uses a simple heuristic derived from a relaxation of the problem. The algorithm has been tested on generalised assignment problems of substantial size and compared to an exact integer programming approach and a well- established heuristic approach. Computational results look promising in terms of speed and solution quality.

Key Words: assignment, generalised assignment, heuristics

1. Introduction

The Generalised Assignment Problem (GAP) can be described using the terminology of Martello and Toth (1990) as follows. Given n items and m knapsacks with

Pij = profit of item j if assigned to knapsack i,

wij = weight of item j if assigned to knapsack i,

ci = capacity of knapsack i,

assign each item to exactly one knapsack so as to maximise the total profit, without assigning to any knapsack a total weight greater than its capacity, i.e.,

m a x i m i s e Z = ~ - ~ P i j X i j (1.1) i=1 j : l

n

subject to ~ wijxij < ci i e M = {1, 2 . . . . . m}, (1.2) j : l

m

~'-~xij = 1 j e N = { 1 , 2 . . . . . n}, (1.3) i=1

xi j=Oorl i c M , j E N , (1.4)

where

1 if item j is assigned to knapsack i, (1.5) xij = 0 otherwise.

Page 2: A simple dual algorithm for the generalised assignment problem

304 WILSON

Following Martello and Toth (1990), Pij, wij, and c i are assumed, without loss of gen- erality, to be non-negative integers. The problem arises in a number of contexts such as assigning tasks to processors, or jobs to agents. In a variation of the problem Foulds and Wilson (1994) describe the problem of allocating milk-producing farms to collection depots. A number of variations of the problem exist e.g., the objective function may be minimise, wij = w~ (i ~ M, j E N ) may hold in (1.2), or the inequality signs in (1.2) may be > with ci > 0 (i ~ M) . Exact algorithms for the problem have been devised by Ross and Soland (1975) and Fisher et al. (1986). The general concentration has been on 'primal' type approaches, but Guignard and Rosenwein (1989) presented a Lagrangean based 'dual' type approach which was the first algorithm able to solve problems with m*n = 500. GAP is shown in Fisher et al. (1986) to be NP hard and accordingly many researchers have developed approximate algorithms for the problem. The main reference for approximate algorithms and a full discussion of the problem is Martello and Toth (1990). Recent discus- sions on comparative performance of algorithms is contained in Amini and Racer (1994), which also lists applications and extensions to the problem and Osman (1995), updating Osman (1990), which describes various heuristics and comprehensively surveys the field. This paper will describe a simple 'dual' type approximate algorithm for GAP which is inspired by the algorithm MTHG described in Martello and Toth (1990). MTHG will be briefly described in the next section and the new algorithm introduced. Computational results follow in a later section.

2. An approximate algorithm for GAP

A polynomial-time heuristic algorithm for GAP was described in Martello and Toth (1981) and a Fortran code for implementing the algorithm, called MTHG, is further described and available in Martello and Toth (1990). In summary, the algorithm MTHG has the following steps.

Each constraint is thought of as a 'knapsack' to be filled. Let 3~j be a measure of the 'desirability' of assigning item i to knapsack j . For all

unassigned items, find the item j* having the maximum difference between the largest and second largest ~j (i ~ M). Item j* is then assigned to the knapsack for which f/j., is a maximum. The algorithm then proceeds iteratively until all items have been assigned. This completes the first phase of the algorithm. In the second phase of the algorithm, which may be optional, the current solution is improved by a sequence of pair-wise exchanges of j values. Choices for )~j include (a) j~j = Pij (b) ~j = Pi j /w i j ( c ) f i j = - w i j (d) 3~j = - wi j /c i . Comprehensive testing of this algorithm is described in Martello and Toth (1990).

The algorithm of Osman (1995) provides a sophisticated second phase which uses sim- ulated annealing and tabu search to build on the starting solution of the MarteUo and Toth (1990) heuristic.

The algorithm of Amini and Racer (1994) is claimed to run slower than MTHG, but produce solutions which are closer to the optimal. It should be noted that algorithm MTHG first obtains a feasible solution and then seeks to improve it. The new heuristic algorithm which will now be described only obtains a feasible solution on the last iteration. The heuristic, which will be termed WHG, has the following steps.

Page 3: A simple dual algorithm for the generalised assignment problem

A SIMPLE DUAL ALGORITHM 305

Step 1. Solve the relaxed problem rn n

maximise Z : Z Z pijxij

subject to

(2.1) i=l j = l

m

Z xij = 1 j ~ N (2.2) i=1

xij = 0 o r l i E M , j E N (2.3)

i.e., (1.1)-(1.4) with constraints (1.2) relaxed. Let x~j (i ~ M, j ~ N) be a solution to the problem given by (2.1)-(2.3).

Step 2. If Y~=l wiix[j < ci holds for all i 6 M, then stop. The optimal solution has been found, and is given by the xi' j values; otherwise go to Step 3.

Step 3. Let M1 be the index set of constraints such that

n

Z WijX[j > ci i E MI j = l

and M2 be the index set of constraints such that n

Z wijx[j < ci i r M2, M1U M2 = M. j = l

Let N1 be the index set of values of j such that xi~ = 1, i ~ M1, j ~ N. Calculate tij = (wi*j - wij)/(Pi*j - Pij,), i 6 M2, j 6 N1, where i* = arg{i 6 M1 : xi~ = 1}. (If pi,j -: Pij and wij <_ 11)i*j, set tij = O. If pi , j = Pij and wij > l13i*j, set tij = -cx~. If the coefficients ll)ij are such that a relationship ll)ij ~- 11)~ holds, i c M, j 6 N, then set tij = (Pi*j - pi j ) /w~) Put the tij values in ascending order. Let (i', j ' ) be the values of the (i, j ) subscripts of the largest positive tij value such that ~ = 1 wi,jx[,j + wi,j, < ci, also holds. (If no such (it, j ' ) exists, choose that (i, j ) corresponding to the largest positive tij value. If no such (i r, j ' ) exists and no positive tij value exists, then the problem is deemed to be infeasible.) Reallocate an item by setting Xi, jr = 1 a n d xi, j, = O. Go to Step 2. End.

The motivation for the choice of the tij value is that it measures the proportional degra- dation in the objective function per unit increase in feasibility. The time complexity of the heuristic is O(mn log n).

Lemma. The heuristic WHG terminates after a finite number of steps, producing an integer feasible solution to the problem given by (1.1)-(1.5), or declaring the problem to be infeasible.

Page 4: A simple dual algorithm for the generalised assignment problem

306 WILSON

Proof: The heuristic WHG terminates when Ml = 9.

/ n ) L e t d = i ~ M 1 E wijxi~ - ci •

• \ j = l

Assume MI ~ ~o and, equivalently, d > 0. Each operation of Step 3 of the heuristic WHG for a given (i, j ) decreases the value of

d by a non-negative quantity

! wi*j - wij, (i c M2, j E N1, i* = arg{i ~ M1 : x i j = 1}),

because of the choice of non-negative values of tij (i ~ M2, j ~ NI). Thus either d will be reduced to zero in a finite number of steps and hence Ml = ~o,

or only non-negative values of tij will remain whilst d > 0, in which case the procedure terminates, and the problem is deemed to be infeasible. []

Example (from Martello and Toth (1990)) L e t n = 8, rn = 3,

27 12 12 16 24 31 41 13'~ ( p i j ) = 14 5 37 9 36 25 1 34 ) 34 34 20 9 19 19 3 34

( 2 1 3 9 5 7 1 5 5 2 4 / ( w o ) = 20 8 18 25 6 6 9

16 16 18 24 11 11 16 1 8 ]

(26) ; (Ci) = 2 5

34

Step 1. Step 2. Step 3.

/ t 1 , X32 Set X31 1

Constraint i = 2 is

r 1. t 1 t ~ 1 , X28 ~--- t 1 t = 1 , X 1 6 ~ XI7 t 1 , X I 4 = , X 2 5 1 , X23 ~

not satisfied.

MI = {2}, M2 ---- {1, 3}, N1 = {3, 5, 8}.

t13 = 9/25, t33 = 0/17, t15 = - 1 / 1 2 , t35 = - 5 / 1 7 , tls = - 1 8 / 2 1 ,

t38 --- - 1 2 / 0 = - o ~ .

No condition Y~=I wi,jx~,j + wi,j, < Ci' holds, so choose (i', j ' ) = (1, 3). ReaUocate x'13 = 1 and x~3 = 0. Go to Step 2.

Step 2. Constraint i = 1 is not satisfied. Step 3.

MI = {1}, M2 = {2, 3}, N1 = {3, 4, 6, 7}.

t23 = - 9 / - 2 5 , t33 = - 9 / - 8 , t24 = - 2 0 / 7 , t34 ----- -19 /7 , /26 ~--- 9/6,

t36 = 4/12, t27 = - 3 / 4 0 , t37 = - 11/38.

Page 5: A simple dual algorithm for the generalised assignment problem

A SIMPLE DUAL ALGORITHM 307

t26 is largest and condition Y~=I Wi'jX['j + IDi'J ' < Ci' holds, so choose (i', j ' ) = (2, 6). Set x~6 = 1 and x'16 = 0. Go to Step 2.

Step 2. All constraints satisfied. Solution is x31 = 1, x32 = 1, x13 = 1, x14 = 1, x25 = 1, x26 ----- 1, xl7 -- 1, x28 = 1. Objective value is 232.

It should be noted that the above solution is the same as achieved by the M T H G heuristic of Martello and Toth (1990).

In the next section computational experience with the heuristics W H G and M T H G will be described.

3. Computat ional results

The heuristic W H G was first tested on a series of instances where rn is small and n is large and wij = w~ (i ~ M) . Following Foulds and Wilson (1994) problems of this type were of particular interest to the author. The results which are presented in Tables 1 and 2 were sufficiently encouraging to warrant some confidence in the algorithm which was subsequently tested on more general data sets. For the testing described in Tables 1 and 2 problems were generated in the following way. Values for w~ ( j 6 N) were chosen randomly from the discrete uniform distribution { 1, 2 . . . . . 20}. Values for Pij (i ~ M, j ~ N ) where

chosen using the formula Pij = ~/(r - vii) 2 + (r' - v0)2 where vii = 20( j - 1) / i and

Table I. Comparison of problems with m = 4, n = 500.

Problem IPV IPT MTHGS MTHGO MTHGT WHGS WHGO WHGT

1 10422 35.9 10422* 1.000 0.8 10422* 1.000 0.4

2 10519 51.7 10519* 1.000 0.8 10518 1.000 0.3

3 10490 62.7 10487 1.000 0.9 10490* 1.000 0.5

4 10538 39.1 10538* 1.000 0.7 10538* 1.000 0.4

5 10392 55.1 10390 1.000 0.9 10384 1.000 0.4

6 10518 44.9 10518* 1.000 0.9 10518* 0.999 0.3

7 10445 57.3 10444 1.000 1.0 10445* 1.000 0.4

8 10399 56.1 10389 0.999 0.9 10395 1.000 0.7

9 10365 34.5 10365 1.000 0.7 10365* 1.000 0.3

10 10472 108.7 10386 0.992 0.8 10472* 1.000 0.7

IPV = Branch and Bound optimal objective value. IPT = CPU seconds for IE MTHGS = Objective value for heuristic MTHG. MTHGO = Ratio MTHGS/1PV. MTHGT = CPU seconds for MTHGS. WHGS = Objective value for heuristic WHG. WHGO = Ratio WHGS/IPV. WHGT = CPU seconds for WHGS. * = Optimal.

Page 6: A simple dual algorithm for the generalised assignment problem

308 WILSON

Table 2. Three sets of 30 problems with m = 4.

MTHGO MTHGT WHGO WHGT

#opt min ave max min ave #opt min ave max min ave

500 13 0.996 1.000 1.0 0.6 0.7 19 0.998 1.000 0.7 0.1 0.4

1000 14 0.991 0.999 3.5 2.5 2.9 20 1.000 1.000 2.8 1.0 1.4

1500 19 0.998 1.000 6.7 5.1 5.7 24 1.000 1.000 2.7 2.1 2.4

# opt = Number of optimal solutions found. max = Maximum. min = Minimum. ave = Arithmetic mean.

r, r ' are random numbers uniformly distributed on [0, 1). Values for ci (i ~ M) were chosen using the formula ci = (0.6r + 0.8)*()--~___ 1 w~)/m, where r is a random number from the distribution [0, 1). The structure of this data reflects the fact that the Pij values were related to distances and the ci values were not tightly constraining.

Initially a set of ten problems was derived of size m = 4, n = 500. The results of the tests on these problems are given in Table 1. WHG was coded in Fortran 77 and MTHG is available on diskette in Martello and Toth (1990) also coded in Fortran 77. All runs were conducted on a Hewlett-Packard HP9000/700 using an optimising compiler. The results from the heuristic approaches were compared to an integer programming model for each problem using Sciconic/VM, which uses the Branch and Bound algorithm of integer programming (IP).

The results of Table 1 indicate that on ten problems both heuristics produce solutions of high quality in times that are fast compared to IP. In addition, WHG was about twice as fast as MTHG on average and produced slightly more (seven compared to five) optimal solutions. In further analysis presented in Table 2, the heuristics are compared against IP on three sets of thirty problems of sizes m = 4; n = 500, n = 1000, n = 1500. These problems were randomly generated in the same way as those of Table 1.

As can be seen from Table 2 the WHG heuristic continues to perform well, finding more optimal solutions than MTHG, finding more solutions closer to optimality than MTHG, and generally requiring about half the CPU time of the MTHG heuristic. In these results and all that follows time to solve problems using IP were orders of magnitude larger than times for the heuristics.

The algorithms were further tested on problems where wij ~ w~ (i ~ M) with the w values being chosen from the same uniform distribution as before. These results are presented in Table 3.

As can be seen from Table 3, on problems of varying sizes WHG continues to find good solutions to the problems faster than with MTHG but timings are not so markedly better and quality of solution is slightly poorer with fewer optimal solutions being found by WHG. However, the decrease in quality is small, reversing the small quality advantage of W H G noted in Table 2.

In line with the work of Amini and Racer (1994) the algorithm was also tested on data sets where there is close correlation between the value of 113ij and Pij. As before, ll)ij

Page 7: A simple dual algorithm for the generalised assignment problem

A SIMPLE DUAL ALGORITHM 309

Table 3. Three sets of 30 problems with differing m.

t r t x n

MTHGO MTHGT WHGO WHGT

#opt rain ave max min ave #opt min ave max min ave

10 × 200 14 0.992 0.999 0.6 0,3 0.4 10 0.993 0.999 0.3 0.1 0.1

20 × 300 18 0.998 1.000 1.5 1.1 1.3 2 0.991 0.999 1.1 0.7 0.7

50 x 500 ** 1.000 1.000 9.0 7.6 8.2 ** 0.999 1.000 8.8 4.1 6.8

**As it was not possible to run the 50 x 500 problems using the IP code because of its limitations on the number of (0-1) variables, data in this row use upper bound values as the denominator of ratios. The upper bound was calculated using the Ross and Soland (1975) procedure which is also discussed in Martello and Toth (1990).

Table 4. Three sets of 30 problems with differing m and correlated to and p.

m x n

MTHGO MTHGT WHGO WHGT

# opt min ave max min ave # opt min ave max min ave

10 x 200 4 0.991 0.997 0.4 0.3 0.3 0 0.991 0.997 0.3 0.1 0.2

20 x 300 ** 0.964 0.982 1.4 1.1 1.3 0 0.971 0.984 1.6 0.9 1.4

50 x 500 ** 0.967 0.969 8.3 7.3 7.6 0 0.963 0.977 25.5 1 8 . 3 21.0

**As it was not possible to run the 20 x 300 or 50 x 500 problems using the IP code because of its limitations on the number of (0-1) variables, data in these rows are compared to an upper bound value as discussed in Table 3.

Table 5. Three sets of 30 problems with correlated w and p.

m x n

MTHGO MTHGT WHGO WHGT

#opt min ave max min ave #opt rain ave max min ave

10 x 200 30 1.000 1.000 0.4 0.2 0.3 30 1.000 1.000 0.1 0.1 0.1

20 × 300 30 1.000 1.000 1.9 0.9 1.0 30 1.000 1.000 0.3 0.2 0.3

50 x 500 30 1.000 1.000 6.9 5.9 6.4 30 1.000 1.000 1.4 1.1 1.3

were chosen from the distribution [1, 20] but now pij values were chosen from the uniform integer distribution 113ij -~- 21 - r i j where r is a random number chosen from the uniform integer distribution [1, 20]. The values of ci were (1.75/m)*)-~7=1 wij. The results are presented in Table 4.

As can be seen from Table 4 performance of both algorithms is similar in terms of speed on the problems of size up to 20 rows and 300 columns, but quality of solution is slightly better for the MTHG algorithm. However, for the problems of size 50 rows and 500 columns MTHG is substantially faster than WHG and gives solutions of better quality.

Two further sets of problems were run and are discussed in Tables 5 and 6. In Table 5 results are presented using data sets generated according to Method D of

Laguna et al. (1995), which was originated by Martello and Toth (1990). The generator

Page 8: A simple dual algorithm for the generalised assignment problem

310 WILSON

Table 6. Three sets of 30 problems with inversely linked w and p.

m x n

MTHGO MTHGT WHGO WHGT

# opt min ave max min ave # opt rain ave max min ave

10x200 30 1.000 1.000 5.1 0.6 1.4 30 1.000 1.000 0.8 0.2 0.3 20x300 30 1.000 1.000 14.7 1.8 4.2 30 1.000 1.000 2.1 0.4 0.8 50x500 30 1.000 1 .000 49.5 1 5 . 5 31.0 30 1.000 1.000 11.6 1.7 3.3

uses the following integer uniform distribution functions:

ni o m,a As can be seen from Table 5, both heuristics were successful in obtaining optimal solutions

to the problem. However, the WHG heuristic was consistently faster than the MTHG algorithm.

In Table 6 results are presented using data sets generated according to Method E of Laguna et al. (1995). The generator uses the following integer uniform distribution functions:

w i j = I - 10*In(Uniform (0, I]), Pi j = l O 0 0 / w i j - I0" Uniform [0, I],

c: max(0 / As can be seen from Table 6 both heuristics were again successful in obtaining optimal

solutions to the problems, with the WHG heuristic consistently performing faster than MTHG. The problems generated by 'Methods D and E' of Laguna et al., are very tightly constrained but seem perversely to present less difficulty for the algorithms than the more loosely constrained problems discussed in Tables 3 and 4. It appears that in trying to find a solution to the problems discussed in Tables 5 and 6, the algorithms are perhaps so restricted in their paths that they tend to hit on the optimal solution (or an 'almost optimal' solution) more easily.

4. Conclusions

A new heuristic for the generalised assignment problem has been described. When com- pared to an established heuristic, the new heuristic performs well on sets of problems where the weights of the assigned items are independent of the knapsack to which they are allo- cated. Performance of the new heuristic is faster but slightly less accurate compared to the established heuristic when tested on sets of problems where the weights of the assigned items are dependent on the knapsack to which they are allocated but weights and profit are not closely correlated. For sets of problems where weights both vary according to knap- sack and are correlated with profit, both algorithms perform similarly for smaller problems

Page 9: A simple dual algorithm for the generalised assignment problem

A SIMPLE DUAL ALGORITHM 311

which are not t ightly constrained but the new heurist ic is s lower and less accurate for the

largest tested problems. For t ightly constrained problems with correlat ion be tween weight

and profit both heurist ics are ex t remely accurate, but the new heurist ic is faster.

References

Amini, M.M. and M. Racer. (1994). "A Rigorous Comparison of Alternative Solution Methods for the Generalized Assignment Problem," Management Science 40, 868-890.

Fisher, M.L., R. Jaikumar, and L.N. Van Wassenhove. (1986). "A Multiplier Adjustment Method for the Generalized Assignment Problem," Management Science 32, 1095-1103.

Foulds, L.R. and J.M. Wilson. (1994). "A Variation on the Generalized Assignment Problem Arising in the New Zealand Dairy Industry." Working paper, Loughborough University Business School. To appear in Anna& of Operations Research.

Guignard, M.M. and M.B. Rosenwein. (1989). "An Improved Dual Based Algorithm for the Generalized Assign- ment Problem," Operations Research 37, 658-663.

Laguna, M., J.P. Kelly, J.L. Gonzalez-Velarde, and E Glover. (1995). "Tabu Search for the Multilevel Generalized Assignment Problem," European Journal of Operational Research 82, 176-189.

Martello, S. and P. Toth. (1981). "An Algorithm for the Generalized Assignment Problem." In J.P. Brans (Ed.), Operational Research '81,589-603, North-Holland, Amsterdam.

Martello, S. and P. Toth. (1990). Knapsack ProblerrLv: Algorithms and Computer Implementations. Chichester: John Wiley and Sons.

Osman, I.H. (1990). "A Comparison of Heuristics for the Generalised Assignment Problem." Working Paper, Institute of Mathematics and Statistics, University of Kent, Kent, England.

Osman, I.H. (1995). "Heuristics for the Generalised Assignment Problem: Simulated Annealing and Tabu Search Approaches," OR Spektrum 17, 211-225.

Ross, G.T. and P.M. Soland. (1975). "A Branch and Bound Based Algorithm for the Generalized Assignment Problem," Mathematical Programming 8, 91-103.

Sciconic/VM. EDS-Scicon, Wavendon Tower, Milton Keynes, Bedfordshire, England.