Resources

Examples (mpse01)

/***************************************************************/
/*                                                             */
/*          S A S   S A M P L E   L I B R A R Y                */
/*                                                             */
/*    NAME: mpse01                                             */
/*   TITLE: Examples (mpse01)                                  */
/* PRODUCT: OR                                                 */
/*  SYSTEM: ALL                                                */
/*    KEYS: OR                                                 */
/*   PROCS:                                                    */
/*    DATA:                                                    */
/*                                                             */
/* SUPPORT:                             UPDATE:                */
/*     REF:                                                    */
/*    MISC: Examples from the MPS-Format SAS Data Set chapter  */
/*          of Mathematical Programming.                       */
/*                                                             */
/***************************************************************/


/***************************************************************
 *                                                             *
 *  Example 1: MPS-Format Data Set for a Product Mix Problem   *
 *                                                             *
 ***************************************************************/


data prodmix;
   infile datalines;
   input field1 $ field2 $ field3$ field4 field5 $ field6;
   datalines;
NAME          .         PROD_MIX        .        .             .
ROWS          .            .            .        .             .
MAX         PROFIT         .            .        .             .
L           STAMP          .            .        .             .
L           ASSEMB         .            .        .             .
L           FINISH         .            .        .             .
COLUMNS       .            .            .        .             .
.           DESK        STAMP          3.0    ASSEMB          10
.           DESK        FINISH        10.0    PROFIT          95
.           CHAIR       STAMP          1.5    ASSEMB           6
.           CHAIR       FINISH         8.0    PROFIT          41
.           CABINET     STAMP          2.0    ASSEMB           8
.           CABINET     FINISH         8.0    PROFIT          84
.           BOOKCSE     STAMP          2.0    ASSEMB           7
.           BOOKCSE     FINISH         7.0    PROFIT          76
RHS           .            .            .        .             .
.           TIME        STAMP        800.0    ASSEMB        1200
.           TIME        FINISH       800.0       .             .
RANGES        .            .            .        .             .
.           T1          ASSEMB       900.0       .             .
BOUNDS        .            .            .        .             .
UP          BND         CHAIR         75.0       .             .
LO          BND         BOOKCSE       50.0       .             .
ENDATA        .            .            .        .             .
;


/***************************************************************
 *                                                             *
 *  Example 2: Fixed-MPS-Format File                           *
 *                                                             *
 * The following (excluding the comment indicators) should be  *
 * saved in a text file named "example_fix.mps" for Example 4  *
 * to work.                                                    *
 *                                                             *
 ***************************************************************/


/*

* THIS IS AN EXAMPLE FOR FIXED MPS FORMAT.
NAME          PROD_MIX
ROWS
 N  PROFIT
 L  STAMP
 L  ASSEMB
 L  FINISH
COLUMNS
    DESK      STAMP          3.00000   ASSEMB        10.00000
    DESK      FINISH        10.00000   PROFIT       -95.00000
    CHAIR     STAMP          1.50000   ASSEMB         6.00000
    CHAIR     FINISH         8.00000   PROFIT       -41.00000
    CABINET   STAMP          2.00000   ASSEMB         8.00000
    CABINET   FINISH         8.00000   PROFIT       -84.00000
    BOOKCSE   STAMP          2.00000   ASSEMB         7.00000
    BOOKCSE   FINISH         7.00000   PROFIT       -76.00000
RHS
    TIME      STAMP        800.00000   ASSEMB       1200.0000
    TIME      FINISH       800.00000
RANGES
    T1        ASSEMB       900.00000
BOUNDS
 UP BND       CHAIR         75.00000
 LO BND       BOOKCSE       50.00000
ENDATA

*/


/***************************************************************
 *                                                             *
 *  Example 3: Free-MPS-Format File                            *
 *                                                             *
 * The following (excluding the comment indicators) should be  *
 * saved in a text file named "example_free.mps" for Example 4 *
 * to work.                                                    *
 *                                                             *
 ***************************************************************/


/*

* THIS IS AN EXAMPLE FOR FREE MPS FORMAT.
NAME          PROD_MIX  FREE
ROWS
 N  PROFIT
    L  STAMP
    L  ASSEMB
    L  FINISH
COLUMNS
 DESK       STAMP    3.00000   ASSEMB      10.00000
 DESK       FINISH   10.00000    PROFIT   -95.00000
    CHAIR   STAMP    1.50000   ASSEMB      6.00000
    CHAIR   FINISH   8.00000     PROFIT   -41.00000
 CABINET    STAMP    2.00000   ASSEMB      8.00000
 CABINET    FINISH   8.00000     PROFIT   -84.00000
    BOOKCSE STAMP    2.00000   ASSEMB      7.00000
    BOOKCSE FINISH   7.00000     PROFIT   -76.00000
RHS
    TIME STAMP   800.00000  ASSEMB 1200.0000
    TIME FINISH  800.00000
RANGES
    T1   ASSEMB   900.00000
BOUNDS
 UP BND     CHAIR 75.00000
 LO BND   BOOKCSE 50.00000
ENDATA

*/


/***************************************************************
 *                                                             *
 *  Example 4: Using the Macro Function %MPS2SASD              *
 *                                                             *
 * The comment block needs to be removed to run the macro      *
 * calls.                                                      *
 *                                                             *
 ***************************************************************/


/*

%mps2sasd(mpsfile='example_fix.mps');
proc print data=mpsdata;
run;


%mps2sasd(mpsfile='example_free.mps');


%mps2sasd(mpsfile='example_free.mps', maxlen=10, format=free);


%mps2sasd(mpsfile='example_fix.mps', outdata=PRODMIX);

*/