# Conservative Short Sales Portfolio Optimization with MatLab code help

I'm trying to solve the optimization problem below with MatLab, but I'm unsure of how to modify the constraints in the quadprog function (or how to add the constraints with the Portfolio object).

In the formulation below, omega is the weight of the asset in the portfolio (which we are trying to find). The capital sigma is the covariance matrix of asset returns. mu is the expected return. delta is the maximum allowed deviation of the expected return of an asset i, from an estimated value mu(i). gamma is a bound for the amount of shorting allowed. l and h are lower and upper limits for the weights.

The problem is trying to find the optimal portfolio with weights between l and h y considering only the worst outcome for the amount of short positions that exceed gamma.

• Put $\omega_+$ and $\omega_-$ into a single vector x, then convert the bound constraints, inequality constrains, and equality constraints into the form required by quadprog mathworks.com/help/optim/ug/quadprog.html . I.e., determine what A, b, Aeq, beq, lb, and ub need to be. This is very straightforward. Jun 11 '16 at 0:58
• Thank you. I'm sorry if this is going to sound as a naive question, but I'm a finance student with no programming experience (have been exposed to very basic MatLab for the past 4 weeks). Could you walk me through how to set up the x and A matrices? I'm having some issues with the dimensions. Jun 12 '16 at 6:30
• @MarkL.Stone my question is how I would set up the x matrix in this case. Would it just be a vector with the weights as expressed by the mathematical formulation? (x=w+-w_-gamma). Also, how can I incorporate the delta part into matrix A, since this matrix must follow specific dimensions? Jun 12 '16 at 7:28