Sunday, July 23, 2017
A Computer Program for Integer Fractional Programming, Revised Edition
Jsun Yui Wong
The computer program listed below seeks to solve the integer fractional programming example on pages 55-57 of Anzai [1].
Here X(1) through X(5) are integer variables, and X(6) through X(11) are slack variables.
Whereas line 128 and line 1454 of the preceding paper are 128 FOR I = 1 TO 1000 and 1454 FOR KLX = 1 TO 8, here line 128 and line 1454 are 128 FOR I = 1 TO 50 and 1454 FOR KLX = 1 TO 11, respectively.
0 DEFDBL A-Z
2 DEFINT I, J, 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 32000
14 RANDOMIZE JJJJ
16 M = -1D+37
64 FOR J44 = 1 TO 5
65 A(J44) = .1 + RND * 9.899999
66 NEXT J44
126 REM IMAR=10+FIX(RND*32000)
128 FOR I = 1 TO 50
129 FOR KKQQ = 1 TO 5
130 X(KKQQ) = A(KKQQ)
131 NEXT KKQQ
133 FOR IPP = 1 TO (1 + FIX(RND * 4))
181 J = 1 + FIX(RND * 5)
183 R = (1 - RND * 2) * A(J)
187 X(J) = A(J) + (RND ^ (RND * 10)) * R
188 GOTO 222
189 REM X(J)=A(J)+PA
190 REM X(J)=A(J)+FIX(RND*2 )-FIX(RND*2)
191 REM X(J)=A(J)+FIX(RND*3)-FIX(RND*3)
222 NEXT IPP
224 FOR J33 = 1 TO 5
226 X(J33) = INT(X(J33))
227 NEXT J33
229 X(5) = 1
231 REM FOR J44=1 TO 5
233 REM IF X(J44)<.1 THEN 1670
234 REM IF X(J44)>10 THEN 1670
235 REM NEXT J44
240 X(6) = X(1) - 2 * X(2) + 9
259 X(7) = -4 * X(1) - X(2) + 21
261 X(8) = -X(1) + 3 * X(2)
266 X(9) = 4 * X(1) + 5 * X(2) - 12
268 X(10) = 2 * X(3) - 6 * X(4) + 21
270 X(11) = -7 * X(3) - 4 * X(4) + 39
281 FOR J44 = 1 TO 5
283 IF X(J44) < 0 THEN 1670
284 IF X(J44) > 10 THEN 1670
285 NEXT J44
331 FOR J44 = 6 TO 11
332 IF X(J44) < 0 THEN PS(J44) = ABS(X(J44)) ELSE PS(J44) = 0
333 NEXT J44
403 POBA2 = -(-X(1) - 3 * X(2) - X(3) + X(4) - X(5)) / (2 * X(1) + X(2) + 3 * X(3) + 5 * X(4) + X(5))
411 POBA = POBA2 - 999999999# * (PS(6) + PS(7) + PS(8) + PS(9) + PS(10) + PS(11))
459 POB1 = POBA
463 P1NEWMAY = POB1
466 P = P1NEWMAY
1111 IF P <= M THEN 1670
1452 M = P
1453 PPOBA2 = POBA2
1454 FOR KLX = 1 TO 11
1455 A(KLX) = X(KLX)
1456 NEXT KLX
1557 GOTO 128
1670 NEXT I
1889 REM IF M<0 THEN 1999
1900 PRINT A(1), A(2), A(3), A(4)
1901 PRINT A(5), A(6), A(7), A(8)
1902 PRINT A(9), A(10), A(11)
1904 PRINT M, JJJJ, PPOBA2
1999 NEXT JJJJ
This BASIC computer program was run with qb64v1000-win [3]. The complete output through JJJJ=-31996 is shown below:
0 4 0 0
1 1 17 12
8 21 39
2.6 -32000 2.6
0 4 0 0
1 1 17 12
8 21 39
2.6 -31999 2.6
0 4 0 0
1 1 17 12
8 21 39
2.6 -31998 2.6
0 2 0 0
1 5 19 6
-2 21 39
-1999999995.666667 -31997 2.333333333333334
0 4 0 0
1 1 17 12
8 21 39
2.6 -31996 2.6
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 [3], the wall-clock time for obtaining the output through JJJJ=-31996 was 3 seconds, not including "Creating .EXEC file" time..
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] 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.
[3] Wikipedia, QB64, https://en.wikipedia.org/wiki/QB64
[4] 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/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment