Jsun Yui Wong
Using the nonlinear system of seven equations of a chemical equilibrium model from Carnahan, Luther, and Wilkes [1, pp. 321-329], the following computer program is an illustration of the domino algorithm merging the ideas on page 251-256 of Miller [2] and the ideas in the falling domino principle, domino effect, domino phenomenon , and domino theory. It is important to note that the domino effect is a chain reaction. X(1) of line 501, X(5) of line 511, X(7) of line 516, and X(6) of line 521 are like the first domino, the second domino, the third domino, and the fourth domino of the falling domino principle, respectively. Using the latest number for X(2), the latest number for X(4), and the latest number for X(3) from the lines preceding line 444, the right-hand side of line 501, (2.6058*X(2)*X(4))/X(3), can knock the first domino, X(1), down to its resolution, solution, optimal value. It is a good thing that the right-hand side of line 511 does not add new uncertainty because the right-hand side of line 511 involves the same variables, X(1), X(2), and X(3) and X(4) of line 501. After line 511, the right-hand side of 516 does not add new uncertainty. Similarly, after line 516, the right-hand side of line 521 also does not add new uncertainty. Immediately after line 521, there is a specific number for each of X(1), X(2), X(3), X(4), X(5), X(6), and X(7). These seven values are a solution to the nonlinear system of equations if these numbers make P(2) close to zero, P(4) close to zero, and P(6) close to zero.
0 REM DEFDBL A-Z
2 DEFINT I,J,K
5 DIM B(99),N(99),A(99),H(99),L(99),U(99),X(1111),D(111),P(111)
12 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
61 FOR KLQ=1 TO 7
62 A(KLQ)=RND
63 NEXT KLQ
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR KKQQ=1 TO 7
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
181 J=2+FIX(RND*3)
183 R=(1-RND*2)*A(J)
191 IF RND<.14 THEN X(J)=A(J)+RND^5*R ELSE IF RND<.17 THEN X(J)=A(J)+R ELSE IF RND<.2 THEN X(J)=A(J)+RND*R ELSE IF RND<.25 THEN X(J)=A(J)+RND^2*R ELSE IF RND<.33 THEN X(J)=A(J)+RND^3*R ELSE IF RND<.5 THEN X(J)=A(J)+RND^4*R ELSE X(J)=INT(X(J))
444 FOR J432=1 TO 7
445 IF X(J432)<.00002 THEN 1670
446 NEXT J432
501 X(1)=(2.6058*X(2)*X(4))/X(3)
511 X(5)=1-X(1)-X(2)-X(3)-X(4)
516 X(7)=(2)/(+X(3)+X(4)+2*X(5))
521 X(6)=.5*X(1)*X(7)+X(2)*X(7)+.5*X(3)*X(7)
622 P(2)=X(1)+X(2)+X(5)-1/X(7)
623 P(4)=-28837*X(1)-139009!*X(2)-78213!*X(3)+18927*X(4)+8427*X(5)+13492/X(7)-10690*X(6)/X(7)
625 P(6)=20*20*X(1)*X(4)^3-178370!*X(3)*X(5)
733 FOR J95=1 TO 7
734 IF X(J95)<.00002 THEN 1670
736 NEXT J95
1450 P=-ABS(P(2))-ABS(P(4))-ABS(P(6))
1451 IF P<=M THEN 1670
1452 M=P
1453 PP(2)=P(2):PP(4)=P(4):PP(6)=P(6)
1454 FOR KLX=1 TO 7
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1457 GOTO 128
1670 NEXT I
1890 IF M>-.11 THEN 1928 ELSE 1999
1928 PRINT A(1),A(2),A(3),A(4),A(5),A(6),A(7),M,JJJJ
1930 PRINT PP(2),PP(4),PP(6)
1999 NEXT JJJJ
This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter. The best candidate solution through JJJJ=-29409 is presented below. What immediately follows is a hand copy from the computer monitor.
.256978 1.209713E-02 7.964728E-02
.6492968 1.980841E-03 .4923137 2.728864
-9.943289E-02 -29409
-9.539694E-02 -3.66211E-04 -3.669739E-03
On a personal computer with an Intel 2.66 chip and the IBM basica/D interpreter, version GW BASIC 3.11, the running time from JJJJ=-32000 through JJJJ=-29409 was ten minutes.
The output of the computer program above suggests the following change: change line 1450 from
1450 P=-ABS(P(2))-ABS(P(4))-ABS(P(6)) of the computer program above
to
1450 P=-ABS(P(2))-RJJJJ*ABS(P(4))-ABS(P(6)) of the computer program below.
0 REM DEFDBL A-Z
2 DEFINT I,J,K
5 DIM B(99),N(99),A(99),H(99),L(99),U(99),X(1111),D(111),P(111)
12 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
22 RJJJJ=RND
61 FOR KLQ=1 TO 7
62 A(KLQ)=RND
63 NEXT KLQ
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR KKQQ=1 TO 7
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
181 J=2+FIX(RND*3)
183 R=(1-RND*2)*A(J)
191 IF RND<.14 THEN X(J)=A(J)+RND^5*R ELSE IF RND<.17 THEN X(J)=A(J)+R ELSE IF RND<.2 THEN X(J)=A(J)+RND*R ELSE IF RND<.25 THEN X(J)=A(J)+RND^2*R ELSE IF RND<.33 THEN X(J)=A(J)+RND^3*R ELSE IF RND<.5 THEN X(J)=A(J)+RND^4*R ELSE X(J)=INT(X(J))
444 FOR J432=1 TO 7
445 IF X(J432)<.00002 THEN 1670
446 NEXT J432
501 X(1)=(2.6058*X(2)*X(4))/X(3)
511 X(5)=1-X(1)-X(2)-X(3)-X(4)
516 X(7)=(2)/(+X(3)+X(4)+2*X(5))
521 X(6)=.5*X(1)*X(7)+X(2)*X(7)+.5*X(3)*X(7)
622 P(2)=X(1)+X(2)+X(5)-1/X(7)
623 P(4)=-28837*X(1)-139009!*X(2)-78213!*X(3)+18927*X(4)+8427*X(5)+13492/X(7)-10690*X(6)/X(7)
625 P(6)=20*20*X(1)*X(4)^3-178370!*X(3)*X(5)
733 FOR J95=1 TO 7
734 IF X(J95)<.00002 THEN 1670
736 NEXT J95
1450 P=-ABS(P(2))-RJJJJ*ABS(P(4))-ABS(P(6))
1451 IF P<=M THEN 1670
1452 M=P
1453 PP(2)=P(2):PP(4)=P(4):PP(6)=P(6):PRJJJJ=RJJJJ
1454 FOR KLX=1 TO 7
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1457 GOTO 128
1670 NEXT I
1890 IF M>-.007 THEN 1928 ELSE 1999
1928 PRINT A(1),A(2),A(3),A(4),A(5),A(6),A(7),M,JJJJ,PRJJJJ
1930 PRINT PP(2),PP(4),PP(6)
1999 NEXT JJJJ
This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter. The complete output through JJJJ=-26222 is presented below. What immediately follows is a hand copy from the computer monitor.
.324529 9.122397E-03 4.521917E-02
.6173423 .0037871 .5789768 2.98447 -6.795566E-03
-31034 .2459211
2.370685E-03 -9.765625E-04 -4.184723-03
.3257676 9.045929E-03 4.462472E-02
.6167215 3.840268E-03 .5806706 2.989417
-6.365321E-03 -29679 .2269497
4.140407E-03 -2.441406E-03 -1.670837E-03
Division by zero
Overflow
.3247342 9.109785E-03 4.512064E-02
.6172399 3.795505E-03 .5792573 2.985291
-4.121109E-03 -26222 .2971025
2.663672E-03 -9.765625E-04 -1.167297E-03
On a personal computer with an Intel 2.66 chip and the IBM basica/D interpreter, version GW BASIC 3.11, the running time from JJJJ=-32000 through JJJJ=-26222 was twenty minutes.
Continuing the run through JJJJ=32000 produced the following candidate solution, which is the best of the whole computer run if one takes the best of the worst among PP(2), PP(4), and PP(6) of each of the candidate solutions.
.3222536 9.260837E-03 4.631469E-02
.6184794 3.691495E-03 .575875 2.975407
-1.588749E-03 10181 .2049015
-8.825958E-04 2.441406E-04 -6.56128E-04
In general, a usable solution for another application of this algorithm may come early, late, or worse. To alleviate this shortcoming, one can simultaneously run independent computers with different line 126s. Here is one example: 126 IMAR=10+FIX(RND*1000), 126 IMAR=10+FIX(RND*1200), and 126 IMAR=10+FIX(RND*1500). This multicomputer approach can considerably reduce the time to obtain one usable solution.
References
[1] Bruce Carnahan, H. A. Luther, and James O. Wilkes, Applied Numerical Methods. New York: John Wiley and Sons, Inc., 1969.
[2] Ronald E. Miller, Optimization: Foundations and Applications. New York: John Wiley and Sons, Inc., 2000.
[3] 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.