If you are familiar with using the NETFLOW procedure to solve pure network problems, then solving generalized network problems
is fairly simple. You just need to provide the additional data for the arc multipliers. Arcs by default have a multiplier
of 1.0, so you only need to provide arc multipliers that are not equal to 1.0. You can specify the arc multiplier data in
either or both of the ARCDATA=
and CONDATA=
data sets. The procedure scans the SAS variables in the ARCDATA=
data set, and if it finds a name _MULT_
(or a similar name with letters of different case), then it assumes that the SAS variable contains data for arc multipliers.
CONDATA=
is scanned for special type values that indicates data are arc multipliers.
The rest of this section describes the various ways in which you can specify data for the arc multipliers. The network in FigureĀ 5.25 is used for illustration.
You can specify all the arc multiplier data in the ARCDATA=
data set. The following code creates the input SAS data sets:
/**************************************************************** * * * Generalized Networks: * * How to Specify Data for Arc Multipliers * * * ****************************************************************/ /* All Arc Multiplier Data in the ARCDATA= Data Set */
data nodes; input _node_ $ _sd_ ; datalines; N1 22 N4 -30 N5 -10 ;
data arcs; input _from_ $ _to_ $ _cost_ _mult_; datalines; N1 N2 2 4 N1 N3 10 0.5 N2 N4 0 1 N2 N5 7 3 N3 N2 12 2 N3 N5 10 2 N5 N4 55 0.9 ;
Let us first look at the data for this problem. There is a variable named _mult_
in the ARCDATA=
data set, so PROC NETFLOW assumes it represents the arc multipliers. The SAS variable _sd_
represents the supdem
value of a node. A positive or missing S value indicates supply, and a negative or missing D value indicates demand.
The optimal solution can be obtained from the CONOUT=
data set. Note that you need to specify the CONOUT=
data set even if the network has no side constraints; you cannot use the ARCOUT=
data set.
You can use the following SAS code to run PROC NETFLOW:
title1 'The NETFLOW Procedure'; proc netflow bytes = 100000 nodedata = nodes arcdata = arcs conout = solution; run;
The optimal solution is displayed in FigureĀ 5.26.
Figure 5.26: Output of the Example Problem
The NETFLOW Procedure |
Obs | _from_ | _to_ | _cost_ | _CAPAC_ | _LO_ | _mult_ | _SUPPLY_ | _DEMAND_ | _FLOW_ | _FCOST_ |
---|---|---|---|---|---|---|---|---|---|---|
1 | N1 | N2 | 2 | 99999999 | 0 | 4.0 | 22 | . | 6.0000 | 12.000 |
2 | N3 | N2 | 12 | 99999999 | 0 | 2.0 | . | . | 3.0000 | 36.000 |
3 | N1 | N3 | 10 | 99999999 | 0 | 0.5 | 22 | . | 16.0000 | 160.000 |
4 | N2 | N4 | 0 | 99999999 | 0 | 1.0 | . | 30 | 30.0000 | 0.000 |
5 | N5 | N4 | 55 | 99999999 | 0 | 0.9 | . | 30 | -0.0000 | -0.000 |
6 | N2 | N5 | 7 | 99999999 | 0 | 3.0 | . | 10 | 0.0000 | 0.000 |
7 | N3 | N5 | 10 | 99999999 | 0 | 2.0 | . | 10 | 5.0000 | 50.000 |
Let us now solve the same problem, but with all the arc multipliers specified in the CONDATA=
data set. The CONDATA=
data set can have either a sparse format or a dense format. The following code illustrates the dense format representation:
data arcs1b; input _from_ $ _to_ $ _cost_; datalines; N1 N2 2 N1 N3 10 N2 N4 0 N2 N5 7 N3 N2 12 N3 N5 10 N5 N4 55 ; data MUdense; input _type_ $ N1_N2 N1_N3 N2_N4 N2_N5 N3_N2 N3_N5 N5_N4; datalines; mult 4.0 0.5 1.0 0.3 2.0 2.0 0.9 ;
You can use the following SAS code to obtain the solution:
proc netflow gennet nodedata = nodes arcdata = arcs1b condata = MUdense conout = soln1b; run;
Note that the GENNET option has been specified in the call to PROC NETFLOW. This option is necessary when the network is
generalized and there are no arc multiplier data in the ARCDATA=
data set. If this option is not specified, then the procedure assumes that the network is pure (without arc multipliers)
and sets up the excess supply node and the excess arcs.
The sparse format representation is as follows:
data MUsparse; input _type_ $ _col_ $ _coef_; datalines; mult N1_N2 4.0 mult N1_N3 0.5 mult N2_N4 1.0 mult N2_N5 0.3 mult N3_N2 2.0 mult N3_N5 2.0 mult N5_N4 0.9 ;
You can use the following SAS code to obtain the solution:
proc netflow gennet sparsecondata nodedata = nodes arcdata = arcs1b condata = MUsparse conout = soln1c; run;
Note that you need to specify the SPARSECONDATA option in the call to PROC NETFLOW.
You can also provide some multiplier data in the ARCDATA=
data set, and the rest in the CONDATA=
data set as follows:
data arcs1c; input _from_ $ _to_ $ _cost_ _mult_; datalines; N1 N2 2 4 N1 N3 10 .5 N2 N4 0 . N2 N5 7 . N3 N2 12 . N3 N5 10 . N5 N4 55 . ; data MUdense1; input _type_ $ N2_N4 N2_N5 N3_N2 N3_N5 N5_N4; datalines; mult 1.0 0.3 2.0 2.0 0.9 ;
The procedure merges the data when all the input data sets have been read.
You can also specify the name of the multiplier variable in the list statement MULT, or MULTIPLIER. For example, if the name
of the variable is lossrate
, then use the following:
proc netflow ... ; mult lossrate; run;
You may also use MULT, GAIN, or LOSS (or similar names with letters of different case) as a value of the TYPE list SAS variable.