Monday, September 21, 2015

Solving with QB64 a Large Nonlinear Integer Programming Problem of 32765 General Integer Variables

Jsun Yui Wong

The problem here is Li and Sun's Problem 14.3 but with 32765 unknowns instead of their 100 unknowns; see Li and Sun [4, pp. 414-415]. Their problem is based on Walukiewicz/Schittkowski Test Problem 282 [7, Test Problem 282, page 106 and page 23]. Specifically, the test example here is to minimize

                                                                 32765-1
(X(1)-1)^2 + ( X(32765)-1)^2 + 32765* SIGMA (32765-i)* ( X(i)^2-X(i+1) )^2
                                                                  i=1

subject to

-5 <= X(i) <= 5, X(i) integer, i=1, 2, 3,..., 32765.

The following computer program uses qb64v1000-win [8, 9].

0 DEFINT J, K, B, X, A
2 DIM A(32765), X(32765)


81 FOR JJJJ = -32000 TO 32000
    85 LB = -FIX(RND * 6)
    86 UB = FIX(RND * 6)


    87 br = -5 + FIX(RND * 11)


    88 REM  RND ^ 2


    89 RANDOMIZE JJJJ
    90 M = -1.5D+38
    111 FOR J44 = 1 TO 32765



        114 A(J44) = br
    117 NEXT J44


    128 FOR I = 1 TO 10000


        129 FOR KKQQ = 1 TO 32765



            130 X(KKQQ) = A(KKQQ)
        131 NEXT KKQQ
        139 FOR IPP = 1 TO FIX(1 + RND * .3)
            140 B = 1 + FIX(RND * 32765)


            167 IF RND < .5 THEN X(B) = (A(B) - 1) ELSE X(B) = (A(B) + 1)
        169 NEXT IPP
        170 FOR J44 = 1 TO 32765



            171 IF X(J44) < LB THEN X(J44) = LB
            172 IF X(J44) > UB THEN X(J44) = UB
        173 NEXT J44

        220 GOTO 400



        221 SFE = 0
        225 FOR J44 = 1 TO 32765


            228 SFE = SFE + X(J44)

        233 NEXT J44
        251 TSL = -32740 + SFE

        257 IF TSL < 0 THEN TSL = TSL ELSE TSL = 0
        400 SUMNEWZ = 0
        403 FOR J44 = 1 TO 32764



            405 SUMNEWZ = SUMNEWZ + (32765 - J44) * (X(J44) ^ 2 - X(J44 + 1)) ^ 2



        407 NEXT J44
        411 SONE = -(X(1) - 1) ^ 2 - (X(32765) - 1) ^ 2 - 32765 * SUMNEWZ


        492 PD1 = SONE


        1111 IF PD1 <= M THEN 1670
        1452 M = PD1
        1454 FOR KLX = 1 TO 32765



            1455 A(KLX) = X(KLX)
        1456 NEXT KLX
        1559 GOTO 128
    1670 NEXT I
    1778 PRINT A(1), A(32765), M, br

    1788 PRINT A(11111), A(32757), A(32763), A(32764), JJJJ

    1789 REM PRINT A(2222), A(22222), A(22757), A(22763), A(22764)

1999 NEXT JJJJ

This computer program was run with qb64v1000-win [8, 9]. Copied by hand from the screen, the computer program's complete output through JJJJ=-31987 is shown below:

1      1   -8.137876E+09      1
1      1      1      1      -32000

1      1      0      2
1      1      1      1      -31999

0      0      -2      0
0      0      0      0      -31998

1      1      0      2
1      1      1      1      -31997

1      1       -2.205412E+08      1
1      1      1      1      -31996

0      0      -2      -2
0      0      0      0      -31995

0      0      -2      0
0      0      0      0      -31994

0      0      -6.702081E+08      0
0      0      0      0      -31993

0      -3      -4.414478E+12      -4
-1      0      0      -1      -31992

0      0      -2      -4
0      0      0      0      -31991

0      0      -1.351537E+10      -1
0      0      0      0      -31990

0      0      -2      -1
0      0      0      0      -331989

0      0      -1.814791E+10      -2
0      0      0      0      -31988

1      4      -7.050966E+13      5
2      2      3      3      -31987

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

At JJJJ=-31999 and JJJJ=-31997, M=0 is optimal. See Li and Sun [4, pp. 414-415].

Of the 32765 A's, only the six A's of line 1778 and line 1788 are shown above.

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

Acknowledgment

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

References

[1] George B. Dantzig, Discrete-Variable Extrenum Problems. Operations Research, Vol. 5, No. 2 (Apr., 1957), pp. 266-277.

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

[3] M. Junger, T. M. Liebling, D. Naddef, G. L. Nemhauser, W. R. Pulleyblank, G. Reinelt, G. Rinaldi, L. A. Woolsey--Editors, 50 Years of Integer Programming 1958-2008: From the Early Years to the State-of-the-Art. Springer, 2010 Edition. eBook; ISBN 978-3-540-68279-0

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

[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, Floridda 33432, 1981.

[6] J. Plummer, L. S. Lasdon, M. Ahmed, Solving a Large Nonlinear Progammming Problem on a Vector Processing Computer, Annals of Operatons Research, Volume 14 (1988), Issue 1, pp.. 291-304.

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

[8] E.K. Virtanen (2008-05-26). "Interview With Galleon".
http://www.basicprogramming.org/PCOPY!issue70/#galleoninterview

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

No comments:

Post a Comment