$TITLE   A QUADRATIC PROGRAMMING MODEL FOR PORTFOLIO ANALYSIS
$OFFUPPER
*  This formulation is described in 'GAMS/MINOS: Three examples'
*  by Alan S. Manne, Department of Operations Research, Stanford
*  University, May 1986.

  
 SETS  
       I  SECURITIES   /HARDWARE, SOFTWARE, SHOW-BIZ, T-BILLS/


 ALIAS (I,J)


 SCALAR  TARGET    TARGET MEAN ANNUAL RETURN ON PORTFOLIO (%)   /10/


 PARAMETERS  MEAN(I)  MEAN ANNUAL RETURNS ON INDIVIDUAL SECURITIES (%)

      /HARDWARE   8
       SOFTWARE   9
       SHOW-BIZ  12
       T-BILLS    7 /

 TABLE V(I,J)  VARIANCE-COVARIANCE ARRAY (%-SQUARED ANNUAL RETURN)

                  HARDWARE  SOFTWARE  SHOW-BIZ  T-BILLS

       HARDWARE      4         3         -1        0
       SOFTWARE      3         6          1        0 
       SHOW-BIZ     -1         1         10        0
       T-BILLS       0         0          0        0

 VARIABLES  X(I)       FRACTION OF PORTFOLIO INVESTED IN ASSET I
            VARIANCE   VARIANCE OF PORTFOLIO

 POSITIVE VARIABLE X; 
  
 EQUATIONS  FSUM    FRACTIONS MUST ADD TO 1.0
            DMEAN   DEFINITION OF MEAN RETURN ON PORTFOLIO
            DVAR    DEFINITION OF VARIANCE;
  
 FSUM..     SUM(I, X(I))                     =E=  1.0  ; 
 DMEAN..    SUM(I, MEAN(I)*X(I))             =E=  TARGET;
 DVAR..     SUM(I, X(I)*SUM(J,V(I,J)*X(J)))  =E=  VARIANCE;
  
 MODEL PORTFOLIO  /ALL/ ;
  
 SOLVE PORTFOLIO USING NLP MINIMIZING VARIANCE;

