MODEL:
!Generic Markowitz portfolio Hedging model   (PortHedge);
! We want to hedge the first or "benchmark" asset
  with the remaining ones;
! Keywords: Hedging, Markowitz, Portfolio optimization;
SETS:
  ASSET: RET, X;
  TMAT( ASSET, ASSET) | &1 #GE# &2: COV;
 ENDSETS
DATA: ASSET= GMC ATT USX; ! The expected returns; RET = 1.21367, 1.089083, 1.23458; ! Covariance matrix; COV = .05839170 .01240721 .01080754 .05542639 .01307513 .09422681; ! The desired return; TARGET = 1.15; ENDDATA !-------------------------------------------------; ! Min the var in portfolio return; [OBJ] MIN= ( @SUM( ASSET( I): COV( I, I) * X( I)^2) + 2 * @SUM( TMAT( I, J) | I #NE# J: COV( I, J) * X( I) * X( J))) ; !We are stuck with the first asset in the portfolio; X( 1) = 1; ! Budget constraint(applies to remaining assets); [BUDGET] @SUM( ASSET( I)| I #GT# 1: X( I)) = 1; ! Return requirement(applies to remaining assets); [RETURN] @SUM( ASSET( I)| I #GT# 1: RET( I) * X( I)) >= TARGET; END