Auxiliary Resources and Negative Resource Reqmts (cpme30)

 /***********************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                        */
 /*                                                                     */
 /*    NAME: CPME30                                                     */
 /*   TITLE: Auxiliary Resources and Negative Resource Reqmts (cpme30)  */
 /* PRODUCT: OR                                                         */
 /*  SYSTEM: ALL                                                        */
 /*    KEYS: CPM                                                        */
 /*   PROCS: CPM                                                        */
 /*    DATA:                                                            */
 /*                                                                     */
 /* SUPPORT:                             UPDATE:                        */
 /*     REF: Example 30 from the CPM Chapter (PM User's Guide)          */
 /*    MISC:                                                            */
 /*                                                                     */
 /***********************************************************************/

/* Create two orders of cards and ship them */
data TwoOrders;
   input Activity $ 1-14 succ $ 16-29 Duration
         Machine Mach1 Mach2 numboxes trucks _pattern;
   datalines;
First Order    .             6  1     .   . .      .  1
Sched truck1   Delivery 1    0  .     .   . 10000  .  1
Sched truck2   Delivery 2    0  .     .   . 10000  .  1
Sched truck3   Delivery 3    0  .     .   . 10000  .  1
Delivery 1     .             2  .     .   . .      1  1
Delivery 2     .             2  .     .   . .      1  1
Delivery 3     .             2  .     .   . .      1  1
Second Order   .             6  1     .   . .      .  2
Sched truck4   Delivery 4    0  .     .   . 10000  .  2
Sched truck5   Delivery 5    0  .     .   . 10000  .  2
Sched truck6   Delivery 6    0  .     .   . 10000  .  2
Delivery 4     .             2  .     .   . .      1  2
Delivery 5     .             2  .     .   . .      1  2
Delivery 6     .             2  .     .   . .      1  2
;

data TwoMachines;
   input per date7. obstype $ resid $ Machine Mach1 Mach2 numboxes trucks;
   format per date7.;
   datalines;
.        restype   .       1 1  1   2     1
.        altrate  Machine  . 1  1   .     .
.        auxres   Mach1    . .  . -5000   .
.        auxres   Mach2    . .  . -10000  .
15aug04  reslevel .        . 1  .   .     3
24aug04  reslevel .        . 0  1   .     .
;


title 'Auxiliary Resources';
title2 'Activity Data Set TwoOrder';
proc print data=TwoOrders heading=v;
run;


title 'Auxiliary Resources';
title2 'Resource Data Set TwoMachines';
proc print data=TwoMachines;
run;


proc cpm data=TwoOrders resin=TwoMachines
     out=TwoSched rsched=TwoRsched resout=TwoRout
     date='15aug04'd;
   act      activity;
   succ     succ;
   duration duration;
   resource Machine Mach1 Mach2 numboxes trucks / period=per
                                         obstype=obstype
                                         resid=resid
                                         milestoneresource;
   id _pattern;
   run;

proc sort data=TwoSched;
   by s_start;
   run;

pattern1 v=s c=red;
pattern2 v=s c=green;

title h=2 'Auxiliary Resources';
title2 h=1.5 'Truck Schedule: Fixed Activity Durations';
proc gantt data=TwoSched(drop=e_: l:);
   chart / act=activity succ=succ duration=duration
           nolegend nojobnum compress pattern=_pattern
           ctextcols=id cprec=blue scale=4 height=1.5;
   id activity ;
   run;

title2 'Resource Usage Data set: Fixed Activity Durations';
proc print data=TwoRout;
   id _time_;
   run;