MODEL:
 ! Maximize the Sharpe ratio of a portfolio,
  using the scenario approach for describing randomness.
  A portfolio has a high Sharpe ratio if its expected
  return is high relative to the the risk free rate, but also
has a low standard deviation.
The Sharpe ratio is:
( Avg return of portfolio - Risk free rate)
     /(SD of portfolio);
! Keywords: Portfolio selection, Sharpe ratio, Scenario method;
SETS:
  SCENE: R, DVU, DVL;
  ASSET:  X;
  SXI( SCENE, ASSET): VE;
ENDSETS
DATA: RFRATE= 1.05; ! Risk free growth (1 + riskfree rate); SCENE = 1..12; ! Data based on original Markowitz example; ASSET= ATT GMC USX; ! The ending values for each scenario, all considered equally likely; VE = 1.300 1.225 1.149 1.103 1.290 1.260 1.216 1.216 1.419 0.954 0.728 0.922 0.929 1.144 1.169 1.056 1.107 0.965 1.038 1.321 1.133 1.089 1.305 1.732 1.090 1.195 1.021 1.083 1.390 1.131 1.035 0.928 1.006 1.176 1.715 1.908; ENDDATA NP = @SIZE( SCENE); ! Number of scenarios(observations); @FOR( SCENE( S): ! Compute end value under each scenario of portfolio; R( S) = @SUM( ASSET( J) : VE( S, J) * X( J)); ! Measure deviations up and below average ; DVU( S) - DVL( S) = R(S) - AVGP; ); ! Compute expected value of ending position of portfolio; AVGP = @SUM( SCENE( s): R( s) )/ NP ; ! Budget constraint; @SUM( ASSET(i): X(i)) = 1; ! Variance of portfolio; SD^2 >= @SUM( SCENE( s): ( DVU( s) + DVL(s))^2)/NP; ! Maximize the Sharpe ratio of the portfolio; [OBJ] MAX = (AVGP - RFRATE)/ SD; END