Jsun Yui Wong
The computer program listed below seeks to solve the following problem from Floudas [1].
Objective function:
Maximize:
.7*X(3)-5*(X(1)-.5)^2-.8
Constraints:
0-EXP(X(1)-.2)-X(2)<=0
1+X(2)+1.1*X(3)<=0
-.2+X(1)-1.2*X(3)<=0
0.2<=X(1)<=1
-2.22554<=X(2)<=-1
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)=.6
94 A(2)=-1.61277
103 A(3)=FIX(RND*2)
126 IMAR=10+FIX(RND*10000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 3
131 X(K)=A(K)
132 NEXT K
811 IF RND<.99 THEN 903 ELSE 961
903 IF RND<1/2 THEN 911 ELSE 921
911 X(1)=.2+.00001*FIX(RND*80001!)
915 GOTO 1151
921 X(2)=-2.22554+.00001*FIX(RND*122555!)
925 GOTO 1151
961 X(3)=FIX(RND*2)
1151 P1=0-EXP(X(1)-.2)-X(2)
1159 IF P1>0 THEN P1=P1 ELSE P1=0
1255 P2=1+X(2)+1.1*X(3)
1259 IF P2>0 THEN P2=P2 ELSE P2=0
1355 P3=-.2+X(1)-1.2*X(3)
1359 IF P3>0 THEN P3=P3 ELSE P3=0
1488 P=.7*X(3)-5*(X(1)-.5)^2-.8-333333!*(ABS(P1)+ABS(P2)+ABS(P3))
1499 PR=.7*X(3)-5*(X(1)-.5)^2-.8
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>-1.078 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 2.5 minutes of running is presented below. (What immediately follows is a manual copy from the computer screen.)
.9419499635696411 -2.100019931793213 1
-1.076598875337893 -1.076598875337893 -31978
.9421799778938294 -2.100460052490234 1
-1.077615688092795 -1.077615688092795 -31871
.9420099854469299 -2.100139856338501 1
-1.076864160015834 -1.076864160015834 -31729
Interpreted in accordance with line 1912 and line 1915, the output through JJJJ=-31729 was produced in the first 2.5 minutes of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] Floudas, C. A. (1995) Nonlinear and Mixed-Integer Optimization--Fundamentals and Applications. Oxford University Press, Oxford.
Friday, July 10, 2009
Thursday, July 9, 2009
A General Integer Nonlinear Programming Computer Program Applied to a Quadratic Capital Budgeting Problem
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.
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.
Wednesday, July 8, 2009
An Application of a General Integer Nonlinear Programming Computer Program
Jsun Yui Wong
The computer program listed below seeks to solve Problem 9 of Lawler and Bell [1, p. 1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-X(1)-X(2)-X(3)-X(4)-X(5)-X(6)-X(7)-X(8)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-X(1)-X(2)-X(3)-X(4)-X(5)-X(6)-X(7)-X(8)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 20 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
3 4 1 3 6
1 2 0
-20 -20 -31893
3 4 1 3 6
1 2 0
-20 -20 -31868
3 4 1 3 6
1 2 0
-20 -20 -31839
5 4 1 1 6
3 2 0
-22 -22 -31834
2 4 1 4 6
1 2 0
-20 -20 -31814
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31814--with two alternative optima at JJJJ=-31893 and at JJJJ=-31814--was produced in the first 20 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1966).
The computer program listed below seeks to solve Problem 9 of Lawler and Bell [1, p. 1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-X(1)-X(2)-X(3)-X(4)-X(5)-X(6)-X(7)-X(8)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-X(1)-X(2)-X(3)-X(4)-X(5)-X(6)-X(7)-X(8)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 20 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
3 4 1 3 6
1 2 0
-20 -20 -31893
3 4 1 3 6
1 2 0
-20 -20 -31868
3 4 1 3 6
1 2 0
-20 -20 -31839
5 4 1 1 6
3 2 0
-22 -22 -31834
2 4 1 4 6
1 2 0
-20 -20 -31814
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31814--with two alternative optima at JJJJ=-31893 and at JJJJ=-31814--was produced in the first 20 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1966).
Tuesday, July 7, 2009
A General Integer Nonlinear Programming Computer Program Applied to an Example from Capital Budgeting
Jsun Yui Wong
The computer program listed below seeks to solve the investment problem on page B-55 of Mao and Wallingford [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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*2)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
151 IAP=1+FIX(RND*8)
155 X(IAP)=FIX(RND*2)
1151 P1=-100+7*X(1)+35*X(2)+20*X(3)+12*X(4)+65*X(5)+60*X(6)+20*X(7)+5*X(8)
1159 IF P1>0 THEN P1=P1 ELSE P1=0
1255 P2=-70+5*X(1)+15*X(2)+30*X(3)+10*X(4)+7*X(5)+15*X(6)+50*X(7)+7*X(8)
1259 IF P2>0 THEN P2=P2 ELSE P2=0
1355 P3=-30+5*X(1)+12*X(2)+2*X(3)+10*X(4)+4*X(5)+2*X(6)+10*X(7)+7*X(8)
1359 IF P3>0 THEN P3=P3 ELSE P3=0
1455 P4=-15+5*X(1)+4*X(2)+0*X(3)+10*X(4)+4*X(5)+2*X(6)+5*X(7)+7*X(8)
1459 IF P4>0 THEN P4=P4 ELSE P4=0
1462 P5=-15+5*X(1)+4*X(2)+0*X(3)+6*X(4)+4*X(5)+2*X(6)+0*X(7)+7*X(8)
1469 IF P5>0 THEN P5=P5 ELSE P5=0
1472 P6=-15+2*X(1)+4*X(2)+8*X(3)+3*X(4)+4*X(5)+2*X(6)+0*X(7)+7*X(8)
1479 IF P6>0 THEN P6=P6 ELSE P6=0
1480 P7=X(1)-X(4)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-1+X(1)+X(2)+X(3)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-1+X(4)+X(5)+X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-1+X(7)+X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1491 P11=-1+X(1)+X(2)+X(3)
1492 IF P11<0 THEN P11=P11 ELSE P11=0
1495 P12=-1+X(4)+X(5)+X(6)
1496 IF P12<0 THEN P12=P12 ELSE P12=0
1498 P13=-1+X(7)+X(8)
1499 IF P13<0 THEN P13=P13 ELSE P13=0
1511 P=757*X(1)+825*X(2)+987*X(3)+350*X(4)+596*X(5)+650*X(6)+1420*X(7)+1425*X(8)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10)+ABS(P11)+ABS(P12)+ABS(P13))
1522 PR=757*X(1)+825*X(2)+987*X(3)+350*X(4)+596*X(5)+650*X(6)+1420*X(7)+1425*X(8)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 0 0
1 0 1
2900 2900 -31996
0 1 0 0 0
1 0 1
2900 2900 -31995
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31995 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] James C. T. Mao and B. A. Wallingford, "An Extension of Lawler and Bell's Method of Discrete Optimization with Examples from Capital Budgeting," Management Science 15, No. 2, Application Series, B51-B60 (Oct., 1968).
The computer program listed below seeks to solve the investment problem on page B-55 of Mao and Wallingford [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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*2)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
151 IAP=1+FIX(RND*8)
155 X(IAP)=FIX(RND*2)
1151 P1=-100+7*X(1)+35*X(2)+20*X(3)+12*X(4)+65*X(5)+60*X(6)+20*X(7)+5*X(8)
1159 IF P1>0 THEN P1=P1 ELSE P1=0
1255 P2=-70+5*X(1)+15*X(2)+30*X(3)+10*X(4)+7*X(5)+15*X(6)+50*X(7)+7*X(8)
1259 IF P2>0 THEN P2=P2 ELSE P2=0
1355 P3=-30+5*X(1)+12*X(2)+2*X(3)+10*X(4)+4*X(5)+2*X(6)+10*X(7)+7*X(8)
1359 IF P3>0 THEN P3=P3 ELSE P3=0
1455 P4=-15+5*X(1)+4*X(2)+0*X(3)+10*X(4)+4*X(5)+2*X(6)+5*X(7)+7*X(8)
1459 IF P4>0 THEN P4=P4 ELSE P4=0
1462 P5=-15+5*X(1)+4*X(2)+0*X(3)+6*X(4)+4*X(5)+2*X(6)+0*X(7)+7*X(8)
1469 IF P5>0 THEN P5=P5 ELSE P5=0
1472 P6=-15+2*X(1)+4*X(2)+8*X(3)+3*X(4)+4*X(5)+2*X(6)+0*X(7)+7*X(8)
1479 IF P6>0 THEN P6=P6 ELSE P6=0
1480 P7=X(1)-X(4)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-1+X(1)+X(2)+X(3)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-1+X(4)+X(5)+X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-1+X(7)+X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1491 P11=-1+X(1)+X(2)+X(3)
1492 IF P11<0 THEN P11=P11 ELSE P11=0
1495 P12=-1+X(4)+X(5)+X(6)
1496 IF P12<0 THEN P12=P12 ELSE P12=0
1498 P13=-1+X(7)+X(8)
1499 IF P13<0 THEN P13=P13 ELSE P13=0
1511 P=757*X(1)+825*X(2)+987*X(3)+350*X(4)+596*X(5)+650*X(6)+1420*X(7)+1425*X(8)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10)+ABS(P11)+ABS(P12)+ABS(P13))
1522 PR=757*X(1)+825*X(2)+987*X(3)+350*X(4)+596*X(5)+650*X(6)+1420*X(7)+1425*X(8)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 0 0
1 0 1
2900 2900 -31996
0 1 0 0 0
1 0 1
2900 2900 -31995
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31995 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] James C. T. Mao and B. A. Wallingford, "An Extension of Lawler and Bell's Method of Discrete Optimization with Examples from Capital Budgeting," Management Science 15, No. 2, Application Series, B51-B60 (Oct., 1968).
A Computer Program for Solving Discrete Optimization Problems
Jsun Yui Wong
The computer program listed below seeks to solve Problem 7 of Lawler and Bell [1, pp. 1107-1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-3*X(1)*X(4)-X(2)-X(2)*X(5)-X(2)*X(7)-6*X(3)*X(8)-X(5)*X(7)-11*X(6)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-3*X(1)*X(4)-X(2)-X(2)*X(5)-X(2)*X(7)-6*X(3)*X(8)-X(5)*X(7)-11*X(6)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 8 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
4 4 1 2 6
2 2 0
-94 -94 -31968
2 4 1 4 6
1 2 0
-83 -83 -31939
Interpreted in accordance with line 1912, line 1914, and line 1915, the output through JJJJ=-31939 was produced in the first 8 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L. Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1965).
The computer program listed below seeks to solve Problem 7 of Lawler and Bell [1, pp. 1107-1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-3*X(1)*X(4)-X(2)-X(2)*X(5)-X(2)*X(7)-6*X(3)*X(8)-X(5)*X(7)-11*X(6)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-3*X(1)*X(4)-X(2)-X(2)*X(5)-X(2)*X(7)-6*X(3)*X(8)-X(5)*X(7)-11*X(6)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 8 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
4 4 1 2 6
2 2 0
-94 -94 -31968
2 4 1 4 6
1 2 0
-83 -83 -31939
Interpreted in accordance with line 1912, line 1914, and line 1915, the output through JJJJ=-31939 was produced in the first 8 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L. Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1965).
An Application of An Integer Nonlinear Programming Computer Program
Jsun Yui Wong
The computer program listed below seeks to solve Problem 8 of Lawler and Bell [1, p. 1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-X(1)^2-X(2)^2-X(3)^2-X(4)^2-X(5)^2-X(6)^2-X(7)^2-X(8)^2-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-X(1)^2-X(2)^2-X(3)^2-X(4)^2-X(5)^2-X(6)^2-X(7)^2-X(8)^2
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 14 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
3 4 1 3 6
1 2 0
-76 -76 -31893
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31893 was produced in the first 14 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L. Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1966).
The computer program listed below seeks to solve Problem 8 of Lawler and Bell [1, p. 1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-X(1)^2-X(2)^2-X(3)^2-X(4)^2-X(5)^2-X(6)^2-X(7)^2-X(8)^2-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-X(1)^2-X(2)^2-X(3)^2-X(4)^2-X(5)^2-X(6)^2-X(7)^2-X(8)^2
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-999 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 14 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
3 4 1 3 6
1 2 0
-76 -76 -31893
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31893 was produced in the first 14 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L. Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1966).
An Application of an Integer Nonlinear Programming Computer Program
Jsun Yui Wong
The computer program listed below seeks to solve Problem 10 of Lawler and Bell [1, p. 1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-X(1)*X(2)*X(3)-X(1)*X(4)*X(5)-X(2)*X(4)*X(6)-X(2)*X(5)*X(7)-X(6)*X(7)*X(8)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-X(1)*X(2)*X(3)-X(1)*X(4)*X(5)-X(2)*X(4)*X(6)-X(2)*X(5)*X(7)-X(6)*X(7)*X(8)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-111 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 14 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
5 4 1 1 6
3 2 0
-110 -110 -31876
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31876 was produced in the first 14 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L. Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1966).
The computer program listed below seeks to solve Problem 10 of Lawler and Bell [1, p. 1108].
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
91 FOR K=1 TO 8
93 A(K)=FIX(RND*8)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 8
131 X(K)=A(K)
132 NEXT K
811 IF RND<1/8 THEN 901 ELSE IF RND<2/8 THEN 911 ELSE IF RND<3/8 THEN 921 ELSE IF RND<4/8 THEN 931 ELSE IF RND<5/8 THEN 941 ELSE IF RND<6/8 THEN 951 ELSE IF RND<7/8 THEN 961 ELSE 971
901 X(1)=FIX(RND*8)
905 GOTO 1151
911 X(2)=FIX(RND*16)
915 GOTO 1151
921 X(3)=FIX(RND*8)
925 GOTO 1151
931 X(4)=FIX(RND*8)
935 GOTO 1151
941 X(5)=FIX(RND*16)
945 GOTO 1151
951 X(6)=FIX(RND*8)
955 GOTO 1151
961 X(7)=FIX(RND*16)
965 GOTO 1151
971 X(8)=FIX(RND*8)
1151 P1=-12+2*X(1)+2*X(4)+8*X(8)
1159 IF P1<0 THEN P1=P1 ELSE P1=0
1255 P2=-41+11*X(1)+7*X(4)+13*X(6)
1259 IF P2<0 THEN P2=P2 ELSE P2=0
1355 P3=-60+6*X(2)+9*X(4)*X(6)+5*X(7)
1359 IF P3<0 THEN P3=P3 ELSE P3=0
1455 P4=-42+3*X(2)+5*X(5)+7*X(8)
1459 IF P4<0 THEN P4=P4 ELSE P4=0
1462 P5=-53+6*X(2)*X(7)+9*X(3)+5*X(5)
1469 IF P5<0 THEN P5=P5 ELSE P5=0
1472 P6=-13+4*X(3)*X(7)+X(5)
1479 IF P6<0 THEN P6=P6 ELSE P6=0
1480 P7=-69+2*X(1)+4*X(2)+7*X(4)+3*X(5)+X(7)
1481 IF P7>0 THEN P7=P7 ELSE P7=0
1482 P8=-47+9*X(1)*X(8)+6*X(3)*X(5)+4*X(3)*X(7)
1483 IF P8>0 THEN P8=P8 ELSE P8=0
1484 P9=-73+12*X(2)+8*X(2)*X(8)+2*X(3)*X(6)
1485 IF P9>0 THEN P9=P9 ELSE P9=0
1486 P10=-31+1*X(3)+4*X(5)+2*X(6)+9*X(8)
1487 IF P10>0 THEN P10=P10 ELSE P10=0
1488 P=-X(1)*X(2)*X(3)-X(1)*X(4)*X(5)-X(2)*X(4)*X(6)-X(2)*X(5)*X(7)-X(6)*X(7)*X(8)-333333!*(ABS(P1)+ABS(P2)+ABS(P3)+ABS(P4)+ABS(P5)+ABS(P6)+ABS(P7)+ABS(P8)+ABS(P9)+ABS(P10))
1499 PR=-X(1)*X(2)*X(3)-X(1)*X(4)*X(5)-X(2)*X(4)*X(6)-X(2)*X(5)*X(7)-X(6)*X(7)*X(8)
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 8
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-111 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8)
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 14 seconds of running is presented below. (What immediately follows is a manual copy from the computer screen.)
5 4 1 1 6
3 2 0
-110 -110 -31876
Interpreted in accordance with line 1912, line 1913, and line 1915, the output through JJJJ=-31876 was produced in the first 14 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.
Reference
[1] E. L. Lawler, M. D. Bell, "A Method for Solving Discrete Optimization Problems," Operations Research 14, 1098-1112 (1966).
Subscribe to:
Posts (Atom)