Maximize expected return with constraints

2 次查看(过去 30 天)
Hi guys, I need help for a really easy maximization.
Max E(r)=(mean vector)*(weight vector)'
I want to max the return by changing the weight vector (variable). The mean vector is constant.
The constraints are : (vector of 1's)*(weight vector)' = 1 %weights sum to 1
lb wi >= 0
ub wi =< 1
The solution should give me the Max E(r) and the corresponding (weight vector).
Thank you.

采纳的回答

Torsten
Torsten 2014-11-14
f=-[0.0055; 0.0063; 0.0080; 0.0060; 0.0037; 0.0035; -0.0028; 0.0071; 0.0055; 0.0028];
Aeq=[1 1 1 1 1 1 1 1 1 1];
beq=[1];
lb=zeros(10,1);
ub=ones(10,1);
x = linprog(f,[],[],Aeq,beq,lb,ub);
does not work ?
Best wishes
Torsten.
  1 个评论
Marcel
Marcel 2014-11-14
Thank you Torsten. That's basically it. My failure was that I wrote the variable x into the function, which didn't work.

请先登录,再进行评论。

更多回答(4 个)

John D'Errico
John D'Errico 2014-11-14
You want to maximize a linear objective function of the weights, subject to a linear equality constraint (that the weights sum to 1) as well as lower (0) and upper (1) bound constraints.
This is just a linear programming problem, and a basic, virtually trivial one at that.
help linprog
If you lack the optimization toolbox, then you will find something on the file exchange.

Marcel
Marcel 2014-11-14
I know that it is very basic and trivial. When I put it in the Optimization toolbox it calculates E(r) with equal weights (that is 0,1 with 10 assets) and gives me wi=0,1.
But it should give me a weight vector(n=10) that maximizes E(r).
I just don't know how to program that.

Torsten
Torsten 2014-11-14
If the mean vector has the same entries at all positions, then the answer is correct ...
Best wishes
Torsten.

Marcel
Marcel 2014-11-14
That is right.
But: m = [0,0055 0,0063 0,0080 0,0060 0,0037 0,0035 -0,0028 0,0071 0,0055 0,0028] w = [w1 w2 w3 w4 w5 w6 w7 w8 w9 w10]
I know that the max E(r) is 0,0080 and the vector must be w=[0 0 1 0 0 0 0 0 0 0] , but I want Matlab to calculate that.

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by