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).