Portfolio Sharpe opt with ismember constraints

42 views
Skip to first unread message

Tal Shir

unread,
May 6, 2015, 5:45:17 AM5/6/15
to yal...@googlegroups.com
Hello,
Using your advise I transformed the Sharpe ratio maximization to a linear eq. The problem I seems to have is that in this case adding a ismember constraint don't do the job.

z = sdpvar(N,1);
d = binvar(N,1);  

Sharpe = [0 <= z, z'*(r) == 1]
 Sharpe=Sharpe+ismember(z,sum(z)*(0:0.1:1)) 

I'm getting
Error using lmi/plus (line 25)
Both arguments must be constraints

Any idea of how to work around this?

Thanks a lot,
Tal


Johan Löfberg

unread,
May 6, 2015, 6:06:23 AM5/6/15
to yal...@googlegroups.com
nfortunately ismember(sdpvar,sdpvar)  is not a modelling construct but a low level check to see if a varaible appears among the others (i.e. it returns a list of true/false)
You have to implement it manually, which is rather simple by defining a binary matrix T where T(i,j) says that variable i uses the prescribed ratio j

N = 10;
M = 11;
z = sdpvar(N,1);
d = binvar(N,1);  
r = rand(N,1)
Sharpe = [0 <= z, z'*(r) == 1]
T = binvar(N,M,'full');
levels = linspace(0,1,M);
Sharpe = [Sharpe, implies(T,repmat(z,1,M) == sum(z)*repmat(levels,N,1))];
Sharpe = [Sharpe, sum(T,2)==1]
Q = randn(N);Q=Q*Q';
optimize(Sharpe,z'*Q*z)
value(z)/value(sum(z))


Reply all
Reply to author
Forward
0 new messages