Example 4.29 Negative Resource Requirements

This example illustrates the use of negative resource requirements and the MILESTONERESOURCE option. Consider the production of boxed greeting cards that need to be shipped on trucks with a given capacity. Suppose there are three trucks with a capacity of 10,000 boxes of cards each. Suppose also that the boxes are produced at the rate of 5,000 boxes a day by the box-creating activity, 'First Order' with a duration of 6 days, and requiring the use of a machine, say resource `Mach1`. The activity data set `OneOrder`, displayed in Output 4.29.1, represents the activities that are to be scheduled. The Schedule Truck i task (i = 1, 2, 3) is represented as a milestone to denote the point in time when the required number of boxes are available from the production line. The variable `numboxes` denotes the number of boxes that are produced by the machine, or delivered by the trucks. The Resource data set `OneMachine`, displayed in Output 4.29.2, defines the resource `numboxes` as a consumable resource and the resources `Mach1` and `trucks` as replenishable resources.

Output 4.29.1: Activity Data Set

 Negative Resource Requirements Activity Data Set OneOrder

Obs Activity succ Duration Mach1 numboxes trucks
1 First Order   6 1 -5000 .
2 Sched truck1 Delivery 1 0 . 10000 .
3 Sched truck2 Delivery 2 0 . 10000 .
4 Sched truck3 Delivery 3 0 . 10000 .
5 Delivery 1   2 . . 1
6 Delivery 2   2 . . 1
7 Delivery 3   2 . . 1

Output 4.29.2: Resource Data Set

 Negative Resource Requirements Resource Data Set OneMachine

Obs per obstype Mach1 numboxes trucks
1 . restype 1 2 1
2 15AUG04 reslevel 1 . 1

The following statements invoke the CPM procedure to schedule the production of the boxed greeting cards. The option MILESTONERESOURCE indicates that milestones can consume resources. In this case, the milestones representing the scheduling of the trucks are scheduled only when 10,000 boxes of greeting cards are available. The resulting schedule is displayed in Output 4.29.3 using PROC GANTT, and the resource usage data set is displayed in Output 4.29.4.

```
proc cpm data=OneOrder resin=OneMachine
out=OneSched rsched=OneRsch resout=OneRout
date='15aug04'd;
act      activity;
succ     succ;
duration duration;
resource Mach1 numboxes trucks / period=per
obstype=obstype
milestoneresource;
run;

proc sort data=OneSched;
by s_start;
run;

```
```title  h=2 'Negative Resource Requirements';
title2 h=1.5   'Truck Schedule';
proc gantt data=OneSched (drop=e_: l_:) ;
chart / act=activity succ=succ duration=duration
cmile=red
cprec=blue height=1.8
nolegend nojobnum;
id activity duration;
run;
```
```
title2 'Resource Usage Data Set';
proc print data=OneRout;
id _time_;
run;
```

Output 4.29.3: Gantt Chart of Schedule

The resulting Gantt chart shows the schedule of the trucks, which is staggered according to the production rate of the machine that produces the cards. In other words, the trucks are scheduled at intervals of 2 days. The Resource Usage data set shows the production/consumption rate of the boxes for each day of the project.

Output 4.29.4: Resource Usage Data Set

 Resource Usage Data Set

_TIME_ EMach1 LMach1 RMach1 AMach1 Enumboxes Lnumboxes Rnumboxes Anumboxes Etrucks Ltrucks Rtrucks Atrucks
15AUG04 1 1 1 0 25000 -5000 -5000 0 3 0 0 1
16AUG04 1 1 1 0 -5000 -5000 -5000 5000 3 0 0 1
17AUG04 1 1 1 0 -5000 -5000 5000 10000 0 0 1 0
18AUG04 1 1 1 0 -5000 -5000 -5000 5000 0 0 1 0
19AUG04 1 1 1 0 -5000 25000 5000 10000 0 3 1 0
20AUG04 1 1 1 0 -5000 -5000 -5000 5000 0 3 1 0
21AUG04 0 0 0 1 0 0 10000 10000 0 0 1 0
22AUG04 0 0 0 1 0 0 0 0 0 0 1 0
23AUG04 0 0 0 1 0 0 0 0 0 0 0 1