qp4.gms : Standard QP Model - no covariance matrix

Description

Instead of using the covariances, but operate
directly on the data. Additional information can be found at:

http://www.gams.com/modlib/adddocs/qp4doc.htm


Small Model of Type : NLP


Category : GAMS Model library


Main file : qp4.gms   includes :  qpdata.inc

$title Standard QP Model - no Covariance Matrix (QP4,SEQ=174)

$onText
Instead of using the covariances, but operate
directly on the data. Additional information can be found at:

http://www.gams.com/modlib/adddocs/qp4doc.htm


Kalvelagen, E, Model Building with GAMS. forthcoming

de Wetering, A V, private communication.

Keywords: nonlinear programming, quadratic programming, finance
$offText

$include qpdata.inc

Set
   d(days)   'selected days'
   s(stocks) 'selected stocks';

Alias (s,t);

* select subset of stocks and periods
d(days)   = ord(days) > 1 and ord(days) < 31;
s(stocks) = ord(stocks) < 51;

Parameter
   mean(stocks)     'mean of daily return'
   dev(stocks,days) 'deviations'
   totmean          'total mean return';

mean(s)  = sum(d, return(s,d))/card(d);
dev(s,d) = return(s,d) - mean(s);
totmean  = sum(s, mean(s))/(card(s));

Variable
   z         'objective variable'
   x(stocks) 'investments'
   w(days)   'intermediate variables';

Positive Variable x;

Equation
   obj    'objective'
   budget
   retcon 'return constraint'
   wdef(days);

obj..     z =e= sum(d, sqr(w(d)))/(card(d) - 1);

wdef(d).. w(d) =e= sum(s, x(s)*dev(s,d));

budget..  sum(s, x(s)) =e= 1.0;

retcon..  sum(s, mean(s)*x(s)) =g= totmean*1.25;

Model qp4 / all /;

solve qp4 using nlp minimizing z;

display x.l;