Contributions to the quadratic assignment problem N. CHRISTOFIDES
then the problem can be formulated as follows:
Department of Management Science, Imperial College, London S1¢7 2BX, England
rain(z) = ~
0t,[3 a>O
A. MINGOZZI
~
i, j i >i
f~odiixaixo},
(1)
SOGESTA, Urbino, Italy
s.t.
P. TOTH
~ i
x~i -" 1 ,
cf = 1, ..., n,
(2)
i = 1, ..., n ,
(3)
a, i = 1..... n.
(4)
Unive, sity of Bologna, Bologna, Italy ~xai
Received February 1979
xot, i = 0, 1,
Tree search procedures for solving the Koopmans Beckmann quadratic assignment problem (QAP) are unable to solve any reasonable size QAP's mainly because good quality lower bounds for this problem cannot be computed. The purpose of this paper is to propose a bounding technique based on the extraction from the QAP fornmlation, of a large linear assignment problem (which can then be solved optimally), leavingas a residual problem as 'small' a QAP as possible. The solution of this residual QAP can then be bounded by a separate procedure. This 2-step method produces improved bounds as compared with those produced by the direct application of the bounding algorithms to the original QAP. In addition, a procedure is described for the a priori fixing of variables in the QAP formulation, thus reducing the number of variables in the problem.
It is well.known that the QAP is a very difficult combinatorial optimisation problem which can be solved optimally only for sizes of up to 14 or 15 machines [3]. The main exact algorithms to date are tree search procedures whose performance is great!y dependent on the quality of the computed lower bounds in order to limit the tree search. It is, in fact, true to say that the main reason for the comparative failure of these algorithms to solve QAP's of nontrivial size compared to the size of other combinatorial problems that can be solved, is the inability to compute 'tight' lower bounds. We may, for example, mention that the bounds proposed by Lawler [ 13] and Gilmore [7] or those by Land [121 and Gavett and Plyter [6] are on average about 5% from the QAP optimum solution, a gap much larger than for other combinatorial problems. The purpose of this paper is to propose a bounding technique based on the extraction from the QAP formulation, of a large linear assignment problem (which can then be solved optimally), leaving as a residual problem as 'small' a QAP as possible. The solution of this residual QAP can then be bounded by a separate procedure. This 2-step method produces improved bounds as compared with those produced by the direct application of the bounding algorithms to the original QAP. In addition, a procedure is described fo~ the a priori fixing of variables in the QAP formulation, thus reducing the number of variables in the problem
I. I n t r o d u c t i o n
We consider the quadratic assignment problem (QAP) as given by Koopmans and Beckmann [ 11 ]. The problem is to assign n machines to n locations to minimize the sum of intermachine transportation costs. The flow f ~ between each pair of machines 0~and/3 and the unit cost dii between each pair of locations i and / are known. We assume [fao] and [dii] to be symmetric, if we represent the assignment of machines to locations by an n × n permutation matrix x = [xat] where: 1 xai = {0
= 1 ,
rv
if machine a is assigned to location i, otherwise;
O North-Holland PublishingCompany European Journal of Operational Research 4 (1980) 243-247 243
244
N. Christofides et al. [ The quadratic assignment problem
2. Transformation of the QAP Consider (n - 1) flows from machine c~
12,1 , ..., / g and (n - 1) distances from location i
al, aL .... d ? - ' . Let us denote f~ as Fa + 5fak and d[' as D, + 6d~. Consider a mapping p of the flows onto the distances. The cost of this mapping is: n--I
f~kdf(k) - (n - 1) FaD i + F a ~ k=1
5d~ (k)
(5)
k
Ic
k
=A~i + ~ ~fk ~df(k), (6) k where Aod is the sum of the first three terms on the RHS of eq. (5) and is independent of p. Let n correspond to a mapping of machines to locations. The QAP is then to find rt* which minimises the expression: /,/
min ~ { ~ n
A~n(~) + ~
~
a
~ot
~=1
/ifoo ~id.(~).~O)}
(7) '
where ~fc~ is written for/~f~ and ~dn(~)~qj) for ~dflakt in eq. (6). Consider now the quadratic part of expression (7). Once more matrices [~foo] and [6dii] can be reduced (columnwise this time) in a manner similar to that given by eq. (6), thus deriving a linear cost term A-~ and a quadratic cost term involving the reduced cost matrices [~fa¢] and [Sdi/]. Henceforth, we will write the doubly reduced matrices as [/ifool and [Sdi/] and replace A~a by Aat + ,4at. A similar reduction was suggested in [ 16]. A Simultaneous reduction of both rows and columns of the matrices [fo¢] and [dii] is possible and is explored in [5]. Let n~ be the mapping minimising the first term of (7) and let the value of this mapping be V. Let [A~a] be the reduced cost matrix of [Aai] after the Hungarian algorithm for the solution of the linear assignment problem (AP) associated with [Aai] is applied. The cost z of the QAP is then: z---~V+min [~ ~
ot //~¢
Set up an (n block) by (n block) matrix S = [sod] where block (~ i) corresponds to machir~e ~ allocated to location i. Element sai(/I, ]) of this block then cor. responds to machine/I allocated to location ] (in addition to o~allocated to i). A solution to the QAP can be represented by entering t's into location soa(~,]) whenever o~is located at i and ~ at ] and entering 0 otherwise. A solution to the QAP then corresponds to only one block in each block-row and each block-coiumn containing non-zero entries, and within a block whose entries are not all-zero only one entry of I must exist in each row and column of the block. Thus, the entries of I in the matrix S, corresponding to a feasible solution to the QAP, form an assignment with respect to S, but the reverse is not true, i.e. not every assignment in S corresponds to a feasible solution to the QAP.
3. Computation of the bound and problem reduction In order to compute the lower bound to the QAP an auxiliary matrix Q = [qca'] will be required. This matrix can be computed in a number of ways, some of which are listed below.
Method A (i) Multiplying row a of [SfoO], ordered in ascending order, with row i of [6di/], ordered in descending order, to give qai. This corresponds to the least cost mapping of stars of the form as shown in Fig. 1. (ii) Similar to (i) above but with 'row' replaced by 'column'. This corresponds to the least cost mapping of stars of the form as shown in Fig. 2. (iii) Take qoa equal to half the sum of the values obtained by (i) and (ii) above (see Fig. 3).
A~#(a)
(8)
Fig. 1. Machineo~to location i.
N. Christofides et al. / The quadratic ,Tssignment problem
245
!
Fig. 3. Machine at to location i.
Fig. 2. Machine at to location L
Set up an n by n matrix L = [lai] as:
Computational note: Method A requires O(n log n) operations for the calculation of each qai. None of
P
the cases (i), (ii) or (iii) above dominate any other. The method is fast but ignores the prohibited machine,to-location assignments implied by the O's in S.
Method B
J
(9)
set all entries of block s~i to O. if for an entry sai({3,j) of matrix S we have: 2I (V + A'oa"+ A'fl] + 5foo 6dii + 5 f ~ ~dii) >t z*
The value ll~i is now a lower bound on the increase of the QAP solution (over and above ~ V) that would result if machine t~ is allocated to location i. An overall bound on the QAP is then: LB = ~ V + ~AP(L)
Let z ° be the value of a known solution to the QAP. If, for any block sai of matrix S we have:
2!( V + A~i) >~ z*
l~i = A ~i + q~i .
where AP(L) is the value of the AP solution of matrix L. This bound is quite clearly superior in quality to other existing bounds and could be used in a tree search algorithm. Let L' = [l'ai] be the reduced cost matrix of matrix L after the solution of the AP. If for any !~. we have:
(10)
~l'oi>~z * - LB
set sai((3, ]) = O.
(13)
Method B is the equivalent of method ", but with the prohibitions implied by S considered. (i) Set up an (n - 1) by (n - 1) matrix [motl where each row corresponds to a machine 4:a and each column corresponds to a location :¢:i. Compute element mot as:
we can set all entries of block sai to 0. Conditions, stronger than condition (10), can now be used for setting some sai({3,/) to O, for those blocks sai which are not all-zero. The conditions are:
mot = 5fao ~dit
and
( 1 1)
if sai(O, t) d: 0 else mot = oo. Solve the linear AP for matrix [mot ] and set clai equal to the value of this AP solution. (ii) This is similar to (i) but with (11 ) replaced by (12) mot = ~foa 8dtt
(12)
if Sot(a, i) :k 0 else mot = 00. (iii) Take mot equal to ~ the sum of the values ob. tained by (11) and (12) above. This corresponds to the mapping of the form as shown in Fig. 3.
Computational note: Method B requires O(n s12) operations for the calculation of each qa~.
l(V+l~i+
~
min
[4kl)> z"
' , LB + max [lab !~/] >1z*.
lO.a ( ! O.b)
3.1. A ssignments implied by S When as many entries orS are fixed (to either 0 or 1) by bounding considerations, as mentioned above, other assignment conclusions can be drawn bx examining S. There are numerous possibilities here and we mention only a few: (i) If in any block-row or block-column all blocks are all.zero an infeasibility is hnplied, if all but one (say s~i) blocks are all-zero then the assignment of machine ot to location i is implied. (ii) If for any row or column of S all entries
246
N. Christofates et aL / The quadratic assignment problem
except one (say sat(~l,])) are zero then the twin assignment of ot to i and ~ to ] is implied. (iii) In either of the above two cases the blockrows and block-columns corresponding to the implied assignment are removed and the reduced matrix ~' is again examined for further implications. When no further implications can be found in S, then starting from the new S, new matrices A and Q are computed (considering the implications in S) which in turn may lead to further fixing of entries in S, and so on, until no further improvement in the bound LB or fixing of entries in S are possible. Let us call LBo and So the final values of LB and S obtained at the root node of a tree search.
5. Example Consider the problem" A B C D
67 ]
A tf, l = aC
D
It is possible to linearise the quadratic assignment problem if we introduce n 4 variables Yaifj defined as:
~
A
xai = 1,
i = 1, ...,n,
Xod= l ,
0~= 1, ..., n,
3
4
2
3
4
10 0 13 0 25 21 5 0 0 0 8 7 0 36 0 43
[A~.-I- aC D
f~odilyatoj,
'~>0 i >i s.t.
2
1
then i'.tis possible to give an integer linear program in n 4 + n 2 variables as follows ~
1
taken from Gavett and Plyter [6]. The reduction of the problem to the form implied by (8) produces: (without columnwise reduction of [~faa] and [6di/]) V = 687
Yea#/= xoa" x~i ,
min(z)= ~
X5 6/, 5XI] 6 1X~
X 28 25 13 28 X 15 4 25 15 X 23 13 4 2 3 X
[d//] =
4. A !inear formulation of the QAP
6 7 2
A B C D
ot
~
i
Yai#/ >I x~i + x#/ - 1 ,
or, [3, i, j = 1 .... , n,
xa/=Oor 1 ,
or, i = l,...,n,
Yoaoi =0 or 1,
~,~, i, / = 1, ..., n.
A
X I 6
D
1
4 5 0 X 0 1 4 X0 5 0 X
1
2
[Sf~l-
If in So a block sai is all-zero set: Xod=O , YaBi/ = 0 ,
4 VIi ~ a
and
/ ~=i.
If in So an entry sai(~, ]) = 0 set Y~i/ = 0
thus reducing the number' of variables and constraints in the above formulation of the QAP./alternative linear formulations of the QAP involving only 2n z variables and 2n 2 + 2n constraints are possible [5].
3
4
X 15 12 0 24 X 11 0 10 0 X 8 9 0 19X
z* (value of best solution so far)= 408.
Using method A 0ii), matrix Q is computed as: 1
2
3
4
A F68- 2915
Q=B /96.5 35.5 93.5 20.5 C ]46.5
a L O,5
22
4.3.5 18 5.5 9.5 4.5
N. Christofides et al. / The quadratic assignment problem
puted based on the modified S matrix, and at this stage blocks Scl and SDa can be crossed out, thus implyir, g the only assignment possible i.e.
The matrix L is: 1
2
3
4
78 29.5 77.5 22 121.5 56.5 98.5 20.5 46.5 22 51.5 25
A B L= C D
10.5
41.5
--
,.
.
.
9.5
A~-2,
L,= B C D
2
3
24 69 0 0
0 28.5 0 55.5
24.5 47 6 0
2
0 0 10.5 69
A B
C
4--1
3
=
=.r
3¢
M
4
.~
=
1 2 4 1 2
,~
3
%%%
X
/S S
b," sS
)<)
SS %%. ""N
'
D %%'X sJ sS
A D B (2 Fig. 4. Matrix 8.
/ S~ %% %
X
References
[11 G.C. Armor and E.S. Buffa, A heuristic algorithm and
4
problem is now reduced to one where A ",- 2, B ~ 4 and where C or D must be assigned to either [ocation 1 or3. At the second iteration, a new matrix Q is corn-
2
D~I
of value 403.
with AP(L) = 106 and the lower bound is 396.5 (i.e. LB = 397) therefore z ° - [ V - t AP(L) = I 1.5. Applying condition (13)we set all entries of blocks SAI, $,43, $BI, SB2, SB3, $C4, SD2 and s i ~ to 0. These blocks are shown crossed out by solid lines in the S matrix of Fig. 4. With these blocks out, B can now only be assigned to location 4, hence block sA4 and Sc4 can be also crossed out (shown dotted in the S matrix). A can now only be assigned to location 2, and hence block so2 can also be crossed out. The
"
C<-3,
.
1
1
B~4,
47.5
The boldface figures give the AP solution to L. The matrix L' is:
A
247
% / % ? %% ,.,/ S t S
i
%% %
simulation approach to the relative location of facilities, Management Sci. 9 (1963) 294-309. [2l E.S. Buffa and T.E. Vollmann, The facilities layout problem in perspective, Management Sci. 12 (1966) 450-468. 131 R.E. Burkard and K.H. Stratmann, Numerical investigations on quadratic assignment problems, Naval Res. Logist. Quart. 25 (1978). [41 N. Christofides and M. Gerrard, Special cases of the quadratic assignment problem, Operations Res., to appear. N. lSl Christofides, A. Mingozzi and P. Toth, Algorithms for the quadratic assignment problem, Report IC-OR79-25, Imperial College (1979). [6] J.W. Gavett and N.V. Plyter, The optimal assignment of facilities to locations by branch and bound, Operations Res. 14 (1966) 210-232. [71 P.C. Gilmore, Optimal and suboptimal algorithms for the quadratic problem, J. SIAM 10 (1962) 305-313. [81 G.W. Graves and A.B. Whinston, An algorithm for the quadratic assignment problem, Management Sci. 16 (1970) 453-471. 19] M. Hanan and J. Kurtzberg, A review of the placement and quadratic assignment problems, SIAM Rev. 14 (1972) 324-342. [10] F.S. Hillier and M.M Connors, Quadratic assignment problem algorithms and the location of indivisible facilities, Management Sci. 13 (1966) 42-57. l l l l T.C. Koopmans and M.J. Beckmann, Assignment problems and the location of economic activities, Econometriea 25 (1957) 53-76. [121 A.H. Land, A problem of assignment with inter-related costs, Operational Res. Quart. 14 (1963) 185-199. [131 E.L. Lawler, The quadratic assignment problem, Management Sci. 9 (1963) 586-599. [141 C.E. Nugent, T.E. Vollmann and J. Rumi, An experimental comparison of techniques for the assignment of facilities to locations, Operations Re ~. 16 (1968) 150-173. LlSl J.F. Pierce and W.B. Crowston, Tree-search algorithms for the quadratic assignment problem, Naval Res. Logist. Quart. 18 (1971) 1-36. t161 C. Roucairol, Branch and bound methods for the QAP, Euro !11 Confcreacc, Amsterdam 1979. !171 M. Scriabin and R.C. Vergin° Comparison of computer algorithms and visual.,based methods for plant layout, Management Sci. 22 (1974) 172-181.