! Preemptive Goal programming ( GoalProgBike)
illustration based on example in Lawrence and Pasternack,
Applied Management Sciences;

! Keywords: Goal Programming, Preemptive Criteria;

SUBMODEL GOALP:
! Variables:
   X1 = number of B2 (tandem) bicycles produced,
   X2 = number of S10 (10 speed) bicycles produced
   Ui = under achievement of goal,
   Ei = excess achievement of goal;

! Hard constraints;
!  Seat limitation;
     2*X1      + X2 <= 2000;
!  Gear assemblies;
                 X2 <= 1000;
!  Tires available;
     2*X1    + 2*X2 <= 2400;

! Soft constraints;
!  Priority 1: Produce at least 400 B2 cycles;
       X1           + U1 - E1 = 400;

!  Priority 2: Produce at least 1000 cycles;
       X1      + X2 + U2 - E2 = 1000;

!  Priority 3: ( Two weighted criteria),
     Profit close to 100 ( in 1000's);
  0.04*X1 + 0.10*X2 + U31 - E31 = 100; 
! Use no more than 1600 hours of labor;
     2*X1    + 3*X2 + U32 - E32 = 1600;

!  Priority 4: (Two weighted criteria)
    Use no more than 2200 tires;
    2*X1     + 2*X2 + U41 - E41 = 2200;
!  Use no more than 900 gear assemblies;
                 X2 + U42 - E42 = 900;

! Define the goals;
  V1 = U1;
  V2 = U2;
  V3 = 30*U31 + E32;
  V4 = E41 + 2*E42;

! In Preemptive Goal Programming, we will
  successively put bounds on the goals;
  V1 <= UB1;
  V2 <= UB2;
  V3 <= UB3;
  V4 <= UB4;

! Minimize a selectively weighted sum of the goals;
 MIN = WGT1*V1 +WGT2*V2 + WGT3*V3 + WGT4*V4; 

ENDSUBMODEL
CALC: BIGM = 9999999; ! Initially no bounds on the goals; UB1 = BIGM; UB2 = BIGM; UB3 = BIGM; UB4 = BIGM; ! And all the weight is on priority 1 goal; WGT1 = 1; WGT2 = 0; WGT3 = 0; WGT4 = 0; @set('TERSEO',2); !Turn off default output; ! Optimize goal 1; @SOLVE( GOALP); @WRITE('Priority X1 X2 V1 V2 V3 V4',@NEWLINE(1)); @WRITE( ' 1: ', @FORMAT( X1,'8.2F'),@FORMAT( X2,'8.2F'), @FORMAT( V1,'8.2F'), @NEWLINE(1)); ! Optimize goal 2; UB1 = V1; ! Cannot do worse on priority 1; WGT1 = 0; WGT2 = 1; ! Now put weight on priority 2 goal; @SOLVE( GOALP); @WRITE( ' 2: ',@FORMAT( X1,'8.2F'),@FORMAT( X2,'8.2F'), @FORMAT( V1,'8.2F'),@FORMAT( V2,'8.2F'),@NEWLINE(1)); ! Optimize goal 3; UB2 = V2; WGT2 = 0; WGT3 = 1; @SOLVE( GOALP); @WRITE( ' 3: ',@FORMAT( X1,'8.2F'),@FORMAT( X2,'8.2F'), @FORMAT( V1,'8.2F'),@FORMAT( V2,'8.2F'), @FORMAT( V3,'8.2F'),@NEWLINE(1)); ! Optimize goal 4; UB3 = V3; WGT3 = 0; WGT4 = 1; @SOLVE( GOALP); @WRITE( ' 4: ',@FORMAT( X1,'8.2F'),@FORMAT( X2,'8.2F'), @FORMAT( V1,'8.2F'),@FORMAT( V2,'8.2F'), @FORMAT( V3,'8.2F'),@FORMAT( V4,'8.2F'),@NEWLINE(1)); ENDCALC