Wednesday, July 1, 2009

A Computer Program for Integer Nonlinear Programming

Jsun Yui Wong

The computer program listed below seeks to optimize in integers the following problem.

Objective function:
Maximize:
-X(1)^1*EXP(-X(1))-X(2)^2*EXP(-X(2))-X(3)^3*EXP(-X(3))-...-X(50)^50*EXP(-X(50)).

Constraints:
X(1)=0, 1, 2
X(2)=0, 1, 2
X(3)=0, 1, 2
.
.
.
X(50)=0, 1, 2.

This problem is an adaptation of the contribution of Leon [1], of Schwefel [2,
Problem 3.10 on page 329], and of Smith and Rudd [3].

The fifty constraints above are handled by line 1104 and line 1105 below.

0 DEFDBL A-Z
3 DEFINT I,J,K
4 DIM X(55),A(55),L(55),K(55),J(55)
5 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
91 FOR K=1 TO 50
93 A(K)=FIX(RND*3)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 50
131 X(K)=A(K)
132 NEXT K
1104 IJL=1+FIX(RND*50)
1105 X(IJL)=FIX(RND*3)
1221 P=0
1224 FOR JL=1 TO 50
1227 P=P-X(JL)^JL*EXP(-X(JL))
1229 NEXT JL
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 50
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1911 PRINT A(1),A(2),A(3),A(4),A(5)
1912 PRINT A(6),A(7),A(8),A(9),A(10)
1913 PRINT A(11),A(12),A(13),A(14),A(15)
1914 PRINT A(16),A(17),A(18),A(19),A(20)
1915 PRINT A(21),A(22),A(23),A(24),A(25)
1916 PRINT A(26),A(27),A(28),A(29),A(30)
1917 PRINT A(31),A(32),A(33),A(34),A(35)
1918 PRINT A(36),A(37),A(38),A(39),A(40)
1919 PRINT A(41),A(42),A(43),A(44),A(45)
1920 PRINT A(46),A(47),A(48),A(49),A(50)
1988 PRINT M,JJJJ
1999 NEXT JJJJ

This BASIC computer program was run with the IBM basica/D interpreter, and its candidate solutions produced during the first 25 seconds of running are presented below. (What immediately follows is a manual copy from the computer screen.)

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 -3200

And this optimal solution also occurred at JJJJ=-31999 through JJJJ=-31936 but not at JJJJ=-31990, JJJJ=-31975, JJJJ=-31968, JJJJ=-31953, and JJJJ=-31936. These exceptions are shown below.

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 1 0
-.3678794411714423 -31990

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
-.3678794411714423 -31975

0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 1 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
-1.103638323514327 -31968

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 0 0 0
0 0 0 0 0
-.3678794411714423 -31953

0 0 0 0 0
0 0 0 2 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 1
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
-70.02742389948858 -31936

Interpreted in accordance with line 1911 through line 1988, the output above shows the candidate solutions produced during the first 25 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.

References

[1] Leon, A. (1966), A comparison among eight known optimizing procedures, in: Lavi and Vogl (1966) p. 23-46

[2] Schwefel, H.P. (1981), Numerical optimization of computer models, John Wiley and Sons, New York

[3] Smith, N.H., D.F. Rudd (1964), The feasibility of directed random search, Univ. Wisconsin, Dept. Chem. Engng., report