Thursday, October 15, 2009

An Integer-Programming Computer Program Applied to a Space Allocation Problem, Second Edition

Jsun Yui Wong

The complete computer program listed below seeks to solve a five-department space allocation problem (Armour and Buffa, 1963). The departmment sizes for department 1 through department 5 are 25x20, 25x20, 35x30, 30x20, and 35x20, respectively; the interdepartmental flows are shown in line 1624, line 1625, and line 1626 of the following program. These sizes and flows are from Heragu (2008, page 220).

0 DEFSNG A-Z
3 DEFINT I,J,K
4 DIM X(466),A(466),L(466),K(466),P(466),B(466),S(466),J(466),HS(99)
6 DIM T(11,11,5),TZ(11,11),TL(11)
65 FOR JJJJ=-32000 TO 32000
74 RANDOMIZE JJJJ
76 M=-1D+17
85 FOR I=1 TO 10
88 A(I)=(RND*240)
89 NEXT I
126 IMAR=10+FIX(RND*20000)
128 FOR I=1 TO IMAR
129 FOR KK=1 TO 10
131 X(KK)=A(KK)
132 NEXT KK
223 IJL=1+FIX(RND*10)
234 X(IJL)=(RND*240)
401 HS(1)=ABS(X(1)-X(2))-25
402 HS(2)=ABS(X(1)-X(3))-30
403 HS(3)=ABS(X(1)-X(4))-27.5
404 HS(4)=ABS(X(1)-X(5))-30
405 HS(5)=ABS(X(2)-X(3))-30
406 HS(6)=ABS(X(2)-X(4))-27.5
407 HS(7)=ABS(X(2)-X(5))-30
409 HS(9)=ABS(X(3)-X(4))-32.5
410 HS(10)=ABS(X(3)-X(5))-35
411 HS(11)=ABS(X(4)-X(5))-32.5
413 HS(13)=ABS(X(6)-X(7))-20
414 HS(14)=ABS(X(6)-X(8))-25
415 HS(15)=ABS(X(6)-X(9))-20
416 HS(16)=ABS(X(6)-X(10))-20
417 HS(17)=ABS(X(7)-X(8))-25
418 HS(18)=ABS(X(7)-X(9))-20
419 HS(19)=ABS(X(7)-X(10))-20
420 HS(20)=ABS(X(8)-X(9))-25
421 HS(21)=ABS(X(8)-X(10))-25
422 HS(22)=ABS(X(9)-X(10))-20
551 IF HS(1)<-.0001 AND HS(13)<-.0001 THEN TL(1)=999999! ELSE TL(1)=0
553 IF HS(2)<-.0001 AND HS(14)<-.0001 THEN TL(2)=999999! ELSE TL(2)=0
554 IF HS(3)<-.0001 AND HS(15)<-.0001 THEN TL(3)=999999! ELSE TL(3)=0
555 IF HS(4)<-.0001 AND HS(16)<-.0001 THEN TL(4)=999999! ELSE TL(4)=0
557 IF HS(5)<-.0001 AND HS(17)<-.0001 THEN TL(5)=999999! ELSE TL(5)=0
559 IF HS(6)<-.0001 AND HS(18)<-.0001 THEN TL(6)=999999! ELSE TL(6)=0
560 IF HS(7)<-.0001 AND HS(19)<-.0001 THEN TL(7)=999999! ELSE TL(7)=0
565 IF HS(9)<-.0001 AND HS(20)<-.0001 THEN TL(8)=999999! ELSE TL(8)=0
568 IF HS(10)<-.0001 AND HS(21)<-.0001 THEN TL(9)=999999! ELSE TL(9)=0
569 IF HS(11)<-.0001 AND HS(22)<-.0001 THEN TL(10)=999999! ELSE TL(10)=0
1611 SUMTL=0
1613 FOR IR=1 TO 10
1615 SUMTL=SUMTL+TL(IR)
1618 NEXT IR
1624 PR1=-10*ABS(X(1)-X(2))-15*ABS(X(1)-X(3))-20*ABS(X(1)-X(4))-0*ABS(X(1)-X(5))-30*ABS(X(2)-X(3))-35*ABS(X(2)-X(4))-10*ABS(X(2)-X(5))
1625 PR2=-10*ABS(X(3)-X(4))-20*ABS(X(3)-X(5))-15*ABS(X(4)-X(5))-10*ABS(X(6)-X(7))-15*ABS(X(6)-X(8))-20*ABS(X(6)-X(9))-0*ABS(X(6)-X(10))
1626 PR3=-30*ABS(X(7)-X(8))-35*ABS(X(7)-X(9))-10*ABS(X(7)-X(10))-10*ABS(X(8)-X(9))-20*ABS(X(8)-X(10))-15*ABS(X(9)-X(10))
1650 P=PR1+PR2+PR3-999*SUMTL
1651 IF P<=M THEN 1670
1657 FOR KEW=1 TO 10
1658 A(KEW)=X(KEW)
1659 NEXT KEW
1661 M=P
1662 MM=PR1+PR2+PR3
1666 GOTO 128
1670 NEXT I
1890 IF M>-5700 THEN 1912 ELSE 1999
1912 PRINT A(1),A(2),A(3),A(4),A(5)
1914 PRINT A(6),A(7),A(8),A(9),A(10)
1915 PRINT MM,M,JJJJ
1999 NEXT JJJJ

This BASIC computer program was run with Microsoft's GW BASIC 3.11 interpreter, and the best candidate solution produced in seventeen hours of running is presented below. What immediately follows is a manual copy from the computer screen.

61.23445 91.06744 91.24085 63.56475 91.0558
25.93895 45.94308 20.93797 45.9476 65.97519
-5532.89 -5532.89 -24225

Interpreted in accordance with line 1912 through line 1915, this solution was produced in the first seventeen hours of running on a personal computer with an Intel 2.66 GHz. chip and the IBM basica/D interpreter, which is not a compiler.

References

G. C. Armour and E. S. Buffa, "A Heuristic Algorithm and Simulation Approach to Relative Location of Facilities," Management Science 9, 294-309 (1963).

S. S. Heragu. Facilities Design, Third Edition. Boca Raton, Florida: CRC Press, 2008.