Resources

Resource-Driven Durations and Negative Requirements (cpme31)

 /************************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                         */
 /*                                                                      */
 /*    NAME: CPME31                                                      */
 /*   TITLE: Resource-Driven Durations and Negative Requirements (cpme31)*/
 /* PRODUCT: OR                                                          */
 /*  SYSTEM: ALL                                                         */
 /*    KEYS: CPM                                                         */
 /*   PROCS: CPM                                                         */
 /*    DATA:                                                             */
 /*                                                                      */
 /* SUPPORT:                             UPDATE:                         */
 /*     REF: Example 31 from the CPM Chapter (PM User's Guide)           */
 /*    MISC:                                                             */
 /*                                                                      */
 /************************************************************************/

/* Create two orders of cards and ship them */
data TwoOrdersRD;
   input Activity $ 1-14 succ $ 16-29 Duration work
         Machine Mach1 Mach2 numboxes trucks _pattern;
   datalines;
First Order    .             1  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   .             1  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 TwoMachinesRD;
   input per date7. obstype $ resid $
         Machine Mach1 Mach2 numboxes trucks;
   format per date7.;
   datalines;
.        resrcdur  .       1  1  1    .     .
.        restype   .       1  1  1    2     1
.        altrate  Machine  .  1  .5   .     .
.        auxres   Mach1    .  .  .  -5000   .
.        auxres   Mach2    .  .  .  -10000  .
15aug04  reslevel .        .  1  .    .     3
24aug04  reslevel .        .  0  1    .     .
;


title 'Resource-Driven Durations';
title2 'Activity Data Set TwoOrdersRD';
proc print data=TwoOrdersRD heading=v;
   run;


title 'Resource-Driven Durations';
title2 'Resource Data Set TwoMachinesRD';
proc print data=TwoMachinesRD;
   run;


proc cpm data=TwoOrdersRD resin=TwoMachinesRD
     out=TwoSchedRD rsched=TwoRschedRD resout=TwoRoutRD
     date='15aug04'd;
   act      activity;
   succ     succ;
   duration duration;
   resource Machine Mach1 Mach2 numboxes trucks / period=per
                                         obstype=obstype
                                         resid=resid work=work
                                         milestoneresource;
   id _pattern;
   run;

proc sort data=TwoSchedRD;
   by s_start;
   run;

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

title h=2 'Resource-Driven Durations';
title2 h=1.5 'Truck Schedule';
proc gantt data=TwoSchedRD(drop=e_: l:);
   chart / act=activity succ=succ duration=duration
           nolegend nojobnum compress pattern=_pattern
           ctextcols=id cprec=blue scale=4 height=1.4;
   id activity ;
   run;


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