The NETDRAW Procedure

Example 9.7 Controlling the Arc-Routing Algorithm

This example illustrates the use of the DP and HTRACKS= options to control the routing of the arcs connecting the nodes. The project is a simple construction project with the following data. A Schedule data set produced by PROC CPM is input to PROC NETDRAW. The first invocation of the procedure illustrates the default layout of the network. As explained in the section Layout of the Network, the NETDRAW procedure uses a simple heuristic to route the arcs between the nodes. In the resulting diagram displayed in Output 9.7.1, note that the specification of BOXHT=3 limits the number of rows within each node so that the float values are not displayed.

data exmp1;
   input task     $ 1-16
         duration
         succesr1 $ 21-35
         succesr2 $ 36-50
         succesr3 $ 51-65;
   datalines;
Drill Well       4  Pump House
Pump House       3  Install Pipe
Power Line       3  Install Pipe
Excavate         5  Install Pipe   Install Pump   Foundation
Deliver Material 2  Assemble Tank
Assemble Tank    4  Erect Tower
Foundation       4  Erect Tower
Install Pump     6
Install Pipe     2
Erect Tower      6
;
proc cpm data=exmp1 date='1jan04'd out=sched;
   activity task;
   duration duration;
   successor succesr1 succesr2 succesr3;
   run;

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

title j=l h=3 ' Site: Old Well Road';
title2 j=l h=2 ' Date: January 1, 2004';
footnote j=r h=2 'Default Layout ';
proc netdraw data=sched graphics;
   actnet / act = task
            dur = duration
            succ = (succesr1-succesr3)
            boxht = 3 xbetween = 10
            separatearcs
            htext=2
            pcompress;
   run;

Output 9.7.1: Arc Routing: Default Layout

Arc Routing: Default Layout


Next, a different routing of the arcs is obtained by specifying the DP and the HTRACKS= options. As a result of these options, the NETDRAW procedure uses a dynamic programming algorithm to route the arcs, limiting the number of horizontal tracks used to 1. The resulting network diagram is shown in Output 9.7.2. Notice that at most one arc is drawn in each horizontal track. Recall that, by default, the procedure uses a dynamic programming algorithm for arc routing if the number of tracks is restricted to be less than the maximum number of successors. Thus, for this example, the default routing option will be DP, even if it is not explicitly specified (because HTRACKS = 1 and the maximum number of successors is 3).

footnote j=r h=2 'Controlled Layout ';
proc netdraw data=sched graphics;
   actnet / act = task
            dur = duration
            succ = (succesr1-succesr3)
            boxht = 3 xbetween = 10
            separatearcs
            htracks=1
            htext=2
            pcompress
            dp;
   run;

Output 9.7.2: Arc Routing: Controlled Layout

Arc Routing: Controlled Layout