Chapter Contents |
Previous |
Next |
The NETFLOW Procedure |
The data required by PROC NETFLOW for a network problem is identical whether the Simplex algorithm or the Interior Point algorithm is used as the optimizer. By default, the Simplex algorithm is used for problems with a network component. To use the Interior Point algorithm, all you need to do is specify the INTPOINT option in the PROC NETFLOW statement. You can optionally specify some options that control the Interior Point algorithm, of which there are only a few. The Interior Point algorithm is remarkedly robust when reasonable choices are made during the design and implementation, so it does not need to be tuned to the same extent as the Simplex algorithm.
If the network component of the model is large compared to the side constraint component, PROC NETFLOW's optimizer can store what would otherwise be a large matrix as a spanning tree computer data structure. Computations involving the spanning tree data structure can be performed much faster than those using matrices. Only the nonnetwork part of the problem, hopefully quite small, needs to be manipulated by PROC NETFLOW as matrices.
In contrast, LP optimizers must contend with matrices that can be large for large problems. Arithmetic operations on matrices often accumulate rounding errors that cause difficulties for the algorithm. So in addition to the performance improvements, network optimization is generally more numerically stable than LP optimization.
The nodal flow conservation constraints do not need to be specified in the network model. They are implied by the network structure. However, flow conservation constraints do make up the data for the equivalent LP model. If you have an LP that is small after the flow conservation constraints are removed, that problem is a definite candidate for solution by PROC NETFLOW specialized Simplex method.
However, some constrained network problems are solved more quickly by the Interior Point algorithm than the network optimizer in PROC NETFLOW. Usually, they have a large number of side constraints or nonarc variables. These models are more like LPs than network problems. The network component of the problem is so small that PROC NETFLOW's Network Simplex method cannot recoup the effort to exploit that component rather than treat the whole problem as an LP. If this is the case, it is worthwhile to get PROC NETFLOW to convert a constrained network problem to the equivalent LP and use it's Interior Point algorithm. This conversion must be done before any optimization has been performed (specify the INTPOINT option in the PROC NETFLOW statement) Even though some network problems are better solved by converting them to an LP, the input data and the output solution are more conveniently maintained as networks. You retain the advantages of casting problems as networks: ease of problem generation and expansion when more detail is required. The model and optimal solutions are easy to understand, as a network can be drawn.
The NODEDATA= data set contains the names of the supply and demand nodes and the supply or demand associated with each. These are the elements in the column vector b in problem (NPSC).
The ARCDATA= data set contains information about the variables of the problem. Usually these are arcs, but there can be data related to nonarc variables in the ARCDATA= data set as well. If there are no arcs, this is a Linear Programming problem.
An arc is identified by the names of its tail node (where it originates) and head node (where it is directed). Each observation can be used to identify an arc in the network and, optionally, the cost per flow unit across the arc, the arc's capacity, lower flow bound, and name. These data are associated with the matrix F and the vectors c, l, and u in problem (LPSC).
Note: although F is a node-arc incidence matrix, it is specified in the ARCDATA= data set by arc definitions. Do not explicitly specify these flow conservation constraints as constraints of the problem. In addition, the ARCDATA= data set can be used to specify information about nonarc variables, including objective function coefficients, lower and upper value bounds, and names. These data are the elements of the vectors d, m, and v in problem (NPSC). Data for an arc or nonarc variable can be given in more than one observation.
Supply and demand data also can be specified in the ARCDATA= data set. In such a case, the NODEDATA= data set may not be needed.
The CONDATA= data set describes the side constraints and their right-hand-sides. These data are elements of the matrices H and Q and the vector r. Constraint types are also specified in the CONDATA= data set. You can include in this data set upper bound values or capacities, lower flow or value bounds, and costs or objective function coefficients. It is possible to give all information about some or all nonarc variables in the CONDATA= data set.
An arc or nonarc variable is identified in this data set by it's name. If you specify an arc's name in the ARCDATA= data set, then this name is used to associate data in the CONDATA= data set with that arc. Each arc also has a default name that is the name of the tail and head node of the arc concatenated together and separated by an underscore character; tail_head, for example.
If you use the dense side constraint input format and want to use these default arc names, these arc names are names of SAS variables in the VAR list of the CONDATA= data set.
If you use the sparse side constraint input format (described later as well) and want to use these default arc names, these arc names are values of the COLUMN list SAS variable of the CONDATA= data set. When using the Interior Point algorithm, the execution of PROC NETFLOW has two stages. In the preliminary (zeroth) stage, the data are read from the NODEDATA= data set, the ARCDATA= data set, and the CONDATA= data set. Error checking is performed. The model is converted into an equivalent Linear Program
In the next stage, the Linear Program is preprocessed. This is optional but highly recommended. Preprocessing analyses the model and tries to determine before optimization whether variables can be "fixed" to their optimal values. Knowing that, the model can be modified and these variables dropped out. It can be determined that some constraints are redundant. Sometimes, preprocessing succeeds in reducing the size of the problem, thereby making the subsequent optimization easier and faster.
The optimal solution to the Linear Program is then found. The Linear Program is converted back to the original constrained network problem, and the optimum for this is derived from the optimum of the equivalent Linear Program. If the problem was preprocessed, the model is now post-processed, where fixed variables are reintroduced. The solution can be saved in the CONOUT= data set. This data set is also named in the PROC NETFLOW, RESET, and SAVE statements.
The Interior Point algorithm cannot efficiently be warm started, so options such as FUTURE1 and FUTURE2 options are irrelevant.
To solve this problem with PROC NETFLOW, a representation of the model is saved in three SAS data sets, that are identical to the data sets supplied to PROC NETFLOW when the Simplex algorithm was used.
To find the minimum cost flow through the network that satisfies the supplies, demands, and side constraints, invoke PROC NETFLOW as follows:
proc netflow intpoint /* <<<--- Interior Point used */ nodedata=noded /* the supply and demand data */ arcdata=arcd1 /* the arc descriptions */ condata=cond1 /* the side constraints */ conout=solution; /* the solution data set */ run;
The following messages, that appear on the SAS log, summarize the model as read by PROC NETFLOW and note the progress toward a solution:
NOTE: Number of nodes= 14 . NOTE: Number of supply nodes= 2 . NOTE: Number of demand nodes= 4 . NOTE: Total supply= 180 , total demand= 180 . NOTE: Number of arcs= 18 . NOTE: Number of variables= 18 . NOTE: Number of <= constraints= 0 . NOTE: Number of == constraints= 16 . NOTE: Number of >= constraints= 2 . NOTE: Number of constraint coefficients= 44 . NOTE: After preprocessing, number of <= constraints= 0. NOTE: After preprocessing, number of == constraints= 6. NOTE: After preprocessing, number of >= constraints= 2. NOTE: The preprocessor eliminated 10 constraints from the problem. NOTE: The preprocessor eliminated 22 constraint coefficients from the problem. NOTE: After preprocessing, number of variables= 8. NOTE: The preprocessor eliminated 10 variables from the problem. NOTE: 2 columns, 0 rows and 2 coefficients were added to the problem to handle unrestricted variables, variables that are split, and constraint slack or surplus variables. NOTE: There are 18 nonzero elements in A * A transpose. NOTE: Number of fill-ins=5. NOTE: Of the 8 rows and columns, 2 are sparse. NOTE: During factorization, 1 of the dense rows were found to be completely dense and were treated as such from then on. This should have saved time. NOTE: There are 8 nonzero elements in the sparse rows of the factored A * A transpose. This includes fill-ins in the sparse rows. NOTE: There are 3 operations of the form u[i,j]=u[i,j]-u[q,j]*u[q,i]/u[q,q] to factorize the sparse rows of A * A transpose. NOTE: Constraint feasibility, bound feasibility, and dual feasibility attained by iteration 1 as a affine step (mu=0) of length 1 was done. NOTE: Primal-Dual Predictor-Corrector Interior point algorithm performed 8 iterations. NOTE: Objective = 50875.000253. NOTE: The data set WORK.SOLUTION has 18 observations and 14 variables.
The first set of messages provide statistics on the size of the equivalent Linear Programming problem. The number of variables may not equal the number of arcs if the problem has nonarc variables. This example has none. To convert a network to an equivalent LP problem, a flow conservation constraint must be created for each node (including an excess or bypass node, if required). This explains why the number of equality side constraints and the number of constraint coefficients change when the Interior Point algorithm is used.
If the preprocessor was successful in decreasing the problem size, some messages will report how well it did. In this example, the model size was cut in half!
The following set of messages describe aspects of the Interior Point algorithm. Of particular interest are those concerned with the Cholesky factorization of A AT where A is the coefficient matrix of the final LP. It is crucial to preorder the rows and columns of this matrix to prevent fill-in and reduce the number of row operations to undertake the factorization. See the "Interior Point Algorithmic Details" section for more explanation.
Unlike PROC LP that displays the solution and other information as output, PROC NETFLOW saves the optimum in output SAS data sets you specify. For this example, the solution is saved in the SOLUTION data set. It can be displayed with PROC PRINT as:
proc print data=solution; var _from_ _to_ _cost_ _capac_ _lo_ _name_ _supply_ _demand_ _flow_ _fcost_ _rcost_; sum _fcost_; title3 'Constrained Optimum'; run;
Notice that, in the solution data set (Figure 4.17), the optimal flow through each arc in the network is given in the variable named _FLOW_, and the cost of flow through each arc is given in the variable _FCOST_. As expected, the miminal total cost of the solution found by the Interior Point algorithm is equal to miminal total cost of the solution found by the Simplex algorithm. In this example, the solutions are the same (within several significant digits), but sometimes the solutions can be different.
So far, this is the same when the Simplex algorithm is used, except the INTPOINT option is specified in the PROC NETFLOW statement. The PRINT, QUIT, SAVE, SHOW, RESET, and RUN statements follow and can be listed in any order. The QUIT statements can be used only once. The others can be used as many times as needed.
The CONOPT and PIVOT statements are not relevant to the Interior Point algorithm and should not be used. Use the RESET or SAVE statement to change the name of the output data set. There is only on output data set, the CONOUT= data set. With the RESET statement, you can also indicate the reasons why optimization should stop, (for example, you can indicate the maximum number of iterations that can be performed). PROC NETFLOW then has a chance to either execute the next statement, or, if the next statement is one that PROC NETFLOW does not recognize (the next PROC or DATA step in the SAS session), do any allowed optimization and finish. If no new statement has been submitted, you are prompted for one. Some options of the RESET statement enable you to control aspects of the Interior Point algorithm. Specifying certain values for these options can reduce the time it takes to solve a problem. Note that any of the RESET options can be specified in the PROC NETFLOW statement.
The RUN statement starts optimization. Once the optimization has started, it runs until the optimum is reached. The RUN statement should be specified at most once.
The QUIT statement immediately stops PROC NETFLOW. The SAVE statement has options that allow you to name the output data set; information about the current solution is put in this output data set. Use the SHOW statement if you want to examine the values of options of other statements. Information about the amount of optimization that has been done and the STATUS of the current solution can also be displayed using the SHOW statement.
The PRINT statement makes PROC NETFLOW display parts of the problem. The way the PRINT statements are specified are identical whether the Interior Point algorithm or the Simplex algorithm is used, however there are minor differences in what is displayed for each arc, nonarc variable or constraint coefficient.
PRINT ARCS produces information on all arcs. PRINT SOME_ARCS limits this output to a subset of arcs. There are similar PRINT statements for nonarc variables and constraints:
PRINT NONARCS; PRINT SOME_NONARCS; PRINT CONSTRAINTS; PRINT SOME_CONS;PRINT CON_ARCS enables you to limit constraint information that is obtained to members of a set of arcs and that have nonzero constraint coefficients in a set of constraints. PRINT CON_NONARCS is the corresponding statement for nonarc variables.
For example, an interactive PROC NETFLOW run might look something like this:
proc netflow intpoint /* use the Interior Point algorithm */ arcdata=data set other options; variable list specifications; /* if necessary */ reset options; print options; /* look at problem */ run; /* do the optimization */ print options; /* look at the optimal solution */ save options; /* keep optimal solution */If you are interested only in finding the optimal solution, have used SAS variables that have special names in the input data sets, and want to use default setting for everything, then the following statement is all you need
Description | Statement | Option |
---|---|---|
arcs input data set | NETFLOW | ARCDATA= |
nodes input data set | NETFLOW | NODEDATA= |
constraint input data set | NETFLOW | CONDATA= |
Description | Statement | Option |
---|---|---|
default arc cost | NETFLOW | DEFCOST= |
default arc capacity | NETFLOW | DEFCAPACITY= |
default arc lower flow bound | NETFLOW | DEFMINFLOW= |
network's only supply node | NETFLOW | SOURCE= |
SOURCE's supply capability | NETFLOW | SUPPLY= |
network's only demand node | NETFLOW | SINK= |
SINK's demand | NETFLOW | DEMAND= |
excess supply or demand is conveyed through network | NETFLOW | THRUNET |
find maximal flow between SOURCE and SINK | NETFLOW | MAXFLOW |
cost of bypass arc when solving MAXFLOW problem | NETFLOW | BYPASSDIV= |
find shortest path from SOURCE to SINK | NETFLOW | SHORTPATH |
Description | Statement | Option |
---|---|---|
infinity value | NETFLOW | INFINITY= |
do constraint row and/or nonarc variable column coefficient | NETFLOW | SCALE= |
scaling, or neither | ||
maximization instead of minimization | NETFLOW | MAXIMIZE |
Description | Statement | Option |
---|---|---|
CONDATA has sparse data format | NETFLOW | SPARSECONDATA |
default constraint type | NETFLOW | DEFCONTYPE= |
special COLUMN variable value | NETFLOW | TYPEOBS= |
special COLUMN variable value | NETFLOW | RHSOBS= |
is used to interpret arc and nonarc variable names | NETFLOW | NAMECTRL= |
in the CONDATA | ||
no new nonarc variables | NETFLOW | SAME_NONARC_DATA |
no nonarc data in the ARCDATA | NETFLOW | ARCS_ONLY_ARCDATA |
data for an arc found in only one obs of ARCDATA | NETFLOW | ARC_SINGLE_OBS |
data for an constraint found in only one | NETFLOW | CON_SINGLE_OBS |
obs of CONDATA | ||
data for a coefficient found once in CONDATA | NETFLOW | NON_REPLIC= |
data is grouped, exploited during data read | NETFLOW | GROUPED= |
Description | Statement | Option |
---|---|---|
number of nodes | NETFLOW | NNODES= |
number of arcs | NETFLOW | NARCS= |
number of nonarc variables | NETFLOW | NNAS= |
number of coefficients | NETFLOW | NCOEFS= |
number of constraints | NETFLOW | NCONS= |
Description | Statement | Option |
---|---|---|
issue memory usage messages to SASLOG | NETFLOW | MEMREP |
number of bytes to use for main memory | NETFLOW | BYTES= |
proportion of memory used by frequently | NETFLOW | COREFACTOR= |
accessed arrays | ||
maximum bytes for a single array | NETFLOW | MAXARRAYBYTES= |
Description | Statement | Option |
---|---|---|
constrained solution data set | RESET | CONOUT= |
Description | Statement | Option |
---|---|---|
display everything | PROBLEM | |
display arc information | ARCS | |
display nonarc variable information | NONARCS | |
display variables information | VARIABLES | |
display constraint information | CONSTRAINTS | |
display information for some arcs | SOME_ARCS | |
display information for some nonarc variables | SOME_NONARCS | |
display information for some variables | SOME_VARIABLES | |
display information for some constraints | SOME_CONS | |
display information for some constraints | CON_ARCS | |
associated with some arcs | ||
display information for some constraints | CON_NONARCS | |
associated with some nonarc variables | ||
display information for some constraints | CON_VARIABLES | |
associated with some variables |
Description | Statement | Option |
---|---|---|
produce a short report | / SHORT | |
produce a long report | / LONG | |
only arcs (nonarc variables) with zero flow (value) | / ZERO | |
only arcs (nonarc variables) with nonzero flow (value) | / NONZERO |
Description | Statement | Option |
---|---|---|
show problem, optimization status | SHOW | STATUS |
show network model parameters | SHOW | NETSTMT |
show data sets that have, will be created | SHOW | DATA SETS |
Description | Statement | Option |
---|---|---|
constrained solution data set | SAVE | CONOUT= |
Description | Statement | Option |
---|---|---|
use Interior Point algorithm | NETFLOW | INTPOINT |
allowed amount of dual infeasibility | RESET | TOLDINF= |
allowed amount of primal infeasibility | RESET | TOLPINF= |
cut-off tolerance for Cholesky factorization | RESET | CHOLTINYTOL= |
density threshold for Cholesky processing | RESET | DENSETHR= |
maximum number of Interior Point algorithm iterations | RESET | MAXITERB= |
Primal-Dual (Duality) gap tolerance | RESET | PDGAPTOL= |
step-length multiplier | RESET | PDSTEPMULT= |
preprocessing type | RESET | PRSLTYPE= |
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.