The CPM Procedure

Example 3.29 Negative Resource Requirements

(View the complete code for this example.)

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 3.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 3.29.2, defines the resource numboxes as a consumable resource and the resources Mach1 and trucks as replenishable resources.

Output 3.29.1: Activity Data Set

Negative Resource Requirements
Activity Data Set OneOrder

ObsActivitysuccDurationMach1numboxestrucks
1First Order 61-5000.
2Sched truck1Delivery 10.10000.
3Sched truck2Delivery 20.10000.
4Sched truck3Delivery 30.10000.
5Delivery 1 2..1
6Delivery 2 2..1
7Delivery 3 2..1


Output 3.29.2: Resource Data Set

Negative Resource Requirements
Resource Data Set OneMachine

ObsperobstypeMach1numboxestrucks
1.restype121
215AUG27reslevel1.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 3.29.3 using PROC GANTT, and the resource usage data set is displayed in Output 3.29.4.


proc cpm data=OneOrder resin=OneMachine
     out=OneSched rsched=OneRsch resout=OneRout
     date='15aug27'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.4
           nolegend nojobnum pcompress;
   id activity duration;
   run;

title2 'Resource Usage Data Set';
proc print data=OneRout;
   id _time_;
   run;

Output 3.29.3: Gantt Chart of Schedule

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 3.29.4: Resource Usage Data Set

Resource Usage Data Set

_TIME_EMach1LMach1RMach1AMach1EnumboxesLnumboxesRnumboxesAnumboxesEtrucksLtrucksRtrucksAtrucks
15AUG27111025000-5000-500003001
16AUG271110-5000-5000-500050003001
17AUG271110-5000-50005000100000010
18AUG271110-5000-5000-500050000010
19AUG271110-5000250005000100000310
20AUG271110-5000-5000-500050000310
21AUG2700010010000100000010
22AUG27000100000010
23AUG27000100000001


Last updated: November 10, 2025