Friday, August 14, 2009

An Illustration of an Integer Programming Computer Program

Jsun Yui Wong

The computer program listed below seeks to solve Problem LW5 of Amaral (2006). In order to have integer locations, the department lengths used in the following computer program have been made twice as long as the given department lengths.

0 DEFSNG A-Z
3 DEFINT I,J,K
4 DIM X(166),A(166),L(166),K(166),P(166),B(166),S(166)
5 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
111 FOR K=1 TO 5
113 A(K)=FIX(RND*699)
115 NEXT K
126 IMAR=10+FIX(RND*500)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 5
131 X(KK)=A(KK)
132 NEXT KK
222 IJL=1+FIX(RND*5):IJM=1+FIX(RND*5):IJN=1+FIX(RND*5)
234 IF RND<.7 THEN X(IJL)=FIX(RND*699) ELSE IF RND<.05 THEN X(IJL)=A(IJL)-1 ELSE GOTO 244
235 GOTO 501
244 X(IJM)=A(IJN):X(IJN)=A(IJM)
501 B(1)=ABS(X(1)-X(2))
502 B(2)=ABS(X(1)-X(3))
503 B(3)=ABS(X(1)-X(4))
504 B(4)=ABS(X(1)-X(5))
505 B(5)=ABS(X(2)-X(3))
506 B(6)=ABS(X(2)-X(4))
507 B(7)=ABS(X(2)-X(5))
508 B(8)=ABS(X(3)-X(4))
509 B(9)=ABS(X(3)-X(5))
510 B(10)=ABS(X(4)-X(5))
701 S(1)=B(1)-4
702 S(2)=B(2)-5
703 S(3)=B(3)-7
704 S(4)=B(4)-8
705 S(5)=B(5)-7
706 S(6)=B(6)-9
707 S(7)=B(7)-10
708 S(8)=B(8)-10
709 S(9)=B(9)-11
710 S(10)=B(10)-13
1107 FOR IJUL=1 TO 10
1112 IF S(IJUL)<0 THEN S(IJUL)=-333333! ELSE S(IJUL)=0
1115 NEXT IJUL
1117 SSUM=0
1121 FOR IAU=1 TO 10
1123 SSUM=SSUM+S(IAU)
1125 NEXT IAU
1380 PH=-2*B(1)-1*B(2)-0*B(3)-1*B(4)
1381 PI=-0*B(5)-2*B(6)-2*B(7)
1384 PJ=-6*B(8)-3*B(9)-4*B(10)
1589 P=PH+PI+PJ+SSUM
1599 PR=PH+PI+PJ
1651 IF P<=M THEN 1670
1657 FOR KEW=1 TO 5
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-305 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1917 PRINT M,MM,JJJJ
1999 NEXT JJJJ

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

489 485 520 510 497
-302 -302 -31881

470 474 439 449 462
-302 -302 -31368

482 486 451 461 474
-302 -302 -31193

306 310 275 285 298
-302 -302 -31119

632 636 601 611 624
-302 -302 -31106

375 379 344 354 367
-302 -302 -30804

Interpreted in accordance with line 1912 and line 1917, the output through JJJJ=-30804 was produced in the first 2 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.

References

Amaral, A. R. S. (2006), "On the exact solution of a facility layout problem," European Journal of Operational Research 173, 508-518.

Heragu, S. S., and Kusiak, A. (1991), "Efficient models for the facility layout problem," European Journal of Operational Research 53, 1-13.

Simmons, D. M. (1969), "One-dimensional space allocation: An ordering algorithm," Operations Research 17, 812-826.