Example 3.6 Multiple Projects

Often a project is divided into several subprojects, each of which is then broken into activities with precedence constraints. For reporting or accounting purposes, it may be essential to group activities or to aggregate the information pertaining to activities in a given group. Sometimes, totally different projects use a common pool of resources and you may want to schedule all the projects using the common pool; you may want to vary the priority with which the resources are allotted to the activities on the basis of the projects to which they belong. Often, you have several projects that are essentially the same, with only a few minor differences; these projects may also share a common pool of resources. In such cases, you may want to have a project template listing all the activities and their precedence relationships; for each specific project you can copy the template, make any modifications that are necessary for the given scenario, and determine the project schedule accordingly.

This example illustrates some of these possibilities for a multiproject scenario. The project is first scheduled using PROC CPM, and then the PM procedure is used with the same input data set to illustrate the project displayed in the PM Window.

Output 3.6.1 Network Diagram for Project Book
Network Diagram for Project Book

Consider a publishing company that accepts manuscripts from different authors for publication. The publication of each book can be treated as a project. Thus, at a given point in time, several projects, almost identical in nature, may be in progress. Some of the resources that may be needed are a technical editor, a copyeditor, and a graphic artist. All the books that are currently being worked on share a common pool of these resources. This example uses a simplified version of such a scenario to illustrate some of the ways in which you can handle multiple projects competing for the same pool of resources.

The network in Output 3.6.1 represents some of the tasks required to publish one book and the precedence constraints among these tasks; the durations in the diagram are in weeks. Suppose that the generic project data are in the data set book, which is displayed in Output 3.6.2. This data set is used as a template for creating the Activity data set for any book publishing project.

Suppose that the company is working on two books simultaneously. The editor and artist must now allocate their time between the two books. The following program uses the template data set book to create Activity data sets book1 and book2 corresponding to the publication of each book. Any modifications to the generic project data can be made in the DATA step or by using PROC PM. In this example, the duration for the first activity, 'Preliminary Edit,' is changed to two weeks for the second book. The two Activity data sets book1 and book2 are also displayed in Output 3.6.2.

data book1;
   length act $6. succ $6.;
   set book;
   subproj = "Book 1";
   act = "B1"||task;
   if succ ^= " " then succ = "B1"||succ;
   run;

data book2;
   length act $6. succ $6.;
   set book;
   subproj = "Book 2";
   act  = "B2"||task;
   if act = "B2PEDT" then dur = 2;
   if succ ^= " "    then succ = "B2"||succ;
   run;     
title 'Publishing Book 1';
proc print data=book1;
   var subproj task act succ id dur editor artist;
   run;

title 'Publishing Book 2';
proc print data=book2;
   var subproj task act succ id dur editor artist;
   run;

Output 3.6.2 Template and Activity Data Sets for Book Publishing Example
Publishing Book 1

Obs subproj task act succ id dur editor artist
1 Book 1 PEDT B1PEDT B1REV Preliminary Edit 1 1 .
2 Book 1 PEDT B1PEDT B1GRPH Preliminary Edit 1 1 .
3 Book 1 REV B1REV B1CEDT Revise Book 2 1 .
4 Book 1 GRPH B1GRPH B1CEDT Graphics 3 . 1
5 Book 1 CEDT B1CEDT B1PRF Copyedit Book 1 1 .
6 Book 1 PRF B1PRF B1PRNT Proofread Book 1 1 .
7 Book 1 PRNT B1PRNT   Print Book 2 . .



Publishing Book 2

Obs subproj task act succ id dur editor artist
1 Book 2 PEDT B2PEDT B2REV Preliminary Edit 2 1 .
2 Book 2 PEDT B2PEDT B2GRPH Preliminary Edit 2 1 .
3 Book 2 REV B2REV B2CEDT Revise Book 2 1 .
4 Book 2 GRPH B2GRPH B2CEDT Graphics 3 . 1
5 Book 2 CEDT B2CEDT B2PRF Copyedit Book 1 1 .
6 Book 2 PRF B2PRF B2PRNT Proofread Book 1 1 .
7 Book 2 PRNT B2PRNT   Print Book 2 . .


As a next step, the data sets for the two subprojects are combined to form an Activity data set for the entire project. A variable priority is assigned the value '1' for activities pertaining to the first book and the value '2' for those pertaining to the second one. In other words, Book 1 has priority over Book 2. The Resource data set specifies the availability for each of the resources to be 1. The input data sets, books and resource, are displayed in Output 3.6.3.
data books;
   set book1 book2;
   if subproj = "Book 1" then priority = 1;
   else priority = 2;
   run;

data resource;
   input avdate & date7. editor artist;
   format avdate date7.;
   datalines;
1jan03   1   1
;
title 'Publishing Books 1 and 2';
proc print data=books;
   var subproj priority task act succ id dur editor artist;
   run;

title 'Resources Available';
proc print data=resource;
   run;

Output 3.6.3 Input Data Sets for Book Publishing Example
Publishing Books 1 and 2

Obs subproj priority task act succ id dur editor artist
1 Book 1 1 PEDT B1PEDT B1REV Preliminary Edit 1 1 .
2 Book 1 1 PEDT B1PEDT B1GRPH Preliminary Edit 1 1 .
3 Book 1 1 REV B1REV B1CEDT Revise Book 2 1 .
4 Book 1 1 GRPH B1GRPH B1CEDT Graphics 3 . 1
5 Book 1 1 CEDT B1CEDT B1PRF Copyedit Book 1 1 .
6 Book 1 1 PRF B1PRF B1PRNT Proofread Book 1 1 .
7 Book 1 1 PRNT B1PRNT   Print Book 2 . .
8 Book 2 2 PEDT B2PEDT B2REV Preliminary Edit 2 1 .
9 Book 2 2 PEDT B2PEDT B2GRPH Preliminary Edit 2 1 .
10 Book 2 2 REV B2REV B2CEDT Revise Book 2 1 .
11 Book 2 2 GRPH B2GRPH B2CEDT Graphics 3 . 1
12 Book 2 2 CEDT B2CEDT B2PRF Copyedit Book 1 1 .
13 Book 2 2 PRF B2PRF B2PRNT Proofread Book 1 1 .
14 Book 2 2 PRNT B2PRNT   Print Book 2 . .



Resources Available

Obs avdate editor artist
1 01JAN03 1 1

PROC CPM is then invoked to schedule the project to start on January 1, 2003. The PROJECT statement is used to indicate the subproject to which each activity belongs. The data set bookschd (displayed in Output 3.6.4) contains the schedule for the entire project. The ADDACT option on the PROC CPM statement adds observations for each of the subprojects, 'Book 1' and 'Book 2,' as well as one observation for the entire project. These observations are added at the end of the list of the observations corresponding to the observations in the input data set. The Usage data set booksout is also displayed in Output 3.6.4.

proc cpm data=books resin=resource
         out=bookschd resout=booksout
         date='1jan03'd interval=week
         addact;
   act      act;
   dur      dur;
   succ     succ;
   resource editor artist / per=avdate avp rcp
                            rule=actprty actprty=priority
                            delayanalysis;
   id       id task;
   project  subproj;
   run;

Compare the E_START and S_START schedules (in the data set bookschd) and note that on January 1, the activity 'B1PEDT' for Book1 is scheduled to start while the preliminary editing of book 2 (activity B2PEDT) has been postponed, due to subproject 'Book 1' having priority over subproject 'Book 2.' On January 22, there is no activity belonging to subproject 'Book 1' that demands an editor; thus, the activity 'B2PEDT' is scheduled to start on that day. As a result, the editor is working on an activity in the second project for two weeks starting from January 22, 2003; when 'B1CEDT' is ready to start, the editor is not available, causing a delay in this activity. Thus, even though the first book has priority over the second book, the scheduling algorithm does not keep a resource waiting for activities in the first project. However, if you enable activity splitting, you can reclaim the resource for the first book by allowing activities in the second project to be split, if necessary. For details regarding the scheduling algorithm allowing splitting of activities, see Chapter 4, The CPM Procedure.

Note: The entire project finishes on April 1, 2003; resource constraints have delayed project completion by four weeks. The variable R_DELAY in the Schedule data set bookschd indicates the amount of delay in weeks caused by resource constraints. The value of R_DELAY does not include any delay in the activity that is caused by a resource delay in one of its predecessors. See Example 4.15 in Chapter 4, The CPM Procedure, for more details about the R_DELAY variable.

Output 3.6.4 Data Sets BOOKSCHD and BOOKSOUT
Schedule for Project BOOKS

Obs subproj PROJ_DUR PROJ_LEV act succ dur id task editor artist S_START S_FINISH E_START E_FINISH L_START L_FINISH R_DELAY DELAY_R SUPPL_R
1 Book 1 . 2 B1PEDT B1REV 1 Preliminary Edit PEDT 1 . 01JAN03 07JAN03 01JAN03 07JAN03 08JAN03 14JAN03 0    
2 Book 1 . 2 B1PEDT B1GRPH 1 Preliminary Edit PEDT 1 . 01JAN03 07JAN03 01JAN03 07JAN03 08JAN03 14JAN03 0    
3 Book 1 . 2 B1REV B1CEDT 2 Revise Book REV 1 . 08JAN03 21JAN03 08JAN03 21JAN03 22JAN03 04FEB03 0    
4 Book 1 . 2 B1GRPH B1CEDT 3 Graphics GRPH . 1 08JAN03 28JAN03 08JAN03 28JAN03 15JAN03 04FEB03 0    
5 Book 1 . 2 B1CEDT B1PRF 1 Copyedit Book CEDT 1 . 05FEB03 11FEB03 29JAN03 04FEB03 05FEB03 11FEB03 1 editor  
6 Book 1 . 2 B1PRF B1PRNT 1 Proofread Book PRF 1 . 12FEB03 18FEB03 05FEB03 11FEB03 12FEB03 18FEB03 0    
7 Book 1 . 2 B1PRNT   2 Print Book PRNT . . 19FEB03 04MAR03 12FEB03 25FEB03 19FEB03 04MAR03 0    
8 Book 2 . 2 B2PEDT B2REV 2 Preliminary Edit PEDT 1 . 22JAN03 04FEB03 01JAN03 14JAN03 01JAN03 14JAN03 3 editor  
9 Book 2 . 2 B2PEDT B2GRPH 2 Preliminary Edit PEDT 1 . 22JAN03 04FEB03 01JAN03 14JAN03 01JAN03 14JAN03 3 editor  
10 Book 2 . 2 B2REV B2CEDT 2 Revise Book REV 1 . 19FEB03 04MAR03 15JAN03 28JAN03 22JAN03 04FEB03 2 editor  
11 Book 2 . 2 B2GRPH B2CEDT 3 Graphics GRPH . 1 05FEB03 25FEB03 15JAN03 04FEB03 15JAN03 04FEB03 0    
12 Book 2 . 2 B2CEDT B2PRF 1 Copyedit Book CEDT 1 . 05MAR03 11MAR03 05FEB03 11FEB03 05FEB03 11FEB03 0    
13 Book 2 . 2 B2PRF B2PRNT 1 Proofread Book PRF 1 . 12MAR03 18MAR03 12FEB03 18FEB03 12FEB03 18FEB03 0    
14 Book 2 . 2 B2PRNT   2 Print Book PRNT . . 19MAR03 01APR03 19FEB03 04MAR03 19FEB03 04MAR03 0    
15   9 1 Book 1   .     . . 01JAN03 04MAR03 01JAN03 25FEB03 08JAN03 04MAR03 0    
16   10 1 Book 2   .     . . 22JAN03 01APR03 01JAN03 04MAR03 01JAN03 04MAR03 3    
17   13 0     .     . . 01JAN03 01APR03 01JAN03 04MAR03 01JAN03 04MAR03 0    



Resource Usage for Project BOOKS

Obs _TIME_ Reditor Aeditor Rartist Aartist
1 01JAN03 1 0 0 1
2 08JAN03 1 0 1 0
3 15JAN03 1 0 1 0
4 22JAN03 1 0 1 0
5 29JAN03 1 0 0 1
6 05FEB03 1 0 1 0
7 12FEB03 1 0 1 0
8 19FEB03 1 0 1 0
9 26FEB03 1 0 0 1
10 05MAR03 1 0 0 1
11 12MAR03 1 0 0 1
12 19MAR03 0 1 0 1
13 26MAR03 0 1 0 1
14 02APR03 0 1 0 1

The output data sets bookschd and booksout can be used to produce graphical reports of the schedule and the resource usage. In particular, the Schedule data set can be used to produce a zoned, time-scaled network diagram as shown in Output 3.6.5. The program used to produce the network diagram is shown in the following code. In this example, only the leaf tasks (those without any subtasks) are used to draw the network diagram. Further, the activities are aligned according to the resource-constrained start times and grouped according to the subproject.

goptions hpos=98 vpos=60;

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

title c=black h=4 'Schedule for Project Books';
proc netdraw data=bookschd(where=(proj_dur=.)) graphics;
   actnet / act=act succ=succ
            id=(task) nodefid nolabel
            xbetween=8 htext=3 pcompress
            zone=subproj zonepat zonespace
            align=s_start separatearcs;
   label subproj = 'Subproject';
   run;

Output 3.6.5 Resource Constrained Schedule for Project Books
Resource Constrained Schedule for Project Books

The same project can also be scheduled using the PM procedure, as shown in the following statements. The resulting PM Window is shown in Output 3.6.6. The advantage with using PROC PM is that you can use the PM Window to edit the activity information, such as the durations, resource requirements, and so forth.

proc pm data=books resin=resource
        out=pmsched resout=pmrout
        date='1jan03'd interval=week;
   act      act;
   dur      dur;
   succ     succ;
   resource editor artist / per=avdate
                            avp rcp
                            rule=actprty
                            actprty=priority
                            delayanalysis;
   id       id task;
   project  subproj;
   run;

Output 3.6.6 PM Window on Book Project
PM Window on Book Project