Jsun Yui Wong
The computer program listed below seeks to solve Problem P4 of Amaral (2006, p. 518).
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 4
113 A(IJL)=FIX(RND*50)
115 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 4
131 X(K)=A(K)
132 NEXT K
222 IJL=1+FIX(RND*4)
233 X(IJL)=FIX(RND*50)
1151 P1=ABS(X(1)-X(2))-11
1153 IF P1<0 THEN P1=P1 ELSE P1=0
1155 P2=ABS(X(1)-X(3))-12
1157 IF P2<0 THEN P2=P2 ELSE P2=0
1161 P3=ABS(X(1)-X(4))-18
1163 IF P3<0 THEN P3=P3 ELSE P3=0
1165 P4=ABS(X(2)-X(3))-10
1167 IF P4<0 THEN P4=P4 ELSE P4=0
1171 P5=ABS(X(2)-X(4))-16
1173 IF P5<0 THEN P5=P5 ELSE P5=0
1175 P6=ABS(X(3)-X(4))-17
1177 IF P6<0 THEN P6=P6 ELSE P6=0
1488 P=-5*ABS(X(1)-X(2))-2*ABS(X(1)-X(3))-11*ABS(X(1)-X(4))-3*ABS(X(2)-X(3))-2*ABS(X(2)-X(4))-7*ABS(X(3)-X(4))-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6))
1499 PR=-5*ABS(X(1)-X(2))-2*ABS(X(1)-X(3))-11*ABS(X(1)-X(4))-3*ABS(X(2)-X(3))-2*ABS(X(2)-X(4))-7*ABS(X(3)-X(4))
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 4
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-639 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4)
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 5 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
35 46 0 17
-638 -638 -31982
14 3 49 32
-638 -638 -31969
13 2 48 31
-638 -638 -31917
Interpreted in accordance with line 1912 and line 1915, the output through JJJJ=-31917 was produced in the first 5 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
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.