Friday, June 26, 2009

A Computer Program for Nonlinear Programming Problems Involving Integer Variables and Continuous Variables

Jsun Yui Wong

The computer program listed below seeks to solve the following problem.

Objective function:
Maximize:
(24.55*X(1)+26.75*X(2)+39!*X(3)+40.5*X(4))

Constraints:
2.3*X(1)+5.6*X(2)+11.1*X(3)+1.3*X(4)-5>=0
12!*X(1)+11.9*X(2)+41.8*X(3)+52.1*X(4)-1.645*Q^.5-12>=0
X(1)+X(2)+X(3)+X(4)-1=0
Q=(.53*X(1))^2+(.44*X(2))^2+(4.5*X(3))^2+(.79*X(4))^2
X(1)=0, 1, 2, 3,..., 999, 1000
X(2)=0, 1, 2, 3,..., 999, 1000
X(3)>=0
X(4)>=0

This problem is an adaptation of Problem 353 on page 173 of Schittkowski [1]. The new problem has integer variables X(1) and X(2) as shown above.

0 DEFDBL A-Z
3 DEFINT I,J,K
4 DIM X(42),A(42),L(33),K(33)
5 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
91 FOR K=1 TO 4
93 A(K)=FIX(RND*1001)
99 NEXT K
126 IMAR=10+FIX(RND*1000)
128 FOR I=1 TO IMAR
129 FOR K=1 TO 4
131 X(K)=A(K)
132 NEXT K
1100 IF RND<.6666 THEN GOTO 1110 ELSE GOTO 1125
1110 IJUU=1+FIX(RND*2)
1111 X(IJUU)=FIX(RND*1001)
1112 GOTO 1135
1125 X(3)=A(3)+(-1+FIX(RND*3))*(.0025*A(3))
1135 X(4)=1-X(1)-X(2)-X(3)
1151 PEN1=2.3*X(1)+5.6*X(2)+11.1*X(3)+1.3*X(4)-5
1159 IF PEN1<0 THEN PEN1=PEN1 ELSE PEN1=0
1163 Q=(.53*X(1))^2+(.44*X(2))^2+(4.5*X(3))^2+(.79*X(4))^2
1171 PEN2=12!*X(1)+11.9*X(2)+41.8*X(3)+52.1*X(4)-1.645*Q^.5-12
1179 IF PEN2<0 THEN PEN2=PEN2 ELSE PEN2=0
1488 P=(24.55*X(1)+26.75*X(2)+39!*X(3)+40.5*X(4))-333333!*ABS(PEN1)-333333!*ABS(PEN2)
1499 PR=(24.55*X(1)+26.75*X(2)+39!*X(3)+40.5*X(4))
1551 IF P<=M THEN 1670
1657 FOR KEW=1 TO 4
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>38 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),M,MM,JJJJ
1999 NEXT JJJJ

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

0 0 .3775832017530801 .6224167982469199
39.93362519737038 39.93362519737038 -31998

0 0 .3775833227110804 .6224166772889196
39.93362501593338 39.93362501593338 -31997

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

Reference

[1] K. Schittkowski, "More Test Examples for Nonlinear Programming Codes," Springer-Verlag, Berlin Heidelberg New York, 1987.