Resources

Nonarc Variables in the Side Constraints (int5)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: INT5                                                */
/*   TITLE: Nonarc Variables in the Side Constraints (int5)     */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: OR                                                  */
/*   PROCS: INTPOINT, APPEND                                    */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF:                                                     */
/*    MISC: Example 5 from INTPOINT chapter                     */
/****************************************************************/

data node0;
   input _node_ $ _supdem_ ;
   datalines;
fact1_1   1000
fact2_1    850
fact1_2   1000
fact2_2   1500
shop1_1   -900
shop2_1   -900
shop1_2   -900
shop2_2  -1450
;


title2 'Nonarc Variables in the Side Constraints';
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
;


data arc6;
   input _tail_ $ _head_ $ _cost_ _capac_ _lo_  diagonal factory
         key_id $10. mth_made $ _name_&$17.;
datalines;
fact1_1  f1_apr_1   78.60 600 50 19 1 production April prod f1 19 apl
f1_mar_1 f1_apr_1   15.00  50  . 19 1 storage    March .
f1_may_1 f1_apr_1   33.60  20  . 19 1 backorder  May   back f1 19 may
f2_apr_1 f1_apr_1   11.00  40  . 19 . f2_to_1    April .
fact1_2  f1_apr_2  174.50 550 50 25 1 production April prod f1 25 apl
f1_mar_2 f1_apr_2   20.00  40  . 25 1 storage    March .
f1_may_2 f1_apr_2   49.20  15  . 25 1 backorder  May   back f1 25 may
f2_apr_2 f1_apr_2   21.00  25  . 25 . f2_to_1    April .
fact1_1  f1_mar_1  127.90 500 50 19 1 production March prod f1 19 mar
f1_apr_1 f1_mar_1   33.60  20  . 19 1 backorder  April back f1 19 apl
f2_mar_1 f1_mar_1   10.00  40  . 19 . f2_to_1    March .
fact1_2  f1_mar_2  217.90 400 40 25 1 production March prod f1 25 mar
f1_apr_2 f1_mar_2   38.40  30  . 25 1 backorder  April back f1 25 apl
f2_mar_2 f1_mar_2   20.00  25  . 25 . f2_to_1    March .
fact1_1  f1_may_1   90.10 400 50 19 1 production May   .
f1_apr_1 f1_may_1   12.00  50  . 19 1 storage    April .
f2_may_1 f1_may_1   13.00  40  . 19 . f2_to_1    May   .
fact1_2  f1_may_2  113.30 350 40 25 1 production May   .
f1_apr_2 f1_may_2   18.00  40  . 25 1 storage    April .
f2_may_2 f1_may_2   13.00  25  . 25 . f2_to_1    May   .
f1_apr_1 f2_apr_1   11.00   .  . 19 . f1_to_2    April .
fact2_1  f2_apr_1   62.40 480 35 19 2 production April prod f2 19 apl
f2_mar_1 f2_apr_1   18.00  30  . 19 2 storage    March .
f2_may_1 f2_apr_1   30.00  15  . 19 2 backorder  May   back f2 19 may
f1_apr_2 f2_apr_2   23.00   .  . 25 . f1_to_2    April .
fact2_2  f2_apr_2  196.70 680 35 25 2 production April prod f2 25 apl
f2_mar_2 f2_apr_2   28.00  50  . 25 2 storage    March .
f2_may_2 f2_apr_2   64.80  15  . 25 2 backorder  May   back f2 25 may
f1_mar_1 f2_mar_1   11.00   .  . 19 . f1_to_2    March .
fact2_1  f2_mar_1   88.00 450 35 19 2 production March prod f2 19 mar
f2_apr_1 f2_mar_1   20.40  15  . 19 2 backorder  April back f2 19 apl
f1_mar_2 f2_mar_2   23.00   .  . 25 . f1_to_2    March .
fact2_2  f2_mar_2  182.00 650 35 25 2 production March prod f2 25 mar
f2_apr_2 f2_mar_2   37.20  15  . 25 2 backorder  April back f2 25 apl
f1_may_1 f2_may_1   16.00   .  . 19 . f1_to_2    May   .
fact2_1  f2_may_1  128.80 250 35 19 2 production May   .
f2_apr_1 f2_may_1   20.00  30  . 19 2 storage    April .
f1_may_2 f2_may_2   26.00   .  . 25 . f1_to_2    May   .
fact2_2  f2_may_2  181.40 550 35 25 2 production May   .
f2_apr_2 f2_may_2   38.00  50  . 25 2 storage    April .
f1_mar_1 shop1_1  -327.65 250  . 19 1 sales      March .
f1_apr_1 shop1_1  -300.00 250  . 19 1 sales      April .
f1_may_1 shop1_1  -285.00 250  . 19 1 sales      May   .
f2_mar_1 shop1_1  -297.40 250  . 19 2 sales      March .
f2_apr_1 shop1_1  -290.00 250  . 19 2 sales      April .
f2_may_1 shop1_1  -292.00 250  . 19 2 sales      May   .
f1_mar_2 shop1_2  -559.76   .  . 25 1 sales      March .
f1_apr_2 shop1_2  -524.28   .  . 25 1 sales      April .
f1_may_2 shop1_2  -515.02   .  . 25 1 sales      May   .
f2_mar_2 shop1_2  -567.83 500  . 25 2 sales      March .
f2_apr_2 shop1_2  -542.19 500  . 25 2 sales      April .
f2_may_2 shop1_2  -491.56 500  . 25 2 sales      May   .
f1_mar_1 shop2_1  -362.74 250  . 19 1 sales      March .
f1_apr_1 shop2_1  -300.00 250  . 19 1 sales      April .
f1_may_1 shop2_1  -245.00 250  . 19 1 sales      May   .
f2_mar_1 shop2_1  -272.70 250  . 19 2 sales      March .
f2_apr_1 shop2_1  -312.00 250  . 19 2 sales      April .
f2_may_1 shop2_1  -299.00 250  . 19 2 sales      May   .
f1_mar_2 shop2_2  -623.89   .  . 25 1 sales      March .
f1_apr_2 shop2_2  -549.68   .  . 25 1 sales      April .
f1_may_2 shop2_2  -500.00   .  . 25 1 sales      May   .
f2_mar_2 shop2_2  -542.83 500  . 25 2 sales      March .
f2_apr_2 shop2_2  -559.19 500  . 25 2 sales      April .
f2_may_2 shop2_2  -519.06 500  . 25 2 sales      May   .
;


/* Not needed with provided data set:
data arc6;
   set arc5;
   drop oldcost oldfc oldflow _flow_ _fcost_ ;
   run;
*/

data arc6_b;
   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
   base=arc6 data=arc6_b;
   run;
proc intpoint
   bytes=1000000
   printlevel2=2
   nodedata=node0 arcdata=arc6
   condata=con6 defcontype=eq sparsecondata
   conout=arc7;
   run;
proc print data=arc7;
   var _tail_ _head_ _name_ _cost_ _capac_ _lo_
       _flow_ _fcost_;
   sum _fcost_;
   run;