Monday, November 17, 2008

An Integer Programming Computer Program Applied to a Widely-Known Assignment Problem

Jsun Yui Wong
The problem considered here is the 12-location problem in Hillier [1] and in Nugent, Vollmann, and Ruml [2]. Line 561 through line 626 of the computer program below are slightly different from the mathematical formulation on page 6 of Heragu and Kusiak [3] and on page 140 of Heragu [4]. Line 1321 through line 1328 below use the interdepartmental flows presented in Hillier [1, p. 33] and in Nugent, Vollmann, and Ruml [2, p. 168].
The following computer program benefits from the computer programs of the present blog and the computer program on pages 229-232 of Conley [5].
2 DEFINT I,J,K
5 DIM B(99),N(99),A(99),H(99),L(99),U(99),X(1111),D(111),P(222)
12 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
43 FOR IOC=1 TO 24
45 B(IOC)=0
47 NEXT IOC
51 FOR IOCTT=1 TO 12
53 N(IOCTT)=3
57 NEXT IOCTT
58 FOR IOCTT=13 TO 24
59 N(IOCTT)=2
60 NEXT IOCTT
61 FOR KLQ=1 TO 24
62 A(KLQ)=B(KLQ)+RND*(N(KLQ)-B(KLQ))
63 NEXT KLQ
71 FOR KLR=1 TO 24
72 H(KLR)=3
73 NEXT KLR
88 FOR JJJ=1 TO 1000 STEP 10
90 FOR INEW=1 TO 1
94 FOR J=INEW*2 TO 0 STEP -1
102 FOR JJ=0 TO 24
128 FOR I=1 TO 3
129 FOR KKQQ=1 TO 24
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
132 FOR K=1 TO 24
133 IF RND<=.5 THEN 298 ELSE 230
134 REM
137 REM
230 IF A(K)-(N(K)-B(K))/H(K)^J250 L(K)=B(K)
255 GOTO 265
260 L(K)=A(K)-(N(K)-B(K))/H(K)^J
265 IF A(K)+(N(K)-B(K))/H(K)^J>N(K) THEN 266 ELSE 268
266 U(K)=N(K)-L(K)
267 GOTO 272
268 U(K)=A(K)+(N(K)-B(K))/H(K)^J-L(K)
272 GOTO 300
298 X(K)=A(K)+2*RND*(2*RND-1)*(1/(1+RND*JJJ))*.05*A(K)
299 GOTO 302
300 X(K)=(L(K)+2*RND*RND*U(K))
302 NEXT K
304 X(JJ)=A(JJ)
306 KLPS=FIX(1+RND*72)
307 FOR KLA1=1 TO KLPS
308 KLA2=FIX(1+24*RND)
309 X(KLA2)=A(KLA2)
310 NEXT KLA1
343 IF RND>.1 GOTO 361
352 IF RND<.5 THEN 353 ELSE 355
353 X(JJ)=B(JJ)
354 GOTO 361
355 X(JJ)=N(JJ)
361 FOR I222=1 TO 24
364 X(I222)=FIX(X(I222))
368 NEXT I222
461 IF RND>.1 GOTO 531
465 IF RND<1/2 THEN 471 ELSE 491
471 IOCT1=1+FIX(RND*12)
474 IOCT2=1+FIX(RND*12)
477 X(IOCT1)=A(IOCT2)
480 X(IOCT2)=A(IOCT1)
481 GOTO 531
491 IOCT6=13+FIX(RND*12)
494 IOCT7=13+FIX(RND*12)
497 X(IOCT6)=A(IOCT7)
500 X(IOCT7)=A(IOCT6)
502 GOTO 531
511 IOCT8=25+FIX(RND*12)
514 IOCT9=25+FIX(RND*12)
517 X(IOCT8)=A(IOCT9)
520 X(IOCT9)=A(IOCT8)
522 GOTO 531
531 FOR IOCX=1 TO 12
533 IF X(IOCX)>3 THEN X(IOCX)=3
535 NEXT IOCX
537 FOR IOCXX=13 TO 24
538 IF X(IOCXX)>2 THEN X(IOCXX)=2
539 NEXT IOCXX
541 FOR IOCY=1 TO 24
543 IF X(IOCY)<0 THEN X(IOCY)=0
545 NEXT IOCY
561 P(11)=ABS(X(1)-X(2))+ABS(X(13)-X(14))
562 P(12)=ABS(X(1)-X(3))+ABS(X(13)-X(15))
563 P(13)=ABS(X(1)-X(4))+ABS(X(13)-X(16))
564 P(14)=ABS(X(1)-X(5))+ABS(X(13)-X(17))
565 P(15)=ABS(X(1)-X(6))+ABS(X(13)-X(18))
566 P(16)=ABS(X(1)-X(7))+ABS(X(13)-X(19))
567 P(17)=ABS(X(1)-X(8))+ABS(X(13)-X(20))
568 P(18)=ABS(X(1)-X(9))+ABS(X(13)-X(21))
569 P(19)=ABS(X(1)-X(10))+ABS(X(13)-X(22))
570 P(20)=ABS(X(1)-X(11))+ABS(X(13)-X(23))
571 P(21)=ABS(X(1)-X(12))+ABS(X(13)-X(24))
572 P(22)=ABS(X(2)-X(3))+ABS(X(14)-X(15))
573 P(23)=ABS(X(2)-X(4))+ABS(X(14)-X(16))
574 P(24)=ABS(X(2)-X(5))+ABS(X(14)-X(17))
575 P(25)=ABS(X(2)-X(6))+ABS(X(14)-X(18))
576 P(26)=ABS(X(2)-X(7))+ABS(X(14)-X(19))
577 P(27)=ABS(X(2)-X(8))+ABS(X(14)-X(20))
578 P(28)=ABS(X(2)-X(9))+ABS(X(14)-X(21))
579 P(29)=ABS(X(2)-X(10))+ABS(X(14)-X(22))
580 P(30)=ABS(X(2)-X(11))+ABS(X(14)-X(23))
581 P(31)=ABS(X(2)-X(12))+ABS(X(14)-X(24))
582 P(32)=ABS(X(3)-X(4))+ABS(X(15)-X(16))
583 P(33)=ABS(X(3)-X(5))+ABS(X(15)-X(17))
584 P(34)=ABS(X(3)-X(6))+ABS(X(15)-X(18))
585 P(35)=ABS(X(3)-X(7))+ABS(X(15)-X(19))
586 P(36)=ABS(X(3)-X(8))+ABS(X(15)-X(20))
587 P(37)=ABS(X(3)-X(9))+ABS(X(15)-X(21))
588 P(38)=ABS(X(3)-X(10))+ABS(X(15)-X(22))
589 P(39)=ABS(X(3)-X(11))+ABS(X(15)-X(23))
590 P(40)=ABS(X(3)-X(12))+ABS(X(15)-X(24))
591 P(41)=ABS(X(4)-X(5))+ABS(X(16)-X(17))
592 P(42)=ABS(X(4)-X(6))+ABS(X(16)-X(18))
593 P(43)=ABS(X(4)-X(7))+ABS(X(16)-X(19))
594 P(44)=ABS(X(4)-X(8))+ABS(X(16)-X(20))
595 P(45)=ABS(X(4)-X(9))+ABS(X(16)-X(21))
596 P(46)=ABS(X(4)-X(10))+ABS(X(16)-X(22))
597 P(47)=ABS(X(4)-X(11))+ABS(X(16)-X(23))
598 P(48)=ABS(X(4)-X(12))+ABS(X(16)-X(24))
599 P(49)=ABS(X(5)-X(6))+ABS(X(17)-X(18))
600 P(50)=ABS(X(5)-X(7))+ABS(X(17)-X(19))
601 P(51)=ABS(X(5)-X(8))+ABS(X(17)-X(20))
602 P(52)=ABS(X(5)-X(9))+ABS(X(17)-X(21))
603 P(53)=ABS(X(5)-X(10))+ABS(X(17)-X(22))
604 P(54)=ABS(X(5)-X(11))+ABS(X(17)-X(23))
605 P(55)=ABS(X(5)-X(12))+ABS(X(17)-X(24))
606 P(56)=ABS(X(6)-X(7))+ABS(X(18)-X(19))
607 P(57)=ABS(X(6)-X(8))+ABS(X(18)-X(20))
608 P(58)=ABS(X(6)-X(9))+ABS(X(18)-X(21))
609 P(59)=ABS(X(6)-X(10))+ABS(X(18)-X(22))
610 P(60)=ABS(X(6)-X(11))+ABS(X(18)-X(23))
611 P(61)=ABS(X(6)-X(12))+ABS(X(18)-X(24))
612 P(62)=ABS(X(7)-X(8))+ABS(X(19)-X(20))
613 P(63)=ABS(X(7)-X(9))+ABS(X(19)-X(21))
614 P(64)=ABS(X(7)-X(10))+ABS(X(19)-X(22))
615 P(65)=ABS(X(7)-X(11))+ABS(X(19)-X(23))
616 P(66)=ABS(X(7)-X(12))+ABS(X(19)-X(24))
617 P(67)=ABS(X(8)-X(9))+ABS(X(20)-X(21))
618 P(68)=ABS(X(8)-X(10))+ABS(X(20)-X(22))
619 P(69)=ABS(X(8)-X(11))+ABS(X(20)-X(23))
620 P(70)=ABS(X(8)-X(12))+ABS(X(20)-X(24))
621 P(71)=ABS(X(9)-X(10))+ABS(X(21)-X(22))
622 P(72)=ABS(X(9)-X(11))+ABS(X(21)-X(23))
623 P(73)=ABS(X(9)-X(12))+ABS(X(21)-X(24))
624 P(74)=ABS(X(10)-X(11))+ABS(X(22)-X(23))
625 P(75)=ABS(X(10)-X(12))+ABS(X(22)-X(24))
626 P(76)=ABS(X(11)-X(12))+ABS(X(23)-X(24))
788 FOR INSI=11 TO 76
791 IF P(INSI)<.5 THEN P(INSI)=9999 ELSE P(INSI)=P(INSI)
795 NEXT INSI
1321 P11B=5*P(11)+2*P(12)+4*P(13)+1*P(14)+.01*P(15)+.01*P(16)+6*P(17)+2*P(18)+1*P(19)+1*P(20)+1*P(21)
1322 P12B=3*P(22)+.01*P(23)+2*P(24)+2*P(25)+2*P(26)+.01*P(27)+4*P(28)+5*P(29)+.01*P(30)+.01*P(31)
1323 P13B=.01*P(32)+.01*P(33)+.01*P(34)+.01*P(35)+5*P(36)+5*P(37)+2*P(38)+2*P(39)+2*P(40)
1324 P14B=5*P(41)+2*P(42)+2*P(43)+10*P(44)+.01*P(45)+.01*P(46)+5*P(47)+5*P(48)
1325 P15B=10*P(49)+.01*P(50)+.01*P(51)+.01*P(52)+5*P(53)+1*P(54)+1*P(55)
1326 P16B=5*P(56)+1*P(57)+1*P(58)+5*P(59)+4*P(60)+.01*P(61)
1327 P17B=10*P(62)+5*P(63)+2*P(64)+3*P(65)+3*P(66)+.01*P(67)+.01*P(68)+5*P(69)+.01*P(70)
1328 P18B=.01*P(71)+10*P(72)+10*P(73)+5*P(74)+.01*P(75)+2*P(76)
1443 P1=P11B+P12B+P13B+P14B+P15B+P16B+P17B+P18B
1448 P6=P1+0+0+0+0
1449 PS1=0
1450 P=-P6+PS1
1451 IF P<=M THEN 1670
1452 M=P
1453 PP1=P6
1454 FOR KLX=1 TO 24
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1457 GOTO 128
1670 NEXT I
1702 NEXT JJ
1706 NEXT J
1777 NEXT INEW
1888 NEXT JJJ
1890 IF M>-295 THEN 1916 ELSE 1999
1916 PRINT JJJJ,M,PP1
1917 PRINT A(1),A(2),A(3),A(4),A(5)
1918 PRINT A(6),A(7),A(8),A(9),A(10)
1920 PRINT A(11),A(12)
1922 PRINT A(13),A(14),A(15),A(16),A(17)
1924 PRINT A(18),A(19),A(20),A(21),A(22)
1926 PRINT A(23),A(24),JJJJ,M,PP1
1999 NEXT JJJJ
The .01s above are the 0s of the n=12 case, Nugent et al. [2, p. 168].
This BASIC computer program was run with the IBM basica/D interpreter, and its best candidate solutions through JJJJ=-30497 (in compressed form and to be interpreted in accordance with line 1916 through line 1926; copied manually from the computer monitor) are presented below.
-31908 -289.65 289.65
0 0 0 3 3
2 2 2 1 1
1 3
1 2 0 1 2
2 0 1 0 2
1 0 -31908 -289.65 289.65
-31625 -291.64 291.64
3 3 3 0 0
1 2 2 1 2
1 0
1 0 2 1 0
0 2 1 2 0
1 2 -31625 -291.64 291.64
-30901 -291.64 291.64
3 3 3 0 0
1 2 2 1 2
1 0
1 0 2 1 0
0 2 1 2 0
1 2 -30901 -291.64 291.64
-30896 -289.65 289.65
0 0 0 3 3
2 2 2 1 1
1 3
1 0 2 1 0
0 2 1 2 0
1 2 -30896 -289.65 289.65
-30497 -289.65 289.65
0 0 0 3 3
2 2 2 1 1
1 3
1 2 0 1 2
2 0 1 0 2
1 0 -30497 -289.65 289.65
The best candidate solutions shown above are at JJJJ=-31908, JJJJ=-30896, and JJJJ=-30497 with an objective function value of 289.65. (The last two digits, 6 and 5, should be disregarded because these are due to the artificial flows, the .01s.)
The output above was produced in 10 hours on a personal computer with an Intel 2.66 GHz. chip and the IBM interpreter, which is slower than the corresponding compiler.
If one makes changes to the computer program above, such as a change of changing line 128 above to 128 FOR I=1 TO 4, one may or may not obtain 289, which is optimal. That leads to a general remedy that in general, in order to increase the probability of getting an optimal solution, one preferably should run several computers simultaneously, each with a different line 128, for example; instead of line 128, another line can be chosen. This multicomputer approach can mitigate the possible danger of missed optimality and can produce a usable solution faster than just running one computer.
References
[1] F.S. Hillier, Quantitative tools for plant layout analysis, J. Indust. Eng. 14 (1963) 33-40.
[2] C.E. Nugent, T.E. Vollmann, J. Ruml, An experimental comparison of techniques for the assignment of facilities to locations, Operations Research 16 (1968) 150-173.
[3] S.S. Heragu, A. Kusiak, Efficient models for the facility layout problem, European Journal of Operational Research 53 (1991) 1-13.
[4] S.S. Heragu, Recent models and techniques for solving the layout problem, European Journal of Operational Research 57 (1992) 136-144.
[5] W.C. Conley, Optimization: A Simplified Approach, Petrocelli, Princeton, New Jersey, 1981.