Tuesday, August 18, 2009

A Computer Program for Solving Integer Programs

Jsun Yui Wong

The computer program listed below seeks to solve the 7-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 7
113 A(K)=FIX(RND*4)
115 NEXT K
117 FOR KKK=8 TO 14
118 A(KKK)=FIX(RND*3)
119 NEXT KKK
126 IMAR=10+FIX(RND*500)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 14
131 X(KK)=A(KK)
132 NEXT KK
139 IF RND<.5 GOTO 222 ELSE 330
222 IJL=1+FIX(RND*7)
234 X(IJL)=FIX(RND*4)
242 IJM=8+FIX(RND*7)
244 X(IJM)=FIX(RND*3)
246 GOTO 401
330 IJM=1+FIX(RND*7)
331 IJN=1+FIX(RND*7)
333 X(IJM)=A(IJN):X(IJN)=A(IJM)
335 X(IJM+7)=A(IJN+7):X(IJN+7)=A(IJM+7)
401 FOR IAUU=8 TO 14
402 IF X(IAUU)=2 THEN X(IAUU-7)=0
404 NEXT IAUU
501 B(1)=ABS(X(1)-X(2))+ABS(X(8)-X(9))
502 B(2)=ABS(X(1)-X(3))+ABS(X(8)-X(10))
503 B(3)=ABS(X(1)-X(4))+ABS(X(8)-X(11))
504 B(4)=ABS(X(1)-X(5))+ABS(X(8)-X(12))
505 B(5)=ABS(X(1)-X(6))+ABS(X(8)-X(13))
506 B(6)=ABS(X(1)-X(7))+ABS(X(8)-X(14))
512 B(7)=ABS(X(2)-X(3))+ABS(X(9)-X(10))
513 B(8)=ABS(X(2)-X(4))+ABS(X(9)-X(11))
514 B(9)=ABS(X(2)-X(5))+ABS(X(9)-X(12))
515 B(10)=ABS(X(2)-X(6))+ABS(X(9)-X(13))
516 B(11)=ABS(X(2)-X(7))+ABS(X(9)-X(14))
522 B(12)=ABS(X(3)-X(4))+ABS(X(10)-X(11))
523 B(13)=ABS(X(3)-X(5))+ABS(X(10)-X(12))
524 B(14)=ABS(X(3)-X(6))+ABS(X(10)-X(13))
525 B(15)=ABS(X(3)-X(7))+ABS(X(10)-X(14))
531 B(16)=ABS(X(4)-X(5))+ABS(X(11)-X(12))
532 B(17)=ABS(X(4)-X(6))+ABS(X(11)-X(13))
533 B(18)=ABS(X(4)-X(7))+ABS(X(11)-X(14))
539 B(19)=ABS(X(5)-X(6))+ABS(X(12)-X(13))
540 B(20)=ABS(X(5)-X(7))+ABS(X(12)-X(14))
546 B(21)=ABS(X(6)-X(7))+ABS(X(13)-X(14))
1107 FOR IJUL=1 TO 21
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)-.001*B(5)-.001*B(6)-3*B(7)-.001*B(8)-2*B(9)
1381 PI=-2*B(10)-2*B(11)-1*B(12)-.001*B(13)-2*B(14)-5*B(15)-5*B(16)-2*B(17)-2*B(18)
1382 PJ=-10*B(19)-.001*B(20)-5*B(21)
1588 P=PH+PI+PJ
1599 REM PR=PK
1651 IF P<=M THEN 1670
1657 FOR KEW=1 TO 14
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1663 MM=PR
1666 GOTO 128
1670 NEXT I
1890 IF M>-75 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)
1914 PRINT A(11),A(12),A(13),A(14)
1917 PRINT M,JJJJ
1999 NEXT JJJJ

One notes that the artificial .001 flows of lines like line 1380 replace the original 0 flows.

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

0 1 2 0 0
1 2 0 0 0
2 1 1 1
-74.013 -31998

3 2 2 1 0
0 1 1 1 0
1 1 0 0
-74.013 -31992

1 2 3 0 1
2 3 1 1 1
0 0 0 0
-74.013 -31977

2 1 0 2 1
0 0 1 1 2
0 0 0 1
-74.012 -31958

The first candidate solution above is usable, but the second one is not usable. Interpreted in accordance with line 1912 through line 1917, the output through JJJJ=-31958 was produced during the first 4 seconds of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter.

References

Hillier, F. S. (1963), "Quantitative tools for plant layout analysis," J. Indust. Eng. 14, 33-40.

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.

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