Cannot get started...

105 views
Skip to first unread message

zwei

unread,
Jul 31, 2013, 1:02:18 PM7/31/13
to yal...@googlegroups.com
Hi,

I am completely new at this so please forgive me if I ask any stupid questions.

I installed YALMIP and added all the required folders into my path directory, but when I get this:

x = sdpvar(2,1);
??? Error using ==> superiorto
Function 'SUPERIORTO' can only be called from within a method.

Error in ==> sdpvar at 52
superiorto('double');

Any idea what I should do next?

Thanks in advance!




Johan Löfberg

unread,
Jul 31, 2013, 2:23:04 PM7/31/13
to yal...@googlegroups.com
Which MATLAB version?

Which YALMIP version?

what is returned when you run "which sdpvar -all"

zwei

unread,
Jul 31, 2013, 3:25:07 PM7/31/13
to yal...@googlegroups.com
Thanks for your fast reply. I cannot run the code now, since my matlab is only installed in my office and I am at home.:(

My matlab version is R2008b 7.7

My YALMIP version is YALMIP R20130405.

I guess this is the reason. I should have used YALMIP R2008____ series to be compatible for my matlab version, right?

Another question, is a solver really necessary, if all I need is to use sdpvar and sdpsolve (already in YALMIP I suppose) like in one of the threads earlier on about robust markowitz model.

I quote Lissa"

I' m trying to implement a robust version of the markowitz model, but I have problems and various errors. I think my code is too simple. I tried to rewrite various times, but honestly I don't know what to change anymore.
I hope somebody could take a look at it and give me a hint. Perhaps I'm understanding the way yalmip works wrong,

% Test data
mu_t = [0.05; 0.11; 0.16; 0.25];
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.0625];

% Calculation of mu for the box contraint
mu_l = mu_t - 0.05*mu_t; 
mu_u = mu_t + 0.05*mu_t;

% Calculation of Sigma for the box constraint
Sigma_l = Sigma_t - 0.05*Sigma_t; 
Sigma_u = Sigma_t + 0.05*Sigma_t;

n = length(mu_t);
w = sdpvar(n,1);
mu = sdpvar(n,1); 

sdpvar t1 t2 t3 t4
Sigma =     [t1, Sigma_t(1,2), Sigma_t(1,3), Sigma_t(1,4);
            Sigma_t(2,1), t2, Sigma_t(2,3), Sigma_t(2,4);
            Sigma_t(3,1), Sigma_t(3,2), t3, Sigma_t(3,4);
            Sigma_t(4,1), Sigma_t(4,2), Sigma_t(4,3), t4];

lambda = 0.5;

% constraints on the portfolio
W = [sum(w) == 1, w >= 0];

% Uncertainty set over the return vector - Box Constraint
M = [mu_l <= mu <= mu_u, uncertain(mu)]; 

% Uncertainty set over the covariance matrix - box constraint
S = [Sigma_l(1,1)<= t1 <= Sigma_u(1,1),
    Sigma_l(2,2)<= t2 <= Sigma_u(2,2),
    Sigma_l(3,3)<= t3 <= Sigma_u(3,3),
    Sigma_l(4,4)<= t4 <= Sigma_u(4,4),
    uncertain(t1), uncertain(t2), uncertain(t3), uncertain(t4)];



% objective function
objective = lambda*w'*Sigma*w - mu'*w;
solvesdp(W + S + M, objective)

solution = double(w)


Thanks!
Lissi

"
Thanks for your advice! Sorry that I am really a newbie at this!!

Johan Löfberg

unread,
Jul 31, 2013, 3:27:32 PM7/31/13
to yal...@googlegroups.com
You should always run the most recent version.

My guess is that you have changed the installation structure and somehow placed class definition files and methods (such as sdpvar.m outside the class directory yalmip/@sdpvar etc). 

Johan Löfberg

unread,
Jul 31, 2013, 3:29:08 PM7/31/13
to yal...@googlegroups.com
You always need a solver. YALMIP does not have any built-in solver.

zwei

unread,
Jul 31, 2013, 4:03:19 PM7/31/13
to yal...@googlegroups.com
Hi,

This means I need to install matlab r2013?

What solver do I need to use if say i want to solve the robust markowitz model above.

How is the solver used in conjunction with YALMIP. Where do I install it( inside YALMIP folder or outside?) and what do I do after downloading a solver.


zwei

unread,
Jul 31, 2013, 4:06:30 PM7/31/13
to yal...@googlegroups.com
Oh yes, yes i placed sdpvar.m outside yalmip/@sdpvar. I will put it back in. 

I suppose we do not need to add yalmip/@sdpvar into our directory, right? I do not see it in the installation instructions.

Sorry I need a step by step instruction to get this started.

Thanks and sorry for the inconvenience caused!

Johan Löfberg

unread,
Jul 31, 2013, 4:07:38 PM7/31/13
to yal...@googlegroups.com
No, you can use pretty much any MATLAB version, but should always use the latest YALMIP version (why use an old?)

You need an SDP solver such as SDPT3 or SeDuMi

You install the solver to its own directory and add it to the path.


Johan Löfberg

unread,
Jul 31, 2013, 4:09:43 PM7/31/13
to yal...@googlegroups.com

zwei

unread,
Jul 31, 2013, 4:31:28 PM7/31/13
to yal...@googlegroups.com
Great! I will install the solver the way you described when I get to office. Thanks for your help and hope you have a good day!
Reply all
Reply to author
Forward
0 new messages