MODEL:
  ! Scenario  model, Match 1st asset     (PortScenMatch);
! Keywords: Hedging, Markowitz, Matching, Portfolio optimization, Scenario method;
  ! Minimize the variance;
SETS:
    SCENE: PRB, R, DVU, DVL;
    ASSET:  X;
    SXA( SCENE, ASSET): VE;
   ENDSETS
DATA: SCENE= 1..12; ASSET= SP500 ATT GMT USX; ! Data based on original Markowitz example; VE = 1.258997 1.3 1.225 1.149 1.197526 1.103 1.29 1.26 1.364361 1.216 1.216 1.419 0.919287 0.954 0.728 0.922 1.05708 0.929 1.144 1.169 1.055012 1.056 1.107 0.965 1.187925 1.038 1.321 1.133 1.31713 1.089 1.305 1.732 1.240164 1.09 1.195 1.021 1.183675 1.083 1.39 1.131 0.990108 1.035 0.928 1.006 1.526236 1.176 1.715 1.908; ! All scenarios happen to be equally likely; PRB= .0833333 .0833333 .0833333 .0833333 .0833333 .0833333 .0833333 .0833333 .0833333 .0833333 .0833333 .0833333; ! The desired return; TARGET = 1.191458; ENDDATA ! Minimize risk; [OBJ] MIN = @SUM( SCENE: PRB * ( DVL + DVU) ^ 2); ! Compute portfolio value under each scenario; @FOR( SCENE( S): R( S) = @SUM( ASSET( J)| J #GT# 1: VE( S, J) * X( J)); ! Measure deviations of portfolio from benchmark; DVU( S) - DVL( S) = ( R(S) - VE( S, 1)); ); ! Budget constraint(applies to remaining assets); [BUDGET] @SUM( ASSET( J)| J #GT# 1: X( J)) = 1; ! Compute expected value of ending position; [DEFAVG] AVG = @SUM( SCENE: PRB * R); ! Target ending value; [RET] AVG > TARGET; END