Resources

Resource Constrained Scheduling (intpme05)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: INTPME05                                            */
/*   TITLE: Resource Constrained Scheduling (intpme05)          */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS:                                                     */
/*   PROCS: CPM, GANTT, GPLOT                                   */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 5 from the chapter, Introduction to Project */
/*           Management.                                        */
/*    MISC: Scheduling Programming Tasks                        */
/*                                                              */
/****************************************************************/

data program;
   format task $8. succ $8. ;
   input task & succ & dur processor;
   datalines;
Sort A    Merge 1    5   1
Sort B    Merge 1    4   1
Sort C    Merge 1    3   1
Sort D    Merge 2    6   1
Sort E    Merge 2    4   1
Sort F    Merge 2    6   1
Merge 1   Compare    5   1
Merge 2   Compare    4   1
Compare   .          5   1
;

data resin;
   input per processor;
   datalines;
0  2
;

proc cpm data=program resin=resin
         out=progschd resout=progrout;
   activity  task;
   duration  dur;
   successor succ;
   resource  processor/per=per;
   run;

title 'Scheduling Programming Tasks';
title2 'Data Set PROGSCHD';
proc print data=progschd;
   run;

title2 'Data Set PROGROUT';
proc print data=progrout;
   run;

pattern1 c=green v=s;     /* duration of a non-critical activity   */
pattern2 c=green v=e;     /* slack time for a noncrit. activity    */
pattern3 c=red   v=s;     /* duration of a critical activity       */
pattern4 c=magenta v=e;   /* slack time for a supercrit. activity  */
pattern5 c=magenta v=s;   /* duration of a supercrit. activity     */
pattern6 c=cyan v=s;      /* actual duration of an activity        */
pattern7 c=black v=e;     /* break due to a holiday                */
pattern8 c=blue v=s;      /* resource schedule of activity         */

goptions hpos=80 vpos=43;

title h=2.5 'Scheduling Programming Tasks';
title2 h=1.5 'Comparison of Schedules';
proc gantt data=progschd graphics;
   chart / height=1.5 increment=2 caxis=black;
   id task;
   run;

/* Create a data set for use with PROC GPLOT */
data plotout;
   set progrout;
   label _time_='Time of Usage';
   label processor='Number of Processors';
   label resource='Type of Schedule Followed';
   resource='Constrained';
   processor=rprocessor; output;
   resource='Early Start';
   processor=eprocessor; output;
   run;

axis1 minor=none width=3;
axis2 length=80 pct;
symbol1 i=steplj c=red;
symbol2 i=steplj l=3 c=green;

title2 h=1.5 'Comparison of Processor Usage';
proc gplot data=plotout;
   plot processor * _time_ = resource/ vaxis=axis1
                                       haxis=axis2
                                       caxis=black;
   run;