!Keyword: portfolio, Markowitz, scenario;
MIN   Y1 + Y2 + Y3 + Y4 + ATT + GMC + USX + MEAN
      + PS1 + PS2 + PS3 + PS4 + PBUD + PDEF + PRET
  SUBJECT TO
! The first order conditions on the Y's
   FY1)   0.5 Y1 + PS1 = 0
   FY2)   0.5 Y2 + PS2 = 0
   FY3)   0.5 Y3 + PS3 = 0
   FY4)   0.5 Y4 + PS4 = 0
! First order conditions on the investments
   FATT) - 0.9851237 PS1 - 1.193042 PS2 - 0.9851237 PS3 
         - 1.193042 PS4 + PBUD + 1.089083 PDEF >= 0
   FGMC) - 1.304437 PS1 - 1.543131 PS2 - 0.8842088 PS3 
         - 1.122902 PS4 + PBUD + 1.213667 PDEF >= 0
   FUSX) - 1.097669 PS1 - 1.756196 PS2 - 1.119948 PS3
         - 0.9645076 PS4 + PBUD + 1.234583 PDEF >= 0
! First order conditions on the mean;
   FMEAN) PS1 + PS2 + PS3 + PS4 - PDEF - PRET >=   0
! Here are the real constraints;
!  Compute the return under each of 4 scenarios;
     S1) Y1 - 0.9851237 ATT - 1.304437 GMC  - 1.097669 USX
         + MEAN = 0
     S2) Y2 - 1.193042 ATT  - 1.543131 GMC  - 1.756196 USX 
         + MEAN = 0
     S3) Y3 - 0.9851237 ATT - 0.8842088 GMC - 1.119948 USX 
         + MEAN = 0
     S4) Y4 - 1.193042 ATT  - 1.122902 GMC - 0.9645076 USX
         + MEAN = 0

! The Budget constraint;
    BUD)   ATT + GMC + USX = 1
! Define or compute the mean;
    DEF) 1.089083 ATT + 1.213667 GMC + 1.234583 USX
         - MEAN = 0
! Target return;
       RET)   MEAN >=   1.15
  END
! The first real constraint starts with row 10;
  QCP=   10


