Thursday, July 2, 2009

A Computer Program for 0-1 Nonlinear Programming

Jsun Yui Wong

The computer program listed below seeks to optimize 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(1000)^1000*EXP(-X(1000)).

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

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 1000 0-1 variables, X(1), X(2), X(3),..., X(1000), are handled by line 1104 and line 1105 below.

0 DEFDBL A-Z
3 DEFINT I,J,K
4 DIM X(1555),A(1555),L(1555),K(1555),J(1555)
5 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1.701411834604692D+38
91 FOR K=1 TO 1000
93 A(K)=FIX(RND*2)
99 NEXT K
126 IMAR=10+FIX(RND*2000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 1000
131 X(K)=A(K)
132 NEXT K
1104 IJL=1+FIX(RND*1000)
1105 X(IJL)=FIX(RND*2)
1221 P=0
1224 FOR JL=1 TO 1000
1227 P=P-X(JL)^JL*EXP(-X(JL))
1229 NEXT JL
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 1000
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1988 PRINT A(999),A(1000),JJJJ,M
1999 NEXT JJJJ

This BASIC computer program was run with the IBM basica/D interpreter, and the output produced during the first 5.5 minutes of running is presented below. (What immediately follows is a manual copy from the computer screen.)

0 0 -32000 0
0 0 -31999 -1.103638323514327
0 0 -31998 -2.943035529371539
0 0 -31997 0
0 0 -31996 0

Interpreted in accordance with line 1988, the output above was produced during the first 5.5 minutes 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