The NETFLOW Procedure


Example 5.8 Nonarc Variables in the Side Constraints

Notice in DUALOUT= dual5 from Example 5.7 the FACT2 MAR GIZMO constraint (observation 24) has a _VALUE_ of 3470, which is not equal to the _RHS_ of this constraint. Not all of the 3750 chips that can be supplied to factory 2 for March production are used. It is suggested that all the possible chips be obtained in March and those not used be saved for April production. Because chips must be kept in an air-controlled environment, it costs 1 dollar to store each chip purchased in March until April. The maximum number of chips that can be stored in this environment at each factory is 150. In addition, a search of the parts inventory at factory 1 turned up 15 chips available for their March production.

Nonarc variables are used in the side constraints that handle the limitations of supply of Gizmo chips. A nonarc variable called "f1 unused chips" has as a value the number of chips that are not used at factory 1 in March. Another nonarc variable, "f2 unused chips", has as a value the number of chips that are not used at factory 2 in March. "f1 chips from mar" has as a value the number of chips left over from March used for production at factory 1 in April. Similarly, "f2 chips from mar" has as a value the number of chips left over from March used for April production at factory 2 in April. The last two nonarc variables have objective function coefficients of 1 and upper bounds of 150. The Gizmo side constraints are

  3*prod f1 19 mar + 4*prod f1 25 mar + f1 unused chips = 2615
  3*prod f2 19 apl + 4*prod f2 25 apl + f2 unused chips = 3750
  3*prod f1 19 apl + 4*prod f1 25 apl - f1 chips from mar = 2600
  3*prod f2 19 apl + 4*prod f2 25 apl - f2 chips from mar = 3750
  f1 unused chips + f2 unused chips -
  f1 chips from mar - f2 chips from mar >= 0

The last side constraint states that the number of chips not used in March is not less than the number of chips left over from March and used in April. Here, this constraint is called CHIP LEFTOVER.

The following SAS code creates a new data set containing constraint data. It seems that most of the constraints are now equalities, so you specify DEFCONTYPE= EQ in the PROC NETFLOW statements from now on and provide constraint type data for constraints that are not "equal to" type, using the default TYPEOBS value _TYPE_ as the _COLUMN_ variable value to indicate observations that contain constraint type data. Also, from now on, the default RHSOBS value is used.

title 'Nonarc Variables in the Side Constraints';
title2 'Production Planning/Inventory/Distribution';
data con6;
  input _column_ &$17. _row_ &$15. _coef_ ;
  datalines;
prod f1 19 mar     FACT1 MAR GIZMO  3
prod f1 25 mar     FACT1 MAR GIZMO  4
f1 unused chips    FACT1 MAR GIZMO  1
_RHS_              FACT1 MAR GIZMO  2615
prod f2 19 mar     FACT2 MAR GIZMO  3
prod f2 25 mar     FACT2 MAR GIZMO  4
f2 unused chips    FACT2 MAR GIZMO  1
_RHS_              FACT2 MAR GIZMO  3750
prod f1 19 apl     FACT1 APL GIZMO  3
prod f1 25 apl     FACT1 APL GIZMO  4
f1 chips from mar  FACT1 APL GIZMO  -1
_RHS_              FACT1 APL GIZMO  2600
prod f2 19 apl     FACT2 APL GIZMO  3
prod f2 25 apl     FACT2 APL GIZMO  4
f2 chips from mar  FACT2 APL GIZMO  -1
_RHS_              FACT2 APL GIZMO  3750
f1 unused chips    CHIP LEFTOVER    1
f2 unused chips    CHIP LEFTOVER    1
f1 chips from mar  CHIP LEFTOVER    -1
f2 chips from mar  CHIP LEFTOVER    -1
_TYPE_             CHIP LEFTOVER    1
back f1 19 apl     TOTAL BACKORDER  1
back f1 25 apl     TOTAL BACKORDER  1
back f2 19 apl     TOTAL BACKORDER  1
back f2 25 apl     TOTAL BACKORDER  1
back f1 19 may     TOTAL BACKORDER  1
back f1 25 may     TOTAL BACKORDER  1
back f2 19 may     TOTAL BACKORDER  1
back f2 25 may     TOTAL BACKORDER  1
_TYPE_             TOTAL BACKORDER  -1
_RHS_              TOTAL BACKORDER  50
;

The nonarc variables "f1 chips from mar" and "f2 chips from mar" have objective function coefficients of 1 and upper bounds of 150. There are various ways in which this information can be furnished to PROC NETFLOW. If there were a TYPE list variable in the CONDATA= data set, observations could be in the form

  _COLUMN_           _TYPE_  _ROW_ _COEF_
  f1 chips from mar  objfn     .       1
  f1 chips from mar  upperbd   .     150
  f2 chips from mar  objfn     .       1
  f2 chips from mar  upperbd   .     150

It is desirable to assign ID list variable values to all the nonarc variables:

data arc6;
  set con5;
  drop oldcost oldfc oldflow _flow_ _fcost_ _status_ _rcost_;
data arc6_b;
  length key_id $10;
  input _name_ &$17. _cost_ _capac_ factory key_id $ ;
  datalines;
f1 unused chips    .   . 1 chips
f2 unused chips    .   . 2 chips
f1 chips from mar  1 150 1 chips
f2 chips from mar  1 150 2 chips
;
proc append force nowarn
   base=arc6 data=arc6_b;
run;

proc netflow
   nodedata=node0 arcdata=arc6
   condata=con6 defcontype=eq sparsecondata
   dualout=dual7 conout=con7;
run;

print nonarcs/short;

The following messages appear on the SAS log:

NOTE: Number of nodes= 21 .                                                     
NOTE: Number of supply nodes= 4 .                                               
NOTE: Number of demand nodes= 5 .                                               
NOTE: Total supply= 4350 , total demand= 4350 .                                 
NOTE: Number of arcs= 68 .                                                      
NOTE: Number of nonarc variables= 4 .                                           
NOTE: Number of iterations performed (neglecting any constraints)= 69 .         
NOTE: Of these, 1 were degenerate.                                              
NOTE: Optimum (neglecting any constraints) found.                               
NOTE: Minimal total cost= -1295730.8 .                                          
NOTE: Number of <= side constraints= 1 .                                        
NOTE: Number of == side constraints= 4 .                                        
NOTE: Number of >= side constraints= 1 .                                        
NOTE: Number of arc and nonarc variable side constraint coefficients= 24 .      
NOTE: Number of iterations, optimizing with constraints= 13 .                   
NOTE: Of these, 2 were degenerate.                                              
NOTE: Optimum reached.                                                          
NOTE: Minimal total cost= -1295542.742 .                                        
NOTE: The data set WORK.CON7 has 68 observations and 18 variables.              
NOTE: The data set WORK.DUAL7 has 26 observations and 14 variables.             


The output in Output 5.8.1 is produced by

  • print nonarcs/short;

Output 5.8.1: Output of PRINT NONARCS/SHORT;

Nonarc Variables in the Side Constraints
Production Planning/Inventory/Distribution

The NETFLOW Procedure

_N_ _name_ _cost_ _capac_ _lo_ _VALUE_
1 f1 chips from mar 1 150 0 20
2 f1 unused chips 0 99999999 0 0
3 f2 chips from mar 1 150 0 0
4 f2 unused chips 0 99999999 0 280



The optimal solution data sets, CONOUT= CON7 in Output 5.8.2 and DUALOUT= DUAL7 in Output 5.8.4 follow.

  proc print data=con7;
     sum _fcost_;
  proc print data=dual7;

Output 5.8.2: CONOUT=CON7

Nonarc Variables in the Side Constraints
Production Planning/Inventory/Distribution

Obs _tail_ _head_ _cost_ _capac_ _lo_ _name_ _SUPPLY_ _DEMAND_ _FLOW_ _FCOST_
1 fact1_1 f1_apr_1 78.60 600 50 prod f1 19 apl 1000 . 540.000 42444.00
2 f1_mar_1 f1_apr_1 15.00 50 0   . . 0.000 0.00
3 f1_may_1 f1_apr_1 33.60 20 0 back f1 19 may . . 0.000 0.00
4 f2_apr_1 f1_apr_1 11.00 40 0   . . 0.000 0.00
5 fact1_2 f1_apr_2 174.50 550 50 prod f1 25 apl 1000 . 250.000 43625.00
6 f1_mar_2 f1_apr_2 20.00 40 0   . . 0.000 0.00
7 f1_may_2 f1_apr_2 49.20 15 0 back f1 25 may . . 0.000 0.00
8 f2_apr_2 f1_apr_2 21.00 25 0   . . 25.000 525.00
9 fact1_1 f1_mar_1 127.90 500 50 prod f1 19 mar 1000 . 338.333 43272.83
10 f1_apr_1 f1_mar_1 33.60 20 0 back f1 19 apl . . 20.000 672.00
11 f2_mar_1 f1_mar_1 10.00 40 0   . . 40.000 400.00
12 fact1_2 f1_mar_2 217.90 400 40 prod f1 25 mar 1000 . 400.000 87160.00
13 f1_apr_2 f1_mar_2 38.40 30 0 back f1 25 apl . . 30.000 1152.00
14 f2_mar_2 f1_mar_2 20.00 25 0   . . 25.000 500.00
15 fact1_1 f1_may_1 90.10 400 50   1000 . 116.667 10511.67
16 f1_apr_1 f1_may_1 12.00 50 0   . . 0.000 0.00
17 f2_may_1 f1_may_1 13.00 40 0   . . 0.000 0.00
18 fact1_2 f1_may_2 113.30 350 40   1000 . 350.000 39655.00
19 f1_apr_2 f1_may_2 18.00 40 0   . . 0.000 0.00
20 f2_may_2 f1_may_2 13.00 25 0   . . 0.000 0.00
21 f1_apr_1 f2_apr_1 11.00 99999999 0   . . 20.000 220.00
22 fact2_1 f2_apr_1 62.40 480 35 prod f2 19 apl 850 . 480.000 29952.00
23 f2_mar_1 f2_apr_1 18.00 30 0   . . 0.000 0.00
24 f2_may_1 f2_apr_1 30.00 15 0 back f2 19 may . . 0.000 0.00
25 f1_apr_2 f2_apr_2 23.00 99999999 0   . . 0.000 0.00
26 fact2_2 f2_apr_2 196.70 680 35 prod f2 25 apl 1500 . 577.500 113594.25
27 f2_mar_2 f2_apr_2 28.00 50 0   . . 0.000 0.00
28 f2_may_2 f2_apr_2 64.80 15 0 back f2 25 may . . 0.000 0.00
29 f1_mar_1 f2_mar_1 11.00 99999999 0   . . 0.000 0.00
30 fact2_1 f2_mar_1 88.00 450 35 prod f2 19 mar 850 . 290.000 25520.00
31 f2_apr_1 f2_mar_1 20.40 15 0 back f2 19 apl . . 0.000 0.00
32 f1_mar_2 f2_mar_2 23.00 99999999 0   . . 0.000 0.00
33 fact2_2 f2_mar_2 182.00 650 35 prod f2 25 mar 1500 . 650.000 118300.00
34 f2_apr_2 f2_mar_2 37.20 15 0 back f2 25 apl . . 0.000 0.00
35 f1_may_1 f2_may_1 16.00 99999999 0   . . 115.000 1840.00
36 fact2_1 f2_may_1 128.80 250 35   850 . 35.000 4508.00
37 f2_apr_1 f2_may_1 20.00 30 0   . . 0.000 0.00
38 f1_may_2 f2_may_2 26.00 99999999 0   . . 0.000 0.00
39 fact2_2 f2_may_2 181.40 550 35   1500 . 122.500 22221.50
40 f2_apr_2 f2_may_2 38.00 50 0   . . 0.000 0.00
41 f1_mar_1 shop1_1 -327.65 250 0   . 900 148.333 -48601.42
42 f1_apr_1 shop1_1 -300.00 250 0   . 900 250.000 -75000.00
43 f1_may_1 shop1_1 -285.00 250 0   . 900 1.667 -475.00
44 f2_mar_1 shop1_1 -297.40 250 0   . 900 250.000 -74350.00
45 f2_apr_1 shop1_1 -290.00 250 0   . 900 250.000 -72500.00
46 f2_may_1 shop1_1 -292.00 250 0   . 900 0.000 0.00
47 f1_mar_2 shop1_2 -559.76 99999999 0   . 900 0.000 0.00
48 f1_apr_2 shop1_2 -524.28 99999999 0   . 900 0.000 0.00
49 f1_may_2 shop1_2 -515.02 99999999 0   . 900 347.500 -178969.45
50 f2_mar_2 shop1_2 -567.83 500 0   . 900 500.000 -283915.00
51 f2_apr_2 shop1_2 -542.19 500 0   . 900 52.500 -28464.98
52 f2_may_2 shop1_2 -491.56 500 0   . 900 0.000 0.00
53 f1_mar_1 shop2_1 -362.74 250 0   . 900 250.000 -90685.00
54 f1_apr_1 shop2_1 -300.00 250 0   . 900 250.000 -75000.00
55 f1_may_1 shop2_1 -245.00 250 0   . 900 0.000 0.00
56 f2_mar_1 shop2_1 -272.70 250 0   . 900 0.000 0.00
57 f2_apr_1 shop2_1 -312.00 250 0   . 900 250.000 -78000.00
58 f2_may_1 shop2_1 -299.00 250 0   . 900 150.000 -44850.00
59 f1_mar_2 shop2_2 -623.89 99999999 0   . 1450 455.000 -283869.95
60 f1_apr_2 shop2_2 -549.68 99999999 0   . 1450 245.000 -134671.60
61 f1_may_2 shop2_2 -500.00 99999999 0   . 1450 2.500 -1250.00
62 f2_mar_2 shop2_2 -542.83 500 0   . 1450 125.000 -67853.75
63 f2_apr_2 shop2_2 -559.19 500 0   . 1450 500.000 -279595.00
64 f2_may_2 shop2_2 -519.06 500 0   . 1450 122.500 -63584.85
65     1.00 150 0 f1 chips from mar . . 20.000 20.00
66     0.00 99999999 0 f1 unused chips . . 0.000 0.00
67     1.00 150 0 f2 chips from mar . . 0.000 0.00
68     0.00 99999999 0 f2 unused chips . . 280.000 0.00
                    -1295542.74



Output 5.8.3: CONOUT=CON7 (continued)

Nonarc Variables in the Side Constraints
Production Planning/Inventory/Distribution

Obs _RCOST_ _ANUMB_ _TNUMB_ _STATUS_ diagonal factory key_id mth_made
1 . 5 1 KEY_ARC BASIC 19 1 production April
2 66.150 6 7 LOWERBD NONBASIC 19 1 storage March
3 42.580 7 8 LOWERBD NONBASIC 19 1 backorder May
4 22.000 8 9 LOWERBD NONBASIC 19 . f2_to_1 April
5 . 19 4 KEY_ARC BASIC 25 1 production April
6 94.210 20 11 LOWERBD NONBASIC 25 1 storage March
7 . 21 12 NONKEY ARC BASIC 25 1 backorder May
8 -1.510 22 13 UPPERBD NONBASIC 25 . f2_to_1 April
9 . 9 1 KEY_ARC BASIC 19 1 production March
10 -17.070 10 6 UPPERBD NONBASIC 19 1 backorder April
11 -34.750 11 14 UPPERBD NONBASIC 19 . f2_to_1 March
12 -28.343 23 4 UPPERBD NONBASIC 25 1 production March
13 -35.330 24 10 UPPERBD NONBASIC 25 1 backorder April
14 -61.060 25 15 UPPERBD NONBASIC 25 . f2_to_1 March
15 . 12 1 KEY_ARC BASIC 19 1 production May
16 3.500 13 6 LOWERBD NONBASIC 19 1 storage April
17 29.000 14 16 LOWERBD NONBASIC 19 . f2_to_1 May
18 -15.520 26 4 UPPERBD NONBASIC 25 1 production May
19 67.680 27 10 LOWERBD NONBASIC 25 1 storage April
20 32.060 28 17 LOWERBD NONBASIC 25 . f2_to_1 May
21 . 15 6 KEY_ARC BASIC 19 . f1_to_2 April
22 -35.592 16 3 UPPERBD NONBASIC 19 2 production April
23 13.400 17 14 LOWERBD NONBASIC 19 2 storage March
24 43.980 18 16 LOWERBD NONBASIC 19 2 backorder May
25 45.510 29 10 LOWERBD NONBASIC 25 . f1_to_2 April
26 . 30 5 KEY_ARC BASIC 25 2 production April
27 43.660 31 15 LOWERBD NONBASIC 25 2 storage March
28 57.170 32 17 LOWERBD NONBASIC 25 2 backorder May
29 55.750 33 7 LOWERBD NONBASIC 19 . f1_to_2 March
30 . 34 3 KEY_ARC BASIC 19 2 production March
31 25.480 35 9 LOWERBD NONBASIC 19 2 backorder April
32 104.060 36 11 LOWERBD NONBASIC 25 . f1_to_2 March
33 -23.170 37 5 UPPERBD NONBASIC 25 2 production March
34 22.020 38 13 LOWERBD NONBASIC 25 2 backorder April
35 . 39 8 KEY_ARC BASIC 19 . f1_to_2 May
36 22.700 40 3 LOWERBD NONBASIC 19 2 production May
37 6.500 41 9 LOWERBD NONBASIC 19 2 storage April
38 6.940 42 12 LOWERBD NONBASIC 25 . f1_to_2 May
39 . 43 5 KEY_ARC BASIC 25 2 production May
40 46.110 44 13 LOWERBD NONBASIC 25 2 storage April
41 . 45 7 KEY_ARC BASIC 19 1 sales March
42 -23.500 46 6 UPPERBD NONBASIC 19 1 sales April
43 . 47 8 NONKEY ARC BASIC 19 1 sales May
44 -14.500 48 14 UPPERBD NONBASIC 19 2 sales March
45 -2.500 49 9 UPPERBD NONBASIC 19 2 sales April
46 9.000 50 16 LOWERBD NONBASIC 19 2 sales May
47 79.150 51 11 LOWERBD NONBASIC 25 1 sales March
48 40.420 52 10 LOWERBD NONBASIC 25 1 sales April
49 . 53 12 KEY_ARC BASIC 25 1 sales May
50 -9.980 54 15 UPPERBD NONBASIC 25 2 sales March
51 . 55 13 KEY_ARC BASIC 25 2 sales April
52 42.520 56 17 LOWERBD NONBASIC 25 2 sales May
53 -37.090 57 7 UPPERBD NONBASIC 19 1 sales March
54 -25.500 58 6 UPPERBD NONBASIC 19 1 sales April
55 38.000 59 8 LOWERBD NONBASIC 19 1 sales May
56 8.200 60 14 LOWERBD NONBASIC 19 2 sales March
57 -26.500 61 9 UPPERBD NONBASIC 19 2 sales April
58 . 62 16 KEY_ARC BASIC 19 2 sales May
59 . 63 11 KEY_ARC BASIC 25 1 sales March
60 . 64 10 KEY_ARC BASIC 25 1 sales April
61 . 65 12 NONKEY ARC BASIC 25 1 sales May
62 . 66 15 KEY_ARC BASIC 25 2 sales March
63 -32.020 67 13 UPPERBD NONBASIC 25 2 sales April
64 . 68 17 KEY_ARC BASIC 25 2 sales May
65 . -2 . NONKEY BASIC . 1 chips  
66 1.617 0 . LOWERBD NONBASIC . 1 chips  
67 2.797 -3 . LOWERBD NONBASIC . 2 chips  
68 . -1 . NONKEY BASIC . 2 chips  



Output 5.8.4: DUALOUT=DUAL7

Nonarc Variables in the Side Constraints
Production Planning/Inventory/Distribution

Obs _node_ _supdem_ _DUAL_ _NNUMB_ _PRED_ _TRAV_ _SCESS_ _ARCID_ _FLOW_ _FBQ_ _VALUE_ _RHS_ _TYPE_ _row_
1 f1_apr_1 . -100000275.50 6 1 9 2 5 490.000 5 . .    
2 f1_apr_2 . -100000405.92 10 21 4 2 -64 245.000 19 . .    
3 f1_mar_1 . -100000326.65 7 18 1 20 -45 148.333 9 . .    
4 f1_mar_2 . -100000480.13 11 21 15 1 -63 455.000 23 . .    
5 f1_may_1 . -100000284.00 8 1 16 3 12 66.667 12 . .    
6 f1_may_2 . -100000356.24 12 19 6 1 -53 347.500 26 . .    
7 f2_apr_1 . -100000286.50 9 6 8 1 15 20.000 15 . .    
8 f2_apr_2 . -100000383.41 13 5 19 3 30 542.500 29 . .    
9 f2_mar_1 . -100000281.90 14 3 5 1 34 255.000 33 . .    
10 f2_mar_2 . -100000399.07 15 21 10 1 -66 125.000 36 . .    
11 f2_may_1 . -100000300.00 16 8 20 2 39 115.000 39 . .    
12 f2_may_2 . -100000375.30 17 5 21 6 43 87.500 42 . .    
13 fact1_1 1000 -100000193.90 1 7 2 19 -9 288.333 -1 . .    
14 fact1_2 1000 -100000227.42 4 10 13 1 -19 200.000 -5 . .    
15 fact2_1 850 -100000193.90 3 2 14 2 -2 45.000 -5 . .    
16 fact2_2 1500 -100000193.90 5 2 17 10 -4 150.000 -5 . .    
17 shop1_1 -900 -99999999.00 18 22 7 21 0 0.000 45 . .    
18 shop1_2 -900 -99999841.22 19 13 12 2 55 52.500 51 . .    
19 shop2_1 -900 -100000001.00 20 16 22 1 62 150.000 57 . .    
20 shop2_2 -1450 -99999856.24 21 17 11 5 68 122.500 63 . .    
21   . 0.00 4 4 . 4 . 260.000 . 260 0 GE CHIP LEFTOVER
22   . -1.00 2 2 . . -2 20.000 . 2600 2600 EQ FACT1 APL GIZMO
23   . -1.62 0 18 . . 47 1.667 . 2615 2615 EQ FACT1 MAR GIZMO
24   . 1.80 3 21 . . 65 2.500 . 3750 3750 EQ FACT2 APL GIZMO
25   . 0.00 1 1 . . -1 280.000 . 3750 3750 EQ FACT2 MAR GIZMO
26   . -0.48 5 10 . . 21 0.000 . 50 50 LE TOTAL BACKORDER



The optimal value of the nonarc variable "f2 unused chips" is 280. This means that although there are 3750 chips that can be used at factory 2 in March, only 3470 are used. As the optimal value of "f1 unused chips" is zero, all chips available for production in March at factory 1 are used. The nonarc variable "f2 chips from mar" also has zero optimal value. This means that the April production at factory 2 does not need any chips that could have been held in inventory since March. However, the nonarc variable "f1 chips from mar" has value of 20. Thus, 3490 chips should be ordered for factory 2 in March. Twenty of these chips should be held in inventory until April, then sent to factory 1.