Jsun Yui Wong
The following computer program tries to solve the system design problem on pp. 114-115 of Syslo, Deo, and Kowalik [1] and modified by one modification, which is all upper bounds here are 30; see line 398 below. The problem is partly described by line 411 through line 459.
0 REM DEFDBL A-Z
2 DEFINT I,J,K,X,A
3 DIM B(99),N(99),A(99),H(99),L(99),U(99),X(1111),D(111),P(111),PS(33)
12 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+37
41 FOR J44=1 TO 14
42 A(J44)=RND
43 NEXT J44
126 IMAR=10+FIX(RND*5000)
128 FOR I=1 TO IMAR
129 FOR KKQQ=1 TO 14
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
133 FOR IPP=1 TO (1+FIX(RND*13))
181 J=1+FIX(RND*14)
183 R=(1-RND*2)*A(J)
187 X(J)=A(J)+RND^3*R
192 NEXT IPP
387 FOR J44=1 TO 14
388 IF X(J44)<0 THEN 1670
389 NEXT J44
397 FOR J44=1 TO 14
398 IF X(J44)>30 THEN 1670
399 NEXT J44
411 PS(1)=- 10*X(5)- 13*X(6)- 14*X(7)-16*X(8)+40
412 PS(2)=-10*X(1)- 14*X(2)- 9*X(3)- 8*X(4)+ 7*X(5)+12*X(6)+15*X(7)+10*X(8)
413 PS(3)=20*X(1)+28*X(2)+18*X(3)+16*X(4)-10*X(9)-13*X(10)-14*X(11)-22*X(12)
414 PS(4) =2*X(1)-X(9)-100*X(13)
415 PS(5) =X(6)+4*X(14)-4
416 PS(6) =X(7)-3*X(14)-0
417 PS(7)=50*X(1)+75*X(2)+60*X(3)+50*X(4)+600*X(5)+600*X(6)+800*X(7)+750*X(8)+25*X(9)+17*X(10)+20*X(11)+26*X(12) -2300
418 PS(8) =X(13)-1
419 PS(9) =X(14)-1
450 FOR J44=1 TO 9
451 IF PS(J44)>0 THEN PS(J44)=PS(J44) ELSE PS(J44)=0
453 NEXT J44
459 POB1=-50*X(1)- 60*X(2)- 40*X(3)- 20*X(4)- 60*X(5)- 75*X(6)- 75*X(7)-90*X(8)-3*X(9)- 4*X(10)- 4*X(11)- 4*X(12) -10*X(13)
460 POB2=-999999999#*(PS(1)^2+PS(2)^2+PS(3)^2+PS(4)^2+PS(5)^2+PS(6)^2+PS(7)^2+PS(8)^2 +PS(9)^2 )
463 P1NEWMAY= POB1 +POB2
466 P=P1NEWMAY
1111 IF P<=M THEN 1670
1452 M=P
1454 FOR KLX=1 TO 14
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1557 GOTO 128
1670 NEXT I
1889 IF M<-357 THEN 1999
1933 PRINT A(1),A(2),A(3),A(4),A(5)
1935 PRINT A(6),A(7),A(8),A(9),A(10)
1936 PRINT A(11),A(12),A(13),A(14)
1937 PRINT M,JJJJ
1999 NEXT JJJJ
This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter. The complete output through JJJJ=-26264 is shown below. What follows is a hand copy of the output on the computer-monitor screen.
0 0 0 5 0
2 0 1 0 0
1 3 0 0
-356 -30943
0 0 0 5 0
2 0 1 0 0
1 3 0 0
-356 -30426
0 0 0 5 0
2 0 1 0 0
1 3 0 0
-356 -27977
0 0 0 5 0
2 0 1 0 0
1 3 0 0
-356 -27170
0 0 0 5 0
2 0 1 0 0
1 3 0 0
-356 -26264
On a personal computer with an Intel 2.66 chip and the IBM basica/D interpreter, version GW BASIC 3.11, the throughput time (including printing) from JJJJ=-32000 through JJJJ=-26264 was 58 minutes, real time, not cpu time.
References
[1] Maciej M. Syslo, Narsingh Deo, Janusz Kowalik, Discrete Optimization Algorithms. Englewood Cliffs, New Jersey: Prentice-Hall, Inc., 1983.
[2] Microsoft Corp. BASIC, Second Edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C, Boca Raton, Florida 33432, 1981.