Friday, November 7, 2008

A General Integer Programming Computer Program Applied to a Scheduling Problem

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 575 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 six courses to two time periods, period 0 and period 1. 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 of Nugent, Vollmann, and Ruml [4, p. 168]; these flows are used in line 1238 through line 1247 below.
The following computer program benefits from the computer programs of the present blog and the computer program on pages 229-232 of Conley [5].
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
44 FOR IO=1 TO 6
45 B(IO)=0
46 NEXT IO
51 FOR IOCTT=1 TO 6
53 N(IOCTT)=1
57 NEXT IOCTT
61 FOR KLQ=1 TO 6
62 A(KLQ)=B(KLQ)+RND*(N(KLQ)-B(KLQ))
63 NEXT KLQ
71 FOR KLR=1 TO 6
72 H(KLR)=3
73 NEXT KLR
88 FOR JJJ=1 TO 1000 STEP 10
90 FOR INEW=1 TO 2
94 FOR J=INEW*2 TO 0 STEP -1
102 FOR JJ=0 TO 6
128 FOR I=1 TO 1
129 FOR KKQQ=1 TO 6
130 X(KKQQ)=A(KKQQ)
131 NEXT KKQQ
132 FOR K=1 TO 6
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*18)
307 FOR KLA1=1 TO KLPS
308 KLA2=FIX(1+6*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 6
364 X(I222)=FIX(X(I222))
368 NEXT I222
461 IF RND>.1 GOTO 561
465 IF RND<5 THEN 471 ELSE IF RND<2/3 THEN 491 ELSE 521
471 IOCT1=1+FIX(RND*6)
474 IOCT2=1+FIX(RND*6)
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(2)-X(3))-.5
567 P(17)=ABS(X(2)-X(4))-.5
568 P(18)=ABS(X(2)-X(5))-.5
569 P(19)=ABS(X(2)-X(6))-.5
570 P(20)=ABS(X(3)-X(4))-.5
571 P(21)=ABS(X(3)-X(5))-.5
572 P(22)=ABS(X(3)-X(6))-.5
573 P(23)=ABS(X(4)-X(5))-.5
574 P(24)=ABS(X(4)-X(6))-.5
575 P(25)=ABS(X(5)-X(6))-.5
788 FOR INSI=11 TO 25
792 IF P(INSI)<0 THEN P(INSI)=1 ELSE P(INSI)=0
795 NEXT INSI
1238 P11B=5*P(11)+2*P(12)+4*P(13)+1*P(14)+0*P(15)
1240 P13B=3*P(16)+0*P(17)+2*P(18)+2*P(19)
1243 P15B=0*P(20)+0*P(21)+0*P(22)
1245 P17B=5*P(23)+2*P(24)
1247 P19B=10*P(25)
1445 P1=P11B+P13B+P15B+P17B+P19B
1447 P2=0
1448 P3=P1+P2
1450 P=-P3+PS1
1451 IF P<=M THEN 1670
1452 M=P
1453 PP1=P3
1454 FOR KLX=1 TO 6
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),A(6)
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=-31995 (in compressed form and to be interpreted in accordance with line 1916 through line 1917; copied manually from the computer monitor) are presented below.
-32000 -7 7
1 0 1 0 1
0
-31999 -7 7
1 0 1 0 1
0
-31998 -7 7
1 0 1 0 1
0
-31997 -7 7
1 0 1 0 1
0
-31996 -7 7
1 0 1 0 1
0
-31995 -7 7
0 1 0 1 0
1
Each of the six candidate solutions shown above has the objective function value of 7.
(For this example, one ignores a candidate solution vector if any of its elements is not 0 or 1.)
The output above was produced in 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 layut 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] 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.
[5] W. C. Conley, Optimization: A Simplified Approach, Petrocelli, Princeton, New Jersey, 1981.