Resources

Linear Assignment Problem for Minimizing Swim


/***************************************************************/
/*                                                             */
/*          S A S   S A M P L E   L I B R A R Y                */
/*                                                             */
/*    NAME: onete03                                            */
/*   TITLE: Linear Assignment Problem for Minimizing Swim      */
/*          Times                                              */
/* PRODUCT: OR                                                 */
/*  SYSTEM: ALL                                                */
/*    KEYS: OR                                                 */
/*   PROCS: OPTNET, PRINT                                      */
/*    DATA:                                                    */
/*                                                             */
/* SUPPORT:                             UPDATE:                */
/*     REF:                                                    */
/*    MISC: Example 3 from the OPTNET documentation.           */
/*                                                             */
/***************************************************************/

data RelayTimes;
   input name $ sex $ back breast fly free;
   datalines;
Sue     F 35.1 36.7 28.3 36.1
Karen   F 34.6 32.6 26.9 26.2
Jan     F 31.3 33.9 27.1 31.2
Andrea  F 28.6 34.1 29.1 30.3
Carol   F 32.9 32.2 26.6 24.0
Ellen   F 27.8 32.5 27.8 27.0
Jim     M 26.3 27.6 23.5 22.4
Mike    M 29.0 24.0 27.9 25.4
Sam     M 27.2 33.8 25.2 24.1
Clayton M 27.0 29.2 23.0 21.9
;

data RelayTimesF RelayTimesM;
   set RelayTimes;
   if      sex='F' then output RelayTimesF;
   else if sex='M' then output RelayTimesM;
run;

proc optnet
   data_matrix = RelayTimesF;
   linear_assignment
      out      = LinearAssignF
      id       = (name sex);
run;
%put &_OROPTNET_;
%put &_OROPTNET_LAP_;

proc optnet
   data_matrix = RelayTimesM;
   linear_assignment
      out      = LinearAssignM
      id       = (name sex);
run;
%put &_OROPTNET_;
%put &_OROPTNET_LAP_;

proc print data=LinearAssignF noobs label;
   sum cost;
run;

proc print data=LinearAssignM noobs label;
   sum cost;
run;