Saturday, June 21, 2014

Unified Computer Programs for Nonlinear Integer/Continuous/Discrete Programming Problems Including One Here with Mixed Integer Variables and Continuous Variables

Jsun Yui Wong

Case One: Nonlinear Programming Problem with Six Continuous Variables and Six Equality Constraints

Similar to the computer programs of the preceding papers, the computer program below seeks to solve Hock and Schittkowski's Problem 55 [6, p. 78].  The problem is to minimize the following:

X(1)  + 2*X(2)  +  4*X(5)    +   EXP(X(1)*X(4)   )

subjec to

X(1)+ 2*X(2) +5*  X(5)  -6   =0
X(1)+ X(2) +  X(3)      -3   =0
X(4)+ X(5) +  X(6)      -2   =0
X(1)+X(4)-1   =0
X(2)+X(5)-2   =0
X(3)+X(6)-2   =0
0<=X(i), i=1,2,3,4,5,6, X(1)<=1, X(4)<=1.

One notes that X(7), X(8), and X(9) of line 391, line 393 , and line 395, respectively, are artificial variables.

One also notes line 422, 424, and line 426, which are 422 IF ABS(X(7))<.000001 THEN X(7)=0,
424 IF ABS(X(8))<.000001 THEN X(8)=0, and 426 IF ABS(X(9))<.000001 THEN X(9)=0, respectively.

The arrangement of line 385 through line 395 is to induce domino effect.

0 REM  DEFDBL A-Z
1 DEFINT J,K,B
2 DIM A(1001),X(1001)
88 FOR JJJJ=-32000 TO 32000
89 RANDOMIZE JJJJ
90 M=-3D+30
110   FOR J44=1 TO 6
112 A(J44)=  RND*(10)
114   NEXT J44
115 A(1)=RND
116 A(4)=RND
128 FOR I=1 TO 32000
129 FOR KKQQ=1 TO 6
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
139 FOR IPP=1 TO FIX(1+RND*3)
140 B=1+FIX(RND*6)
144 REM            GOTO 167
145 IF RND<.5 THEN 150 ELSE         163
150 R=(1-RND*2)*A(B)
160 X(B)=(A(B)     +RND^3*R)
162 GOTO 168
163 IF RND<.5 THEN X(B)=(A(B)-.001)   ELSE X(B)=(A(B)     +.001   )
165 GOTO 168
167 IF RND<.5 THEN X(B)=CINT(A(B)-1)   ELSE X(B)=CINT(A(B)     +1   )
168 REM   IF A(B)=0 THEN X(B)=1 ELSE X(B)=0
169 NEXT IPP
370 FOR J44=1 TO 6
371 IF X(J44)<0 THEN X(J44)=A(J44)
375 NEXT J44
376 IF X(1)>1 THEN X(1)=A(1)
377 IF X(4)>1 THEN X(4)=A(4)
385 X(6)=-X(3)+2
387 X(5)=-X(2)+2
389 X(4)=-X(1)+1
391 X(7  ) =6- X(1)- 2*X(2) -5*  X(5)
393 X(8  )=3- X(1)- X(2) -  X(3)
395 X(9  )=2- X(4)- X(5) -  X(6)
422 IF ABS(X(7))<.000001 THEN X(7)=0
424 IF ABS(X(8))<.000001 THEN X(8)=0
426 IF ABS(X(9))<.000001 THEN X(9)=0
557 PD1= -  X(1)   -2*X(2)  -  4*X(5)    -         EXP(X(1)*X(4)   )  -10000*(ABS( X(7)    )+ABS( X(8) )+ABS( X(9)   )   )
1111 IF PD1<=M THEN 1670
1452 M=PD1
1454 FOR KLX=1 TO 9
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1557 GOTO 128
1670 NEXT I
1889 IF M<-6.5 THEN 1999
1922 PRINT A(1),A(2),A(3),A(4)
1923 PRINT A(5),A(6),A(7),A(8)
1929 PRINT A(9),M,JJJJ
1999 NEXT JJJJ

This BASIC computer program was run via basica/D of Microsoft's GW-BASIC 3.11 interpreter for DOS.  See the BASIC manual [11].  Copied by hand from the screen, the output through
JJJJ=-31991 is as follows:

4.342672E-03      1.334781      1.660876      .9956573
.665219      .3391246      0      0
0      -6.339114      -32000

2.411294E-02      1.341371      1.634515      .9758871
.658629      .3654848      0      0
0      -6.365181      -31994

.1135881      1.371196      1.515215      .8864119
.6288036      .4847851      0      0
0      -6.477124      -31991

On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM, and the IBM basica/D interpreter, version GW BASIC 3.11,  the wall-clock time for obtaining the output through JJJJ=-31991 was 25 seconds.

Case Two: Nonlinear Programming Problem with Two Integer Variables, Four Continuous Variables, and Six Equality Constraints

The problem here is the problem above plus the two restrictions that X(1) and X(4) are integer variables; these two restrictions are enforced by line 378 and line 379, which are
378 X(1)=CINT( X(1)) and 379 X(4)=CINT( X(4)).

0 REM  DEFDBL A-Z
1 DEFINT J,K,B
2 DIM A(1001),X(1001)
88 FOR JJJJ=-32000 TO 32000
89 RANDOMIZE JJJJ
90 M=-3D+30
110   FOR J44=1 TO 6
112 A(J44)=  RND*(10)
114   NEXT J44
115 A(1)=RND
116 A(4)=RND
128 FOR I=1 TO 32000
129 FOR KKQQ=1 TO 6
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
139 FOR IPP=1 TO FIX(1+RND*3)
140 B=1+FIX(RND*6)
144 REM            GOTO 167
145 IF RND<.5 THEN 150 ELSE         163
150 R=(1-RND*2)*A(B)
160 X(B)=(A(B)     +RND^3*R)
162 GOTO 168
163 IF RND<.5 THEN X(B)=(A(B)-.001)   ELSE X(B)=(A(B)     +.001   )
165 GOTO 168
167 IF RND<.5 THEN X(B)=CINT(A(B)-1)   ELSE X(B)=CINT(A(B)     +1   )
168 REM   IF A(B)=0 THEN X(B)=1 ELSE X(B)=0
169 NEXT IPP
370 FOR J44=1 TO 6
371 IF X(J44)<0 THEN X(J44)=A(J44)
375 NEXT J44
376 IF X(1)>1 THEN X(1)=A(1)
377 IF X(4)>1 THEN X(4)=A(4)
378 X(1)=CINT( X(1))
379 X(4)=CINT( X(4))
385 X(6)=-X(3)+2
387 X(5)=-X(2)+2
389 X(4)=-X(1)+1
391 X(7  ) =6- X(1)- 2*X(2) -5*  X(5)
393 X(8  )=3- X(1)- X(2) -  X(3)
395 X(9  )=2- X(4)- X(5) -  X(6)
422 IF ABS(X(7))<.000001 THEN X(7)=0
424 IF ABS(X(8))<.000001 THEN X(8)=0
426 IF ABS(X(9))<.000001 THEN X(9)=0
557 PD1= -  X(1)   -2*X(2)  -  4*X(5)    -         EXP(X(1)*X(4)   )  -10000*(ABS( X(7)    )+ABS( X(8) )+ABS( X(9)   )   )
1111 IF PD1<=M THEN 1670
1452 M=PD1
1454 FOR KLX=1 TO 9
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1557 GOTO 128
1670 NEXT I
1889 IF M<-6.5 THEN 1999
1922 PRINT A(1),A(2),A(3),A(4)
1923 PRINT A(5),A(6),A(7),A(8)
1929 PRINT A(9),M,JJJJ
1999 NEXT JJJJ

This BASIC computer program was run via basica/D of Microsoft's GW-BASIC 3.11 interpreter for DOS.  See the BASIC manual [11].  Copied by hand from the screen, the output through
JJJJ=-31998 is as follows:

0      1.333333      1.666667      1
.6666666      .3333329      0      0
0      -6.333333      -32000

0      1.333333      1.666668      1
.6666668      .3333323      0      0
0      -6.333334      -31999

0      1.333333      1.666666      1
.6666666      .3333342      0      0
0      -6.333333      -31998

On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM, and the IBM basica/D interpreter, version GW BASIC 3.11,  the wall-clock time for obtaining the output through JJJJ=-31998 was 8 seconds.

Acknowledgment

I would like to acknowledge the encouragement of Roberta Clark and Tom Clark.

References

[1] E. Balas, An Additive Algorithm for Solving Linear Programs with Zero-One Variables.    Operations Research, Vol. 13, No. 4 (1965), pp. 517-548.

[2] E. Balas, Discrete Programming by the Filter Method.  Operations Research, Vol. 15, No. 5 (Sep. - Oct., 1967), pp. 915-957.

[3] F. Cajori (1911) Historical Note on the Newton-Raphson Method of Approximation.  The American Mathematical Monthly, Volume 18 #2, pp. 29-32.

[4] M. A. Duran, I. E. Grossmann, An Outer-Approximation Algorithm for a Class of Mixed-Integer Nonlinear Programs.  Mathematical Programming, 36:307-339, 1986.

[5] D. M. Himmelblau, Applied Nonlinear Programming.  New York: McGraw-Hill Book Company, 1972.

[6] W. Hock, K. Schittkowski, Test Examples for Nonlinear Programming Codes.  Springer-Verlag, 1981.

[7] Jack Lashover (November 12, 2012).  Monte Carlo Marching.  www.academia.edu/5481312/MONTE_ CARLO_MARCHING

[8] E. L. Lawler, M. D. Bell, A Method for Solving Discrete Optimization Problems.  Operations Research, Vol. 14, No. 6 (Nov. - Dec., 1966), pp. 1098-1112.

[9] E. L. Lawler, M. D. Bell, Errata: A Method for Solving Discrete Optimization Problems.  Operations Research, Vol. 15, No. 3 (May - June, 1967), p. 578.

[10] Duan Li, Xiaoling Sun, Nonlinear Integer Programming.  Publisher: Springer Science+Business Media,LLC (2006).  http://www.books.google.ca/books?isbn=0387329951

[11] Microsoft Corp., BASIC, Second Edition (May 1982), Version 1.10. Boca Raton, Florida: IBM Corp., Personal Computer, P. O. Box 1328-C,Boca Raton, Floridda 33432, 1981.

[12] Harvey M. Salkin, Integer Programming.  Menlo Park, California: Addison-Wesley Publishing Company (1975).

[13] Harvey M. Salkin, Kamlesh Mathur, Foundations of Integer Programming.  Publisher: Elsevier Science Ltd (1989).

[14] K. Schittkowski, More Test Examples for Nonlinear Programming Codes.  Springer-Verlag, 1987.

[15] S. Surjanovic, Zakharov Function.  www.sfu.ca/~ssurjano/zakharov.html

[16] Jsun Yui Wong (2012, April 23).  The Domino Method of General Integer Nonlinear Programming Applied to Problem 2 of Lawler and Bell.   http://computationalresultsfromcomputerprograms.wordpress.com/2012/04/23/

[17] Jsun Yui Wong (2013, September 4).  A Nonlinear Integer/Discrete/Continuous Programming Solver Applied to a Literature Problem with Twenty Binary Variables and Three Constraints, Third Edition.  http://myblogsubstance.typepad.com/substance/2013/09/