Jsun Yui Wong
This paper is concerned with the Carlson and Nemhauser problem of scheduling to minimize interaction cost [1]. The computer program listed below uses in line 561 through line 626 the mathematical formulation appearing on page 6 of Heragu and Kusiak [2] and on page 140 of Heragu [3]; it attempts to minimize the total interaction cost of assigning twelve courses to four time periods, which are period 0, period 1, period 2, and period 3. The total interaction cost is the sum of the individual interaction costs. An individual interaction cost occurs when, for example, a student wants to take two courses scheduled during the same time period. For these individual interaction costs, the BASIC computer program below uses the interdepartmental flows presented in Hillier [4] and in Nugent, Vollmann, and Ruml [5]; these flows are used in line 1321 through line 1334 below.
The following computer program benefits from the computer programs of the present blog and the computer program on pages 229-232 of Conley [6].
2 DEFINT I,J,K
5 DIM B(99),N(99),A(99),H(99),L(99),U(99),X(1111),D(111),P(222)
12 FOR JJJJ=-32000 TO 32000
14 RANDOMIZE JJJJ
16 M=-1D+17
43 FOR IOC=1 TO 12
45 B(IOC)=0
47 NEXT IOC
51 FOR IOCTT=1 TO 12
53 N(IOCTT)=3
57 NEXT IOCTT
61 FOR KLQ=1 TO 12
62 A(KLQ)=B(KLQ)+RND*(N(KLQ)-B(KLQ))
63 NEXT KLQ
71 FOR KLR=1 TO 12
72 H(KLR)=3
73 NEXT KLR
88 FOR JJJ=1 TO 1000 STEP 10
90 FOR INEW=1 TO 1
94 FOR J=INEW*2 TO 0 STEP -1
102 FOR JJ=0 TO 12
128 FOR I=1 TO 1
129 FOR KKQQ=1 TO 12
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
132 FOR K=1 TO 12
133 IF RND<=.5 THEN 298 ELSE 230
230 IF A(K)-(N(K)-B(K))/H(K)^J250 L(K)=B(K)
255 GOTO 265
260 L(K)=A(K)-(N(K)-B(K))/H(K)^J
265 IF A(K)+(N(K)-B(K))/H(K)^J>N(K) THEN 266 ELSE 268
266 U(K)=N(K)-L(K)
267 GOTO 272
268 U(K)=A(K)+(N(K)-B(K))/H(K)^J-L(K)
272 GOTO 300
298 X(K)=A(K)+2*RND*(2*RND-1)*(1/(1+RND*JJJ))*.05*A(K)
299 GOTO 302
300 X(K)=(L(K)+2*RND*RND*U(K))
302 NEXT K
304 X(JJ)=A(JJ)
306 KLPS=FIX(1+RND*36)
307 FOR KLA1=1 TO KLPS
308 KLA2=FIX(1+12*RND)
309 X(KLA2)=A(KLA2)
310 NEXT KLA1
343 IF RND>.1 GOTO 361
352 IF RND<=.9 THEN 353 ELSE 355
353 X(JJ)=B(JJ)
354 GOTO 361
355 X(JJ)=N(JJ)
361 FOR I222=1 TO 12
364 X(I222)=FIX(X(I222))
368 NEXT I222
411 FOR I223=1 TO 12
416 IF X(I223)>3 THEN X(I223)=3
418 NEXT I223
421 FOR I224=1 TO 12
426 IF X(I224)<0 THEN X(I224)=0
428 NEXT I224
461 IF RND>.1 GOTO 561
465 IF RND<5 THEN 471 ELSE IF RND<1/2 THEN 491 ELSE 511
471 IOCT1=1+FIX(RND*12)
474 IOCT2=1+FIX(RND*12)
477 X(IOCT1)=A(IOCT2)
480 X(IOCT2)=A(IOCT1)
561 P(11)=ABS(X(1)-X(2))-.5
562 P(12)=ABS(X(1)-X(3))-.5
563 P(13)=ABS(X(1)-X(4))-.5
564 P(14)=ABS(X(1)-X(5))-.5
565 P(15)=ABS(X(1)-X(6))-.5
566 P(16)=ABS(X(1)-X(7))-.5
567 P(17)=ABS(X(1)-X(8))-.5
568 P(18)=ABS(X(1)-X(9))-.5
569 P(19)=ABS(X(1)-X(10))-.5
570 P(20)=ABS(X(1)-X(11))-.5
571 P(21)=ABS(X(1)-X(12))-.5
572 P(22)=ABS(X(2)-X(3))-.5
573 P(23)=ABS(X(2)-X(4))-.5
574 P(24)=ABS(X(2)-X(5))-.5
575 P(25)=ABS(X(2)-X(6))-.5
576 P(26)=ABS(X(2)-X(7))-.5
577 P(27)=ABS(X(2)-X(8))-.5
578 P(28)=ABS(X(2)-X(9))-.5
579 P(29)=ABS(X(2)-X(10))-.5
580 P(30)=ABS(X(2)-X(11))-.5
581 P(31)=ABS(X(2)-X(12))-.5
582 P(32)=ABS(X(3)-X(4))-.5
583 P(33)=ABS(X(3)-X(5))-.5
584 P(34)=ABS(X(3)-X(6))-.5
585 P(35)=ABS(X(3)-X(7))-.5
586 P(36)=ABS(X(3)-X(8))-.5
587 P(37)=ABS(X(3)-X(9))-.5
588 P(38)=ABS(X(3)-X(10))-.5
589 P(39)=ABS(X(3)-X(11))-.5
590 P(40)=ABS(X(3)-X(12))-.5
591 P(41)=ABS(X(4)-X(5))-.5
592 P(42)=ABS(X(4)-X(6))-.5
593 P(43)=ABS(X(4)-X(7))-.5
594 P(44)=ABS(X(4)-X(8))-.5
595 P(45)=ABS(X(4)-X(9))-.5
596 P(46)=ABS(X(4)-X(10))-.5
597 P(47)=ABS(X(4)-X(11))-.5
598 P(48)=ABS(X(4)-X(12))-.5
599 P(49)=ABS(X(5)-X(6))-.5
600 P(50)=ABS(X(5)-X(7))-.5
601 P(51)=ABS(X(5)-X(8))-.5
602 P(52)=ABS(X(5)-X(9))-.5
603 P(53)=ABS(X(5)-X(10))-.5
604 P(54)=ABS(X(5)-X(11))-.5
605 P(55)=ABS(X(5)-X(12))-.5
606 P(56)=ABS(X(6)-X(7))-.5
607 P(57)=ABS(X(6)-X(8))-.5
608 P(58)=ABS(X(6)-X(9))-.5
609 P(59)=ABS(X(6)-X(10))-.5
610 P(60)=ABS(X(6)-X(11))-.5
611 P(61)=ABS(X(6)-X(12))-.5
612 P(62)=ABS(X(7)-X(8))-.5
613 P(63)=ABS(X(7)-X(9))-.5
614 P(64)=ABS(X(7)-X(10))-.5
615 P(65)=ABS(X(7)-X(11))-.5
616 P(66)=ABS(X(7)-X(12))-.5
617 P(67)=ABS(X(8)-X(9))-.5
618 P(68)=ABS(X(8)-X(10))-.5
619 P(69)=ABS(X(8)-X(11))-.5
620 P(70)=ABS(X(8)-X(12))-.5
621 P(71)=ABS(X(9)-X(10))-.5
622 P(72)=ABS(X(9)-X(11))-.5
623 P(73)=ABS(X(9)-X(12))-.5
624 P(74)=ABS(X(10)-X(11))-.5
625 P(75)=ABS(X(10)-X(12))-.5
626 P(76)=ABS(X(11)-X(12))-.5
788 FOR INSI=11 TO 76
791 IF P(INSI)<0 THEN P(INSI)=1 ELSE P(INSI)=0
795 NEXT INSI
1321 P11B=5*P(11)+2*P(12)+4*P(13)+1*P(14)+0*P(15)
1322 P12B=0*P(16)+6*P(17)+2*P(18)+1*P(19)+1*P(20)+1*P(21)
1323 P13B=3*P(22)+0*P(23)+2*P(24)+2*P(25)+2*P(26)
1324 P14B=0*P(27)+4*P(28)+5*P(29)+0*P(30)+0*P(31)
1325 P15B=0*P(32)+0*P(33)+0*P(34)+0*P(35)+5*P(36)
1326 P16B=5*P(37)+2*P(38)+2*P(39)+2*P(40)
1327 P17B=5*P(41)+2*P(42)+2*P(43)+10*P(44)+0*P(45)+0*P(46)+5*P(47)+5*P(48)
1328 P18B=10*P(49)+0*P(50)+0*P(51)+0*P(52)+5*P(53)+1*P(54)+1*P(55)
1329 P19B=5*P(56)+1*P(57)+1*P(58)+5*P(59)+4*P(60)+0*P(61)
1330 P20B=10*P(62)+5*P(63)+2*P(64)+3*P(65)+3*P(66)
1331 P21B=0*P(67)+0*P(68)+5*P(69)+0*P(70)
1332 P22B=0*P(71)+10*P(72)+10*P(73)
1333 P23B=5*P(74)+0*P(75)
1334 P24B=2*P(76)
1443 P1=P11B+P12B+P13B+P14B+P15B+P16B+P17B+P18B+P19B+P20B
1444 P2=P21B+P22B+P23B+P24B
1448 P6=P1+P2
1450 P=-P6+PS1
1451 IF P<=M THEN 1670
1452 M=P
1453 PP1=P6
1454 FOR KLX=1 TO 12
1455 A(KLX)=X(KLX)
1456 NEXT KLX
1457 GOTO 128
1670 NEXT I
1702 NEXT JJ
1706 NEXT J
1777 NEXT INEW
1888 NEXT JJJ
1890 IF M>-55 THEN 1916 ELSE 1999
1916 PRINT JJJJ,M,PP1
1917 PRINT A(1),A(2),A(3),A(4),A(5)
1918 PRINT A(6),A(7),A(8),A(9),A(10)
1920 PRINT A(11),A(12)
1999 NEXT JJJJ
This BASIC computer program was run with the IBM basica/D interpreter, and the candidate solutions produced from JJJJ=-32000 through JJJJ=-31994 (in compressed form and to be interpreted in accordance with line 1916 through line 1920; copied manually from the computer monitor) are presented below.
-32000 -4 4
2 0 3 1 3
0 3 0 1 1
2 0
-31999 -6 6
1 3 2 0 2
1 2 3 0 0
3 1
-31998 -4 4
2 1 2 3 2
0 2 0 3 3
1 0
-31997 -6 6
1 2 3 3 2
1 3 0 0 0
2 1
-31996 -6 6
2 1 3 3 1
2 3 0 0 0
1 2
-31995 -5 5
2 3 0 0 2
0 2 1 1 1
3 3
-31994 -4 4
2 0 3 1 3
0 3 0 1 1
2 0
Among the candidate solutions presented above, the best are at JJJJ=-32000, -31998, and -31994 with an objective function value of 4.
The output above was produced in less than one minute on a personal computer with an Intel 2.66 GHz. chip and the IBM interpreter, which is slower than the corresponding compiler.
References
[1] R.C. Carlson, G.L. Nemhauser, Scheduling to minimize interaction cost, Operations Research, 14 (1966) 52-58.
[2] S.S. Heragu, A. Kusiak, Efficient models for the facility layout problem, European Journal of Operational Research 53 (1991) 1-13.
[3] S.S. Heragu, Recent models and techniques for solving the layout problem, European Journal of Operational Research 57 (1992) 136-144.
[4] F.S. Hillier, Quantitative tools for plant layout analysis, J. Indust. Eng. 14 (1963) 33-44.
[5] C.E. Nugent, T.E. Vollmann, J. Ruml, An experimental comparison of techniques for the assignment of facilities to locations, Operations Research 16 (1968) 150-173.
[6] W.C. Conley, Optimization: A Simplified Approach, Petrocelli, Princeton, New Jersey, 1981.