Wednesday, August 9, 2017

Adapting the Mixed-Integer Nonlinear Programming (MINLP) Solver Presented Here for Solving Nonlinear Systems of Equations, Corrected Edition


Jsun Yui Wong

The computer program listed below seeks to solve the following Sjirk Boon [2] nonlinear system of equations used in Tsai and Lin [9]:

         X(1) ^2+ X(3) ^ 2-1=0

        X(2) ^2+ X(4) ^ 2 -1=0

        X(5)*X(3) ^ 3 +    X(6) * X(4) ^ 3    -1.2 =0

        X(5) * X(1) ^ 3 + X(6) * X(2) ^ 3 - 1.2=0

        X(5) * X(3) ^ 2 * X(1) + X(6) * X(4) ^ 2 * X(2) - .7=0

        X(5) * X(3) * X(1) ^ 2 + X(6) * X(4) * X(2) ^ 2 - .7=0

-10<= X(i)<=10,  i=1 to 6.

One notes the following new lines 1401 and 1403, which are 1401 IF ABS(X(1) ^ 2 + X(3) ^ 2 - 1) > .001 THEN GOTO 1670
and 1403 IF ABS(X(2) ^ 2 + X(4) ^ 2 - 1) > .001 THEN GOTO 1670.


0 REM DEFDBL A-Z

2 DEFINT I, K

3 DIM B(99), N(99), A(99), H(99), L(99), U(99), X(1111), D(111), P(111), PS(33)
12 FOR JJJJ = -32000 TO 32111 STEP .01

    14 RANDOMIZE JJJJ
    16 M = -1D+37

    64 FOR J44 = 1 TO 6

        65 A(J44) = -1 + RND * 2

    66 NEXT J44
    126 REM IMAR=10+FIX(RND*32000)
    128 FOR I = 1 TO 30000

        129 FOR KKQQ = 1 TO 6
            130 X(KKQQ) = A(KKQQ)
        131 NEXT KKQQ
        133 FOR IPP = 1 TO (1 + FIX(RND * 4))

            181 J = 1 + FIX(RND * 6)

            183 R = (1 - RND * 2) * A(J)
            187 X(J) = A(J) + (RND ^ (RND * 10)) * R
        222 NEXT IPP
        366 IF X(3) ^ 2 > 1 THEN GOTO 373


        367 IF RND < .5 THEN X(1) = -(1 - X(3) ^ 2) ^ .5 ELSE X(1) = (1 - X(3) ^ 2) ^ .5


        373 IF X(4) ^ 2 > 1 THEN GOTO 376


        374 IF RND < .5 THEN X(2) = -(1 - X(4) ^ 2) ^ .5 ELSE X(2) = (1 - X(4) ^ 2) ^ .5

        376 X(5) = (1.2 - X(6) * X(4) ^ 3) / X(3) ^ 3


        379 REM PS(3) = -1.2 + X(5) * X(3) ^ 3 + X(6) * X(4) ^ 3


        381 PS(4) = X(5) * X(1) ^ 3 + X(6) * X(2) ^ 3 - 1.2

        387 PS(5) = X(5) * X(3) ^ 2 * X(1) + X(6) * X(4) ^ 2 * X(2) - .7


        388 PS(6) = X(5) * X(3) * X(1) ^ 2 + X(6) * X(4) * X(2) ^ 2 - .7


        393 FOR J59 = 1 TO 6

            394 IF X(J59) < -10 THEN GOTO 1670

            395 IF X(J59) > 10 THEN GOTO 1670
        398 NEXT J59


        417 POBA = -ABS(PS(4)) - ABS(PS(5)) - ABS(PS(6))


        459 POB1 = POBA
        463 P1NEWMAY = POB1
        466 P = P1NEWMAY
        1111 IF P <= M THEN 1670

        1401 IF ABS(X(1) ^ 2 + X(3) ^ 2 - 1) > .001 THEN GOTO 1670

        1403 IF ABS(X(2) ^ 2 + X(4) ^ 2 - 1) > .001 THEN GOTO 1670


        1452 M = P
        1453 PPOBA2 = POBA2
        1454 FOR KLX = 1 TO 6


            1455 A(KLX) = X(KLX)
        1456 NEXT KLX
        1557 REM   GOTO 128

    1670 NEXT I
    1889 IF M < -.0003 THEN 1999

    1900 PRINT A(1), A(2), A(3), A(4)

    1904 PRINT A(5), A(6), M, JJJJ

1999 NEXT JJJJ


This BASIC computer program was run with qb64v1000-win [10].  The complete output  through
JJJJ=- 31231.21 is shown below:

.4022811           -.9153819        .9155162           -.4025865
1.441177         -1.442175        -1.219519E-04         -31983.88

.4022723           -.9153851        .9155201           -.4025794
1.441166         -1.442169        -1.226053E-04         -31857.91

-.4025856           -.9155015        -.9153823           -.4023145
-1.442136         -1.44125        -1.083827E-04         -31829.4

.4023386           .9153696        .9154909           .4026144
1.441271         1.442172        -1.100843E-04         -31786.19

.4020621           -.9152825        .9156124           -.4028125
1.440454         -1.442906        -2.995486E-04         -31585.41

.4022415           .9153735        .9155336           .4026057
1.44107         1.44226        -1.458442E-04         -31523.03

-.4020789           .915285        -.915605           .4028068
-1.440496         1.442875        -2.905802E-04         -31231.21    

Above there is no rounding by hand; it is just straight copying by hand from the monitor screen.

On a personal computer with a Pentium Dual-Core CPU E5200 @2.50GHz, 2.50 GHz, 960 MB of RAM and qb64v1000-win [10], the wall-clock time for obtaining the output through JJJJ=  -31231.21 was 110 minutes.

Acknowledgment

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

References

[1]  Yuichiro Anzai (1974).  On Integer Fractional Programming.  Journal Operations Research Society of Japan, Volume 17, No. 1, March 1974, pp. 49-66.
www..orsj.or.jp/~archiv/pdf/e_mag/Vol.17_01_049.pdf.

[2]  Sjirk Boon. Solving systems of nonlinear equations. Sci. Math. Num-Analysis,1992, Newsgroup Article 3529.     .

[3]  Han-Lin Li, Jung-Fa Tsai (2008).  A distributed computational algorithm for solving portfolio problems with integer variables.  European Journal of Operational Research 186 (2008) pp.882-891.

[4]   Harry Markowitz  (1952).   Portfolio Selection.   The Journal of Finance  7 (2008) pp. 77-91.

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

[6]  H. S. Ryoo, N. V. Sahinidis (1995).  Global optimization of nonconvex NLP and MINLP with applications in process design. Computers and Chemical Engineering Vol. 19 (5) (1995) pp. 551-566.

[7]  Jung-Fa Tsai, Ming-Hua Lin, Yi-Chung Hu (2007).  On generalized geometric programming problems with non-positive variables.  European Journal of Operational Research 178 (2007) pp. 10-19.

[8]  Jung-Fa Tsai, Ming-Hua Lin (2008).  Global optimization of signomial mixed-integer nonlinear programming with free variables.  Journal of Global Optimization  (2008) 42  pp. 39-49.

[9]  Jung-Fa Tsai, Ming-Hua Lin (2007).  Finding all solutions of systems of nonlinear equations with free variables.  Engineering Optimization  (2007) 39:6, pp. 649-659

[10] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64    

[11] Jsun Yui Wong (2012, April 12).  The Domino Method of General Integer Nonlinear Programming Applied to a Nonlinear Fractional Programming Problem from the Literature. http://myblogsubstance.typepad.com/substance/2012/04/12/

No comments:

Post a Comment