Robust Markowitz Problem

74 views
Skip to first unread message

Lissi

unread,
Aug 6, 2013, 2:13:57 PM8/6/13
to yal...@googlegroups.com
Hello again!

I have a problem concerning the robust markowitz implementation. Usually, there are two uncertainty sets over the return vector and the covariance matrix considered. But in this case I am using an uncertainty set over the return vector and the second moment Gamma instead of Sigma. I should look like:  gamma_l <= Gamma <= gamma_u.
Anyhow when I try to implement the uncertainty set over Gamma I get the result: matrix badly scaled. I tried to implement it the way on the page of the lyaponuv function. That way the uncertainty isn't in the Gamma-matrix, but in the matrix B. What did I do wrong?
Sorry, I am bothering again, but I simply don't know what to do.

       
% test data
mu_t = [0.05; 0.11; 0.16; 0.16];
Cor_t =     [1.0 0.1 0.7 -0.1;
            0.1 1.0 -0.2 0.4;
            0.7 -0.2 1.0 0.3;
            -0.1 0.4 0.3 1.0];
       
Sigma_t = [ 0.025 0.00055 0.0056 0.00125;
            0.00055 0.0121 -0.00352 0.011;
            0.0056 -0.00352 0.0256 0.012;
            0.00125 0.011 0.012 0.027];
 
% definition of the constants
ab = 0.05;
n = length(mu_t);
R = mean(mu_t);

    % upper and lower bound for Sigma
    Sigma_l = Sigma_t - ab*Sigma_t;
    Sigma_u = Sigma_t + ab*Sigma_t;

    % upper and lower bound for mu
    mu_l = mu_t - ab*mu_t;
    mu_u = mu_t + ab*mu_t;
   
    % upper and lower bound for Gamma
    Gamma_t = Sigma_t + mu_t*mu_t';
    Gamma_l = Sigma_l + mu_l*mu_l';
    Gamma_u = Sigma_u + mu_l*mu_l';
   
% Definition of the variables
Gamma = sdpvar(n,n);
w = sdpvar(n,1);
mu = sdpvar(n,1);
sdpvar t;

% Definition of the variables (full matrix variables)
Gammahat = [Gamma, w; w', 1];
Muhat = [mu*mu', mu; mu', 1];
What = [w*w', w; w', 1];
       
%constraints on the portfolio
        W = [sum(w) == 1, w >= 0, mu'*w >= R];

 % uncertainty set over mu
        M = [mu_l <= mu <= mu_u, uncertain(mu)];
       
 % uncertainty set over Gamma
        sdpvar tau;
        B1 = zeros(4,4);
        B1(1,1) = 1/tau;
        G = [-1 <= trace(B1'*Gamma) <= 1];
        G = [tau <= -Gamma_l(1,1), tau <= Gamma_u(1,1), uncertain(tau)];
 

%objective funvtion
        objective = w'*(Gamma-mu*mu')*w;

% solving the problem
        solvesdp( [W, M, G,objective <= t], t);
        double(w)






 








Johan Löfberg

unread,
Aug 6, 2013, 2:35:38 PM8/6/13
to yal...@googlegroups.com
You are on deep water when you use the robustification framework without an understanding of what is done when a robust counterpart is derived. You should really first convince your self that the model you have fits into one of the scenarios supported, explained in my "Automatic Robust Optimization" paper.

Here, it is does not match any of the standard setups. To begin with, the uncertainty cannot enter the model squared, multiplied with another squared term (w'*mu*mu'*w). Since this term cannot be handled, YALMIP simply tries to eliminate it from the model. This is what you see here

" - Complicating terms in w encountered. Trying to eliminate by forcing some decision variables to 0"

I guess YALMIP essentially adds the constraint w=0. The model is still nasty though, for instance due to the inverse of tau entering Bl. The final model boils down to an ugly nonlinear model which is thrown at fmincon, which claims the model is infeasible (which it is after having introduced w=0)

Johan Löfberg

unread,
Aug 6, 2013, 3:29:05 PM8/6/13
to yal...@googlegroups.com
BTW, this


B1 = zeros(4,4);
B1
(1,1) = 1/tau;

is not valid code. See here
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Extra.NANInModel

Lissi

unread,
Aug 7, 2013, 7:26:56 AM8/7/13
to yal...@googlegroups.com
Thanks for the fast reply.
Reply all
Reply to author
Forward
0 new messages