The CPM Procedure

Example 4.18 Variable Activity Delay

In Example 4.17, the DELAY= option is used to specify a maximum amount of delay that is allowed for all activities in the project. In some situations it may be reasonable to set the delay for each activity based on some characteristic pertaining to the activity. For example, consider the data in Example 4.17 with a slightly different scenario. Suppose that no delay is allowed in activities that require a production engineer. Data set WIDGR18, displayed in Output 4.18.1, is obtained from WIDGR17 using the following simple DATA step.

data widgr18;
   set widgr17;
   if prodeng ^= . then adelay = 0;
   else                 adelay = 5;
   run;
title 'Variable Activity Delay';
title2 'Data Set WIDGR18';
proc print;
   run;

Output 4.18.1: Activity Data Set WIDGR18

Variable Activity Delay
Data Set WIDGR18

Obs task days tail head deseng mktan prodeng money adelay
1 Approve Plan 5 1 2 1 1 1 200 0
2 Drawings 10 2 3 1 . 1 100 0
3 Study Market 5 2 4 . 1 1 100 0
4 Write Specs 5 2 3 1 . 1 150 0
5 Prototype 15 3 5 1 . 1 300 0
6 Mkt. Strat. 10 4 6 . 1 . 150 5
7 Materials 10 5 7 . . . 300 5
8 Facility 10 5 7 . . 1 500 0
9 Init. Prod. 10 7 8 . . . 250 5
10 Evaluate 10 8 9 1 . . 150 5
11 Test Market 15 6 9 . 1 . 200 5
12 Changes 5 9 10 1 . 1 200 0
13 Production 0 10 11 1 . 1 600 0
14 Marketing 0 6 12 . 1 . . 5
15 Dummy 0 8 6 . . . . 5


PROC CPM is invoked with the ACTDELAY=ADELAY option in the RESOURCE statement. The INFEASDIAGNOSTIC option is also used to enable the procedure to schedule activities even if resources are insufficient. The output data sets are displayed in Output 4.18.2 and Output 4.18.3.

data resin17;
   input per & date7. otype $
         deseng mktan prodeng money;
   format per date7.;
   datalines;
.        restype  1 1 1 4
01dec03  reslevel 1 . 1 .
;

data holdata;
   format hol date7. name $9. ;
   input hol & date7. name & ;
   datalines;
25dec03  Christmas
01jan04  New Year
;

proc cpm date='01dec03'd
         interval=weekday
         data=widgr18
         holidata=holdata
         resin=resin17
         out=widgo18
         resout=widgro18;
   tailnode tail;
   duration days;
   headnode head;
   holiday hol;
   resource deseng prodeng mktan money / period=per
                                         obstype=otype
                                         delayanalysis
                                         actdelay=adelay
                                         infeasdiagnostic
                                         rcs avl t_float
                                         cumusage;
   id task;
   run;

Output 4.18.2: Resource-Constrained Schedule: Variable Activity Delay

Variable Activity Delay
Resource Constrained Schedule

Obs tail head days task adelay deseng prodeng mktan money S_START S_FINISH E_START E_FINISH L_START L_FINISH T_FLOAT R_DELAY DELAY_R SUPPL_R
1 1 2 5 Approve Plan 0 1 1 1 200 01DEC03 05DEC03 01DEC03 05DEC03 01DEC03 05DEC03 0 0   mktan
2 2 3 10 Drawings 0 1 1 . 100 08DEC03 19DEC03 08DEC03 19DEC03 08DEC03 19DEC03 0 0    
3 2 4 5 Study Market 0 . 1 1 100 14JAN04 20JAN04 08DEC03 12DEC03 21JAN04 27JAN04 30 25 prodeng prodeng
4 2 3 5 Write Specs 0 1 1 . 150 08DEC03 12DEC03 08DEC03 12DEC03 15DEC03 19DEC03 5 0   deseng
5 3 5 15 Prototype 0 1 1 . 300 22DEC03 13JAN04 22DEC03 13JAN04 22DEC03 13JAN04 0 0    
6 4 6 10 Mkt. Strat. 5 . . 1 150 21JAN04 03FEB04 15DEC03 29DEC03 28JAN04 10FEB04 30 0   mktan
7 5 7 10 Materials 5 . . . 300 14JAN04 27JAN04 14JAN04 27JAN04 14JAN04 27JAN04 0 0    
8 5 7 10 Facility 0 . 1 . 500 14JAN04 27JAN04 14JAN04 27JAN04 14JAN04 27JAN04 0 0    
9 7 8 10 Init. Prod. 5 . . . 250 28JAN04 10FEB04 28JAN04 10FEB04 28JAN04 10FEB04 0 0    
10 8 9 10 Evaluate 5 1 . . 150 11FEB04 24FEB04 11FEB04 24FEB04 18FEB04 02MAR04 5 0    
11 6 9 15 Test Market 5 . . 1 200 11FEB04 02MAR04 11FEB04 02MAR04 11FEB04 02MAR04 0 0   mktan
12 9 10 5 Changes 0 1 1 . 200 03MAR04 09MAR04 03MAR04 09MAR04 03MAR04 09MAR04 0 0    
13 10 11 0 Production 0 1 1 . 600 10MAR04 10MAR04 10MAR04 10MAR04 10MAR04 10MAR04 0 0    
14 6 12 0 Marketing 5 . . 1 . 11FEB04 11FEB04 11FEB04 11FEB04 10MAR04 10MAR04 20 0    
15 8 6 0 Dummy 5 . . . . 11FEB04 11FEB04 11FEB04 11FEB04 11FEB04 11FEB04 0 0    


Output 4.18.3: Resource Usage

Variable Activity Delay
Usage Profile

Obs _TIME_ Rdeseng Adeseng Rprodeng Aprodeng Rmktan Amktan Rmoney Amoney
1 01DEC03 1 0 1 0 1 -1 0 .
2 02DEC03 1 0 1 0 1 -1 200 .
3 03DEC03 1 0 1 0 1 -1 400 .
4 04DEC03 1 0 1 0 1 -1 600 .
5 05DEC03 1 0 1 0 1 -1 800 .
6 08DEC03 2 -1 2 -1 0 0 1000 .
7 09DEC03 2 -1 2 -1 0 0 1250 .
8 10DEC03 2 -1 2 -1 0 0 1500 .
9 11DEC03 2 -1 2 -1 0 0 1750 .
10 12DEC03 2 -1 2 -1 0 0 2000 .
11 15DEC03 1 0 1 0 0 0 2250 .
12 16DEC03 1 0 1 0 0 0 2350 .
13 17DEC03 1 0 1 0 0 0 2450 .
14 18DEC03 1 0 1 0 0 0 2550 .
15 19DEC03 1 0 1 0 0 0 2650 .
16 22DEC03 1 0 1 0 0 0 2750 .
17 23DEC03 1 0 1 0 0 0 3050 .
18 24DEC03 1 0 1 0 0 0 3350 .
19 26DEC03 1 0 1 0 0 0 3650 .
20 29DEC03 1 0 1 0 0 0 3950 .
21 30DEC03 1 0 1 0 0 0 4250 .
22 31DEC03 1 0 1 0 0 0 4550 .
23 02JAN04 1 0 1 0 0 0 4850 .
24 05JAN04 1 0 1 0 0 0 5150 .
25 06JAN04 1 0 1 0 0 0 5450 .
26 07JAN04 1 0 1 0 0 0 5750 .
27 08JAN04 1 0 1 0 0 0 6050 .
28 09JAN04 1 0 1 0 0 0 6350 .
29 12JAN04 1 0 1 0 0 0 6650 .
30 13JAN04 1 0 1 0 0 0 6950 .
31 14JAN04 0 1 2 -1 1 -1 7250 .
32 15JAN04 0 1 2 -1 1 -1 8150 .
33 16JAN04 0 1 2 -1 1 -1 9050 .
34 19JAN04 0 1 2 -1 1 -1 9950 .
35 20JAN04 0 1 2 -1 1 -1 10850 .
36 21JAN04 0 1 1 0 1 -1 11750 .
37 22JAN04 0 1 1 0 1 -1 12700 .
38 23JAN04 0 1 1 0 1 -1 13650 .
39 26JAN04 0 1 1 0 1 -1 14600 .
40 27JAN04 0 1 1 0 1 -1 15550 .
41 28JAN04 0 1 0 1 1 -1 16500 .
42 29JAN04 0 1 0 1 1 -1 16900 .
43 30JAN04 0 1 0 1 1 -1 17300 .
44 02FEB04 0 1 0 1 1 -1 17700 .
45 03FEB04 0 1 0 1 1 -1 18100 .
46 04FEB04 0 1 0 1 0 0 18500 .
47 05FEB04 0 1 0 1 0 0 18750 .
48 06FEB04 0 1 0 1 0 0 19000 .
49 09FEB04 0 1 0 1 0 0 19250 .
50 10FEB04 0 1 0 1 0 0 19500 .
51 11FEB04 1 0 0 1 1 -1 19750 .
52 12FEB04 1 0 0 1 1 -1 20100 .
53 13FEB04 1 0 0 1 1 -1 20450 .
54 16FEB04 1 0 0 1 1 -1 20800 .
55 17FEB04 1 0 0 1 1 -1 21150 .
56 18FEB04 1 0 0 1 1 -1 21500 .
57 19FEB04 1 0 0 1 1 -1 21850 .
58 20FEB04 1 0 0 1 1 -1 22200 .
59 23FEB04 1 0 0 1 1 -1 22550 .
60 24FEB04 1 0 0 1 1 -1 22900 .
61 25FEB04 0 1 0 1 1 -1 23250 .
62 26FEB04 0 1 0 1 1 -1 23450 .
63 27FEB04 0 1 0 1 1 -1 23650 .
64 01MAR04 0 1 0 1 1 -1 23850 .
65 02MAR04 0 1 0 1 1 -1 24050 .
66 03MAR04 1 0 1 0 0 0 24250 .
67 04MAR04 1 0 1 0 0 0 24450 .
68 05MAR04 1 0 1 0 0 0 24650 .
69 08MAR04 1 0 1 0 0 0 24850 .
70 09MAR04 1 0 1 0 0 0 25050 .
71 10MAR04 0 1 0 1 0 0 25250 .


Note from the Schedule data set that the activity 'Study Market' is scheduled to start on January 14, 2004, even though (L_START $+$ adelay)=21JAN04. This is due to the fact that at every time interval, the scheduling algorithm looks ahead in time to detect any increase in the primary level of the resource; if the future resource profile indicates that the procedure will need to use supplementary levels anyway, the activity will not be forced to wait until (L_START $+$ DELAY). (To force the activity to wait until its latest allowed start time, use the AWAITDELAY option). The DELAYANALYSIS variables indicate that a supplementary level of the resource prodeng is needed to schedule the activity on 14JAN03. The variable SUPPL_R identifies only one supplementary resource that is needed for the activity. In fact, examination of the resource requirements for the activity and the RESOURCEOUT data set shows that an extra market analyst is also needed between the 14th and 20th of January to schedule this activity. Likewise, the activities 'Write Specs' and 'Drawings' require a design engineer and a production engineer; both these activities start on the 8th of December. The RESOURCEOUT data set indicates that an extra design engineer and an extra production engineer are needed from the 8th to the 12th of December.

The next invocation of PROC CPM illustrates the use of the ACTDELAY variable to force the resource-constrained schedule to coincide with the early start schedule. The following DATA step uses the Schedule data set WIDGO18 to set an activity delay variable (actdel) to be equal to $-$T_FLOAT. PROC CPM is then invoked with the ACTDELAY variable equal to actdel and the INFEASDIAGNOSTIC option. This forces all activities to be scheduled on or before (L_START $+$ actdel), which happens to be equal to E_START; thus all activities are scheduled to start at their early start time. The resulting Schedule data set is displayed in Output 4.18.4. Though this is an extreme case, a similar technique could be used selectively to set the delay value for each activity (or some of the activities) to depend on the unconstrained schedule or the T_FLOAT value. If both the DELAY= and ACTDELAY= options are specified, the DELAY= value is used to set the activity delay values for activities that have missing values for the ACTDELAY variable.

Note also that in this invocation of PROC CPM, the BASELINE statement is used to compare the early start schedule and the resource constrained schedule. The S_VAR and F_VAR variables are 0 for all the activities, as is to be expected (since all activities are forced to start as per the early start schedule).

data negdelay;
   set widgo18;
   actdel=-t_float;
   run;

proc cpm date='01dec03'd
         interval=weekday
         data=negdelay
         holidata=holdata
         resin=resin17
         out=widgo18n;
   tailnode tail;
   duration days;
   headnode head;
   holiday hol;
   resource deseng prodeng mktan money / period=per
                                         obstype=otype
                                         delayanalysis
                                         actdelay=actdel
                                         infeasdiagnostic;
   baseline / set=early compare=resource;
   id task;
   run;

Output 4.18.4: Resource-Constrained Schedule: Activity Delay = - (T_FLOAT)

Variable Activity Delay
Resource Constrained Schedule
Activity Delay = - (T_FLOAT)

O
b
s
t
a
i
l
h
e
a
d
d
a
y
s
t
a
s
k
a
c
t
d
e
l
d
e
s
e
n
g
p
r
o
d
e
n
g
m
k
t
a
n
m
o
n
e
y
S
_
S
T
A
R
T
S
_
F
I
N
I
S
H
E
_
S
T
A
R
T
E
_
F
I
N
I
S
H
L
_
S
T
A
R
T
L
_
F
I
N
I
S
H
R
_
D
E
L
A
Y
D
E
L
A
Y
_
R
S
U
P
P
L
_
R
B
_
S
T
A
R
T
B
_
F
I
N
I
S
H
S
_
V
A
R
F
_
V
A
R
1 1 2 5 Approve Plan 0 1 1 1 200 01DEC03 05DEC03 01DEC03 05DEC03 01DEC03 05DEC03 0   mktan 01DEC03 05DEC03 0 0
2 2 3 10 Drawings 0 1 1 . 100 08DEC03 19DEC03 08DEC03 19DEC03 08DEC03 19DEC03 0     08DEC03 19DEC03 0 0
3 2 4 5 Study Market -30 . 1 1 100 08DEC03 12DEC03 08DEC03 12DEC03 21JAN04 27JAN04 0   prodeng 08DEC03 12DEC03 0 0
4 2 3 5 Write Specs -5 1 1 . 150 08DEC03 12DEC03 08DEC03 12DEC03 15DEC03 19DEC03 0   deseng 08DEC03 12DEC03 0 0
5 3 5 15 Prototype 0 1 1 . 300 22DEC03 13JAN04 22DEC03 13JAN04 22DEC03 13JAN04 0     22DEC03 13JAN04 0 0
6 4 6 10 Mkt. Strat. -30 . . 1 150 15DEC03 29DEC03 15DEC03 29DEC03 28JAN04 10FEB04 0   mktan 15DEC03 29DEC03 0 0
7 5 7 10 Materials 0 . . . 300 14JAN04 27JAN04 14JAN04 27JAN04 14JAN04 27JAN04 0     14JAN04 27JAN04 0 0
8 5 7 10 Facility 0 . 1 . 500 14JAN04 27JAN04 14JAN04 27JAN04 14JAN04 27JAN04 0     14JAN04 27JAN04 0 0
9 7 8 10 Init. Prod. 0 . . . 250 28JAN04 10FEB04 28JAN04 10FEB04 28JAN04 10FEB04 0     28JAN04 10FEB04 0 0
10 8 9 10 Evaluate -5 1 . . 150 11FEB04 24FEB04 11FEB04 24FEB04 18FEB04 02MAR04 0     11FEB04 24FEB04 0 0
11 6 9 15 Test Market 0 . . 1 200 11FEB04 02MAR04 11FEB04 02MAR04 11FEB04 02MAR04 0   mktan 11FEB04 02MAR04 0 0
12 9 10 5 Changes 0 1 1 . 200 03MAR04 09MAR04 03MAR04 09MAR04 03MAR04 09MAR04 0     03MAR04 09MAR04 0 0
13 10 11 0 Production 0 1 1 . 600 10MAR04 10MAR04 10MAR04 10MAR04 10MAR04 10MAR04 0     10MAR04 10MAR04 0 0
14 6 12 0 Marketing -20 . . 1 . 11FEB04 11FEB04 11FEB04 11FEB04 10MAR04 10MAR04 0     11FEB04 11FEB04 0 0
15 8 6 0 Dummy 0 . . . . 11FEB04 11FEB04 11FEB04 11FEB04 11FEB04 11FEB04 0     11FEB04 11FEB04 0 0