Friday, August 14, 2009

An Integer Programming Computer Program Applied to a Small Quadratic Assignment Problem

Jsun Yui Wong

The computer program listed below seeks to solve the five-department problem in Nugent, Vollmann, and Ruml (1968).

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*3)
115 NEXT K
117 FOR KKK=6 TO 10
118 A(KKK)=FIX(RND*2)
119 NEXT KKK
126 IMAR=10+FIX(RND*500)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 10
131 X(KK)=A(KK)
132 NEXT KK
222 IJL=1+FIX(RND*5)
234 X(IJL)=FIX(RND*3)
242 IJM=6+FIX(RND*10)
244 X(IJM)=FIX(RND*2)
501 B(1)=ABS(X(1)-X(2))+ABS(X(6)-X(7))
502 B(2)=ABS(X(1)-X(3))+ABS(X(6)-X(8))
503 B(3)=ABS(X(1)-X(4))+ABS(X(6)-X(9))
504 B(4)=ABS(X(1)-X(5))+ABS(X(6)-X(10))
505 B(5)=ABS(X(2)-X(3))+ABS(X(7)-X(8))
506 B(6)=ABS(X(2)-X(4))+ABS(X(7)-X(9))
507 B(7)=ABS(X(2)-X(5))+ABS(X(7)-X(10))
508 B(8)=ABS(X(3)-X(4))+ABS(X(8)-X(9))
509 B(9)=ABS(X(3)-X(5))+ABS(X(8)-X(10))
510 B(10)=ABS(X(4)-X(5))+ABS(X(9)-X(10))
1107 FOR IJUL=1 TO 10
1111 IF B(IJUL)=0 THEN B(IJUL)=333333!
1115 NEXT IJUL
1380 PH=-5*B(1)-2*B(2)-4*B(3)-1*B(4)
1381 PI=-3*B(5)-.001*B(6)-2*B(7)
1384 PJ=-.001*B(8)-.001*B(9)-5*B(10)
1588 P=PH+PI+PJ
1599 PR=PK
1651 IF P<=M THEN 1670
1657 FOR KEW=1 TO 10
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-27 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1913 PRINT A(6),A(7),A(8),A(9),A(10)
1917 PRINT M,JJJJ
1999 NEXT JJJJ

One notes that the artificial .001 flows of line 1381 and line 1384 replace the original 0 flows.

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

1 1 2 0 0
1 0 0 1 0
-25.007 -32000

1 0 2 1 0
1 1 1 0 0
-26.007 -31998

0 1 2 0 1
0 0 0 1 1
-25.007 -31996

1 2 0 1 2
0 0 0 1 1
-26.007 -31994

1 1 2 0 0
1 0 0 1 0
-25.007 -31992

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

References

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

Nugent, C. E., Vollmann, T. E., and Ruml, J. (1968), "An experimental comparisons of techniques for the assignment of facilities to locations," Operations Research 16, 150-173.