Jsun Yui Wong
The computer program listed below seeks to solve Problem LW5 of Amaral (2006, p. 514), which is Problem 1 of Love and Wong (1976, p. 141). In order to have integer locations, the department lengths used in the following computer program have been made twice as long as the given department lengths.
0 DEFDBL A-Z
3 DEFINT I,J,K
4 DIM X(42),A(42),L(33),K(33),P(33)
5 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
111 FOR K=1 TO 5
113 A(K)=FIX(RND*99)
115 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 5
131 X(KK)=A(KK)
132 NEXT KK
222 IJL=1+FIX(RND*9)
233 X(IJL)=FIX(RND*99)
1151 P1=ABS(X(1)-X(2))-4
1153 IF P1<0 THEN P1=P1 ELSE P1=0
1155 P2=ABS(X(1)-X(3))-5
1157 IF P2<0 THEN P2=P2 ELSE P2=0
1161 P3=ABS(X(1)-X(4))-7
1163 IF P3<0 THEN P3=P3 ELSE P3=0
1164 P4=ABS(X(1)-X(5))-8
1165 IF P4<0 THEN P4=P4 ELSE P4=0
1166 P5=ABS(X(2)-X(3))-7
1167 IF P5<0 THEN P5=P5 ELSE P5=0
1168 P6=ABS(X(2)-X(4))-9
1169 IF P6<0 THEN P6=P6 ELSE P6=0
1171 P7=ABS(X(2)-X(5))-10
1173 IF P7<0 THEN P7=P7 ELSE P7=0
1175 P8=ABS(X(3)-X(4))-10
1177 IF P8<0 THEN P8=P8 ELSE P8=0
1181 P9=ABS(X(3)-X(5))-11
1182 IF P9<0 THEN P9=P9 ELSE P9=0
1184 P10=ABS(X(4)-X(5))-13
1185 IF P10<0 THEN P10=P10 ELSE P10=0
1482 PK=-2*ABS(X(1)-X(2))-1*ABS(X(1)-X(3))-0*ABS(X(1)-X(4))-1*ABS(X(1)-X(5))-0*ABS(X(2)-X(3))-2*ABS(X(2)-X(4))-2*ABS(X(2)-X(5))-6*ABS(X(3)-X(4))-3*ABS(X(3)-X(5))-4*ABS(X(4)-X(5))
1485 PL=-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1488 P=PK+PL
1499 PR=PK
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 5
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-303 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1915 PRINT M,MM,JJJJ
1999 NEXT JJJJ
This BASIC computer program was run with the IBM basica/D interpreter, and the output produced in the first 12 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
51 55 32 22 43
-302 -302 -31968
58 54 89 79 66
-302 -302 -31883
Interpreted in accordance with line 1912 and line 1915, the output through JJJJ=-31883 was produced in the first 12 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
References
Amaral, 2006 A.R.S. Amaral, On the exact solution of a facility layout problem, European Journal of Operational Research 173 (2006), pp. 508-518.
Love and Wong, 1976 R.F. Love and J.Y. Wong, On solving a one-dimensional allocation problem with integer programming, Information Processig and Operations Research (INFOR) 14 (1976), pp. 139-143.