Jsun Yui Wong
The complete computer program listed below seeks to solve a small space allocation problem (Armour and Buffa, 1963). The departmment sizes for department 1 through department 4 are 20x50, 30x40, 10x20, and 60x70, respectively; the interdepartmental flows are shown in line 1624 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(11)
65 FOR JJJJ=-32000 TO 32000
74 RANDOMIZE JJJJ
76 M=-1D+17
85 FOR I=1 TO 8
88 A(I)=FIX(RND*240)
89 NEXT I
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 8
131 X(KK)=A(KK)
132 NEXT KK
223 IJL=1+FIX(RND*8)
234 X(IJL)=FIX(RND*240)
401 HS(1)=ABS(X(1)-X(2))-25
402 HS(2)=ABS(X(1)-X(3))-15
403 HS(3)=ABS(X(1)-X(4))-40
405 HS(5)=ABS(X(2)-X(3))-20
406 HS(6)=ABS(X(2)-X(4))-45
409 HS(9)=ABS(X(3)-X(4))-35
413 HS(13)=ABS(X(5)-X(6))-45
414 HS(14)=ABS(X(5)-X(7))-35
415 HS(15)=ABS(X(5)-X(8))-60
417 HS(17)=ABS(X(6)-X(7))-30
418 HS(18)=ABS(X(6)-X(8))-55
421 HS(21)=ABS(X(7)-X(8))-45
551 IF HS(1)<-.0001 AND HS(13)<-.0001 THEN TL(1)=999999! ELSE TL(1)=0
553 IF HS(2)<-.0001 AND HS(14)<-.0001 THEN TL(2)=999999! ELSE TL(2)=0
554 IF HS(3)<-.0001 AND HS(15)<-.0001 THEN TL(3)=999999! ELSE TL(3)=0
557 IF HS(5)<-.0001 AND HS(17)<-.0001 THEN TL(4)=999999! ELSE TL(4)=0
559 IF HS(6)<-.0001 AND HS(18)<-.0001 THEN TL(5)=999999! ELSE TL(5)=0
561 IF HS(9)<-.0001 AND HS(21)<-.0001 THEN TL(6)=999999! ELSE TL(6)=0
1611 SUMTL=0
1613 FOR IR=1 TO 6
1615 SUMTL=SUMTL+TL(IR)
1618 NEXT IR
1624 PR1=-111*ABS(X(1)-X(2))-222*ABS(X(1)-X(3))-110*ABS(X(1)-X(4))-88*ABS(X(2)-X(3))-260*ABS(X(2)-X(4))-250*ABS(X(3)-X(4))-111*ABS(X(5)-X(6))-222*ABS(X(5)-X(7))-110*ABS(X(5)-X(8))-88*ABS(X(6)-X(7))-260*ABS(X(6)-X(8))-250*ABS(X(7)-X(8))
1650 P=PR1-999*SUMTL
1651 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1662 MM=PR1
1666 GOTO 128
1670 NEXT I
1890 IF M>-45000! THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1914 PRINT A(6),A(7),A(8),MM,M,JJJJ
1999 NEXT JJJJ
This BASIC computer program was run with the IBM basica/D interpreter, and the output produced during the first 2 minutes of running is presented below. What immediately follows is a manual copy from the computer screen.
199 224 184 149 98
98 98 98 -43375 -43375
-31973
97 124 81 46 185
185 185 185 -44973 -44973
-31962
180 155 195 231 103
102 103 103 -44454 -44454
-31933
166 191 151 116 14
14 14 14 -43375 -43375
-31919
Interpreted in accordance with line 1912 and line 1914, the output through JJJJ=-31919 was produced during the first 2 minutes of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
G. C. Armour and E. S. Buffa, "A Heuristic Algorithm and Simulation Approach to Relative Location of Facilities," Management Science 9, 294-309 (1963).