Jsun Yui Wong
The computer program listed below seeks to solve the following quadratic capital budgeting problem.
Objective function:
Maximize:
-(X(1)+2*X(2)+3*X(3)-X(4))*(2*X(1)+5*X(2)+3*X(3)-6*X(4))
Constraints:
-4+X(1)+2*X(2)+X(3)+3*X(4)>=4
X(j)=0, 1
j=1, 2, 3, 4.
This problem is Example 2 of Kocis and Grossmann [1, p. 1410].
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
101 FOR KK=1 TO 4
103 A(KK)=FIX(RND*2)
106 NEXT KK
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
951 IJL2=1+FIX(RND*4)
961 X(IJL2)=FIX(RND*2)
1151 P1=-4+X(1)+2*X(2)+X(3)+3*X(4)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1488 P=-(X(1)+2*X(2)+3*X(3)-X(4))*(2*X(1)+5*X(2)+3*X(3)-6*X(4))-333333!*ABS(P1)
1499 PR=-(X(1)+2*X(2)+3*X(3)-X(4))*(2*X(1)+5*X(2)+3*X(3)-6*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>0 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 2 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
0 1 0 1
1 1 -32000
0 1 0 1
1 1 -31999
0 0 1 1
6 6 -31998
0 1 0 1
1 1 -31997
0 1 0 1
1 1 -31996
0 1 0 1
1 1 -31995
0 0 1 1
6 6 -31994
0 0 1 1
6 6 -31993
Interpreted in accordance with line 1912 and line 1915, the output through JJJJ=-31993 was produced in the first 2 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] Kocis, G. R.; Grossmann, I. E. Global Optimization of Nonconvex Mixed-Integer Nonlinear Programming (MINLP) Problems in Process Synthesis. Ind. Eng. Chem. Res. 1988, 27, 1407-1421.