The CPM Procedure |
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.
Greeting Card Production |
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 |
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=1.5 'Greeting Card Production'; title2 h=1 'Truck Schedule'; proc gantt data=OneSched (drop=e_: l_:) ; chart / act=activity succ=succ duration=duration cmile=red top cprec=blue nolegend nojobnum; id activity duration; run;
title2 'Resource Usage Data Set'; proc print data=OneRout; id _time_; run;
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.