Jsun Yui Wong
The complete computer program listed below seeks to solve a six-department space allocation problem (Armour and Buffa, 1963). The departmment sizes for department 1 through department 6 are 25x20, 25x20, 35x30, 30x20, 35x20, and 60x40, respectively; the interdepartmental flows are shown in line 1624 through line 1627 of the following program. The sizes and flows of the first five departments are from Heragu (2008). The 1-6, 2-6, 3-6, 4-6, and 5-6 flows are 17, 32, 26, 13, and 19, respectively.
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(22)
65 FOR JJJJ=-32000 TO 32000
74 RANDOMIZE JJJJ
76 M=-1D+17
85 FOR I=1 TO 12
88 A(I)=(RND*240)
89 NEXT I
126 IMAR=10+FIX(RND*20000)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 12
131 X(KK)=A(KK)
132 NEXT KK
223 IJL=1+FIX(RND*12)
234 X(IJL)=(RND*240)
391 HS(1)=ABS(X(1)-X(2))-25
392 HS(2)=ABS(X(1)-X(3))-30
393 HS(3)=ABS(X(1)-X(4))-27.5
394 HS(4)=ABS(X(1)-X(5))-30
395 HS(5)=ABS(X(1)-X(6))-42.5
405 HS(6)=ABS(X(2)-X(3))-30
406 HS(7)=ABS(X(2)-X(4))-27.5
407 HS(8)=ABS(X(2)-X(5))-30
408 HS(9)=ABS(X(2)-X(6))-42.5
409 HS(10)=ABS(X(3)-X(4))-32.5
410 HS(11)=ABS(X(3)-X(5))-35
411 HS(12)=ABS(X(3)-X(6))-47.5
412 HS(13)=ABS(X(4)-X(5))-32.5
413 HS(14)=ABS(X(4)-X(6))-45
414 HS(15)=ABS(X(5)-X(6))-47.5
415 HS(16)=ABS(X(7)-X(8))-20
416 HS(17)=ABS(X(7)-X(9))-25
417 HS(18)=ABS(X(7)-X(10))-20
418 HS(19)=ABS(X(7)-X(11))-20
419 HS(20)=ABS(X(7)-X(12))-30
420 HS(21)=ABS(X(8)-X(9))-25
421 HS(22)=ABS(X(8)-X(10))-20
422 HS(23)=ABS(X(8)-X(11))-20
423 HS(24)=ABS(X(8)-X(12))-30
424 HS(25)=ABS(X(9)-X(10))-25
425 HS(26)=ABS(X(9)-X(11))-25
426 HS(27)=ABS(X(9)-X(12))-35
427 HS(28)=ABS(X(10)-X(11))-20
431 HS(29)=ABS(X(10)-X(12))-30
432 HS(30)=ABS(X(11)-X(12))-30
551 IF HS(1)<-.0001 AND HS(16)<-.0001 THEN TL(1)=999999! ELSE TL(1)=0
553 IF HS(2)<-.0001 AND HS(17)<-.0001 THEN TL(2)=999999! ELSE TL(2)=0
554 IF HS(3)<-.0001 AND HS(18)<-.0001 THEN TL(3)=999999! ELSE TL(3)=0
555 IF HS(4)<-.0001 AND HS(19)<-.0001 THEN TL(4)=999999! ELSE TL(4)=0
557 IF HS(5)<-.0001 AND HS(20)<-.0001 THEN TL(5)=999999! ELSE TL(5)=0
559 IF HS(6)<-.0001 AND HS(21)<-.0001 THEN TL(6)=999999! ELSE TL(6)=0
560 IF HS(7)<-.0001 AND HS(22)<-.0001 THEN TL(7)=999999! ELSE TL(7)=0
565 IF HS(8)<-.0001 AND HS(23)<-.0001 THEN TL(8)=999999! ELSE TL(8)=0
568 IF HS(9)<-.0001 AND HS(24)<-.0001 THEN TL(9)=999999! ELSE TL(9)=0
569 IF HS(10)<-.0001 AND HS(25)<-.0001 THEN TL(10)=999999! ELSE TL(10)=0
581 IF HS(11)<-.0001 AND HS(26)<-.0001 THEN TL(10)=999999! ELSE TL(11)=0
582 IF HS(12)<-.0001 AND HS(27)<-.0001 THEN TL(10)=999999! ELSE TL(12)=0
583 IF HS(13)<-.0001 AND HS(28)<-.0001 THEN TL(10)=999999! ELSE TL(13)=0
584 IF HS(14)<-.0001 AND HS(29)<-.0001 THEN TL(10)=999999! ELSE TL(14)=0
585 IF HS(15)<-.0001 AND HS(30)<-.0001 THEN TL(10)=999999! ELSE TL(15)=0
1611 SUMTL=0
1613 FOR IR=1 TO 15
1615 SUMTL=SUMTL+TL(IR)
1618 NEXT IR
1624 PR1=-10*ABS(X(1)-X(2))-15*ABS(X(1)-X(3))-20*ABS(X(1)-X(4))-0*ABS(X(1)-X(5))-17*ABS(X(1)-X(6))-30*ABS(X(2)-X(3))-35*ABS(X(2)-X(4))-10*ABS(X(2)-X(5))-32*ABS(X(2)-X(6))
1625 PR2=-10*ABS(X(3)-X(4))-20*ABS(X(3)-X(5))-26*ABS(X(3)-X(6))-15*ABS(X(4)-X(5))-13*ABS(X(4)-X(6))-19*ABS(X(5)-X(6))-10*ABS(X(7)-X(8))-15*ABS(X(7)-X(9))-20*ABS(X(7)-X(10))-0*ABS(X(7)-X(11))
1626 PR3=-17*ABS(X(7)-X(12))-30*ABS(X(8)-X(9))-35*ABS(X(8)-X(10))-10*ABS(X(8)-X(11))-32*ABS(X(8)-X(12))-10*ABS(X(9)-X(10))
1627 PR4=-20*ABS(X(9)-X(11))-26*ABS(X(9)-X(12))-15*ABS(X(10)-X(11))-13*ABS(X(10)-X(12))-19*ABS(X(11)-X(12))
1650 P=PR1+PR2+PR3+PR4-999*SUMTL
1651 IF P<=M THEN 1670
1657 FOR KEW=1 TO 12
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1662 MM=PR1+PR2+PR3+PR4
1666 GOTO 128
1670 NEXT I
1890 IF M>-11639 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),MM,M,JJJJ
1999 NEXT JJJJ
This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter, and the output produced in thirteen hours of running is presented below. What immediately follows is a manual copy from the computer screen.
136.2185 165.1701 166.2257 137.6041 195.1733
165.2049 53.04271 33.03552 58.10423 33.0356
33.01572 2.968483 -11631.06 -11631.06 -31438
155.788 126.4413 125.7753 153.9702 96.41533
126.3579 62.67572 82.73879 57.66229 82.73458
82.69295 112.7742 -11631.88 -11631.88 -30257
98.17766 128.1517 128.1806 100.6427 158.2056
128.1536 87.69828 107.7177 82.69673 107.7191
107.7014 137.7372 -11621.93 -11621.93 -27712
Interpreted in accordance with line 1912 through line 1915, the output through JJJJ=-27712 was produced during the first thirteen 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. CRC Press, 2008.