The NETFLOW Procedure |
In this example we illustrate the use of the EXCESS= option for various scenarios in pure networks. Consider a simple network as shown in Figure 5.43. The positive numbers on the nodes correspond to supply and the negative numbers correspond to demand. The numbers on the arcs indicate costs.
Figure 5.43: Transportation Problem
The following SAS code creates the input data sets.
data parcs; input _from_ $ _to_ $ _cost_; datalines; s1 d1 1 s1 d2 8 s2 d1 4 s2 d2 2 ; data SleD; input _node_ $ _sd_; datalines; s1 1 s2 10 d1 -10 d2 -5 ;
You can solve the problem using the following call to PROC NETFLOW:
title1 'The NETFLOW Procedure'; proc netflow excess = slacks arcdata = parcs nodedata = SleD conout = solex1; run;
Since the EXCESS=SLACKS option is specified, the interior point method is used for optimization. Accordingly, the CONOUT= data set is specified. The optimal solution is displayed in Output 5.9.1.
Output 5.9.1: Supply < DemandThe solution with the THRUNET option specified is displayed in Output 5.9.2.
Output 5.9.2: Supply < Demand, THRUNET SpecifiedNote: If you want to use the network simplex solver instead, you need to specify the EXCESS=ARCS option and, accordingly, the ARCOUT= data set.
Figure 5.44: Missing D Demand
The following code creates the node data set:
data node_missingD1; input _node_ $ _sd_; missing D; datalines; s1 1 s2 10 d1 D d2 -1 ;
You can use the following call to PROC NETFLOW to solve the problem:
title1 'The NETFLOW Procedure'; proc netflow excess = slacks arcdata = parcs nodedata = node_missingD1 conout = solex1b; run;
The optimal solution is displayed in Output 5.9.3. As you can see, the flow balance at nodes with nonmissing supdem values is maintained. In other words, if a node has a nonmissing supply (demand) value, then the sum of flows out of (into) that node is equal to its supdem value.
Output 5.9.3: THRUNET Not Specifiedtitle1 'The NETFLOW Procedure'; proc netflow thrunet excess = slacks arcdata = parcs nodedata = node_missingD1 conout = solex1c; run;
The optimal solution is displayed in Output 5.9.4. By specifying the THRUNET option, we have actually obtained the minimum-cost flow through the network, while maintaining flow balance at the nodes with nonmissing supply values.
Output 5.9.4: Missing D Demand, THRUNET SpecifiedNote: The case with missing S supply values is similar to the case with missing D demand values.
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.