Jsun Yui Wong
The complete computer program listed below is concerned with a three-dimensional layout problem based on the two-dimensional problem of Armour and Buffa (1963). The facility sizes for facility 1 through facility 5 are 25x20x40, 25x20x40, 35x30x40,
30x20x50, and 35x20x50, respectively; the flows are shown in line 1621 through line 1632 of the following program. The data for the first two dimensions are from Heragu (2008, page 220). In order to have integer solutions, these original lengths and widths are multiplied by 4; then these longer lengths and widths are used in line 551 through line 589 of the following program.
0 DEFSNG A-Z
3 DEFINT I,J,K
4 DIM X(466),A(466),L(466),K(466),P(466),B(466),S(466),J(466),HS(99)
6 DIM T(11,11,5),TZ(11,11),TL(33)
65 FOR JJJJ=-32000 TO 32000
74 RANDOMIZE JJJJ
76 M=-1D+17
85 FOR I=1 TO 15
88 A(I)=FIX(RND*1000)
89 NEXT I
126 IMAR=10+FIX(RND*20000)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 15
131 X(KK)=A(KK)
132 NEXT KK
223 IJL=1+FIX(RND*15)
234 X(IJL)=FIX(RND*1000)
291 HS(1)=ABS(X(1)-X(2))
292 HS(2)=ABS(X(1)-X(3))
293 HS(3)=ABS(X(1)-X(4))
294 HS(4)=ABS(X(1)-X(5))
322 HS(5)=ABS(X(2)-X(3))
323 HS(6)=ABS(X(2)-X(4))
324 HS(7)=ABS(X(2)-X(5))
325 HS(8)=ABS(X(3)-X(4))
326 HS(9)=ABS(X(3)-X(5))
336 HS(10)=ABS(X(4)-X(5))
383 HS(11)=ABS(X(6)-X(7))
384 HS(12)=ABS(X(6)-X(8))
385 HS(13)=ABS(X(6)-X(9))
386 HS(14)=ABS(X(6)-X(10))
391 HS(15)=ABS(X(7)-X(8))
392 HS(16)=ABS(X(7)-X(9))
393 HS(17)=ABS(X(7)-X(10))
401 HS(18)=ABS(X(8)-X(9))
402 HS(19)=ABS(X(8)-X(10))
406 HS(20)=ABS(X(9)-X(10))
441 HS(21)=ABS(X(11)-X(12))
442 HS(22)=ABS(X(11)-X(13))
443 HS(23)=ABS(X(11)-X(14))
444 HS(24)=ABS(X(11)-X(15))
448 HS(25)=ABS(X(12)-X(13))
449 HS(26)=ABS(X(12)-X(14))
450 HS(27)=ABS(X(12)-X(15))
454 HS(28)=ABS(X(13)-X(14))
455 HS(29)=ABS(X(13)-X(15))
456 HS(30)=ABS(X(14)-X(15))
551 IF HS(1)-100<-.0001 AND HS(11)-80<-.0001 AND HS(21)-160<-.0001 THEN HS(1)=999999!
553 IF HS(2)-120<-.0001 AND HS(12)-100<-.0001 AND HS(22)-160<-.0001 THEN HS(2)=999999!
554 IF HS(3)-110<-.0001 AND HS(13)-80<-.0001 AND HS(23)-180<-.0001 THEN HS(3)=999999!
555 IF HS(4)-120<-.0001 AND HS(14)-80<-.0001 AND HS(24)-180<-.0001 THEN HS(4)=999999!
565 IF HS(5)-120<-.0001 AND HS(15)-100<-.0001 AND HS(25)-160<-.0001 THEN HS(5)=999999!
568 IF HS(6)-110<-.0001 AND HS(16)-80<-.0001 AND HS(26)-180<-.0001 THEN HS(6)=999999!
569 IF HS(7)-120<-.0001 AND HS(17)-80<-.0001 AND HS(27)-180<-.0001 THEN HS(7)=999999!
584 IF HS(8)-130<-.0001 AND HS(18)-100<-.0001 AND HS(28)-180<-.0001 THEN HS(8)=999999!
585 IF HS(9)-140<-.0001 AND HS(19)-100<-.0001 AND HS(29)-180<-.0001 THEN HS(9)=999999!
589 IF HS(10)-130<-.0001 AND HS(20)-80<-.0001 AND HS(30)-200<-.0001 THEN HS(10)=999999!
1621 PR1=-10*(HS(1)+HS(11)+HS(21))-15*(HS(2)+HS(12)+HS(22))-20*(HS(3)+HS(13)+HS(23))-.01*(HS(4)+HS(14)+HS(24))
1622 PR2=-30*(HS(5)+HS(15)+HS(25))-35*(HS(6)+HS(16)+HS(26))-10*(HS(7)+HS(17)+HS(27))
1631 PR3=-10*(HS(8)+HS(18)+HS(28))-20*(HS(9)+HS(19)+HS(29))
1632 PR4=-15*(HS(10)+HS(20)+HS(30))
1655 P=PR1+PR2+PR3+PR4
1656 IF P<=M THEN 1670
1657 FOR KEW=1 TO 15
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1666 GOTO 128
1670 NEXT I
1890 IF M>-22200 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1914 PRINT A(6),A(7),A(8),A(9),A(10)
1915 PRINT A(11),A(12),A(13),A(14),A(15)
1919 PRINT M,JJJJ
1999 NEXT JJJJ
One notes that the flow of .01 in line 1621 above is an artificial flow.
This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter, and the output produced in the first ten hours of running is presented below. What immediately follows is a manual copy from the computer screen.
149 268 269 158 268
192 111 211 111 31
194 194 194 194 194
-22147.8 -31580
445 445 565 445 575
643 723 702 803 802
137 137 137 137 137
-22182.89 -28684
578 459 458 569 459
337 257 357 257 177
322 322 322 322 322
-22132.79 -25897
739 619 619 729 619
432 512 412 512 592
352 352 352 352 352
-22102.8 -24282
388 507 508 397 508
575 655 555 655 735
327 327 327 327 326
-22182.81 -24229
Interpreted in accordance with line 1912 through line 1919, the output above was produced in the first ten hours of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter, which is not a compiler.
References
G. C. Armour and E. S. Buffa, "A Heuristic Algorithm and Simulation Approach to Relative Location of Facilities," Management Science 9, 294-309 (1963).
S. S. Heragu. Facilities Design, Third Edition. Boca Raton, Florida: CRC Press, 2008.