Jsun Yui Wong
The computer program listed below seeks to solve the following problem from Kocis and Grossmann (1987).
Objective function:
Maximize:
X(3)-2*X(1)-X(2)
Constraints:
X(1)-2*EXP(-X(2))=0
-X(1)+X(2)+X(3)<=0
0.5<=X(1)<=1.4
X(3)= 0 or 1.
0 DEFDBL A-Z
3 DEFINT I,J,K
4 DIM X(42),A(42),L(33),K(33)
5 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
93 A(1)=.5+RND*.9
94 A(2)=-10+RND*20
103 A(3)=FIX(RND*2)
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 3
131 X(K)=A(K)
132 NEXT K
144 IF RND<.99 THEN 234 ELSE 961
234 IF RND<.5 THEN X(2)=-10+RND*20 ELSE X(2)=A(2)+(1-2*RND)*.00001*A(2)
255 GOTO 971
961 X(3)=FIX(RND*2)
971 X(1)=2*EXP(-X(2))
1151 P1=-X(1)+X(2)+X(3)
1159 IF P1>0 THEN P1=P1 ELSE P1=0
1488 P=X(3)-2*X(1)-X(2)-333333!*(ABS(P1))
1499 PR=X(3)-2*X(1)-X(2)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 3
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-2.125 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3)
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 3 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
1.374822583072051 .3748224882596145 1
-2.124467654403717 -2.124467654403717 -32000
1.374822568960346 .3748224985239971 1
-2.12446763644469 -2.12446763644469 -31999
1.374822568049993 .3748224991861579 1
-2.124467635286143 -2.124467635286143 -31996
Interpreted in accordance with line 1912 and line 1915, the output through JJJJ=-31996 was produced in the first 3 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
Kocis, G. R. and Grossmann, I. E. (1987) Relaxation Strategy for the Structural Optimization of Process Flowsheets. Ind. Eng. Chem. Res. 26, 1869-1880.