Maximum Diversified Porfolio (MDP) fmincon optimization problem doesn't work

3 ビュー (過去 30 日間)
Leonardo Coccia
Leonardo Coccia 2021 年 7 月 5 日
コメント済み: Alan Weiss 2021 年 7 月 9 日
Goodmorning to all,
I have to solve the following problem (image) with fmincon: x is the portfolio weight vector, sigma the std. dev. of returns, omega cov matrix. I tried as follow but doesn't work. Thanks to everyone!
Aeq = ones(1,n_asset);
beq = 1;
x0 = zeros(1,n_asset);
lb = zeros(1,n_asset);
ub = ones(1,n_asset);
fun = @(x) -(x)*(sqrt(variance))./sqrt((x')*Cov(x))
w = -fmincon(fun,x0,[],[],Aeq,beq,lb,ub)
  2 件のコメント
Alan Weiss
Alan Weiss 2021 年 7 月 6 日
What was the error that fmincon returned? What are the dimensions of x, variance, and Cov? Is Cov(x) a function, or did you mean to write x*Cov*x'?
Alan Weiss
MATLAB mathematical toolbox documentation
Leonardo Coccia
Leonardo Coccia 2021 年 7 月 7 日
Hi, the error is in the screenshot. x is the portfolio that has 12 assets weights (12zx1), variance is 12x1, Cov is a 12x12 covariance matrix and Cov(x) is Cov*x but doesn't work even if I delete parenthesis. And yes, I meant x*Cov*x' but doesn't work. I don't know even how to set x0 ...
Thanks in advance!

サインインしてコメントする。

回答 (1 件)

Alan Weiss
Alan Weiss 2021 年 7 月 8 日
You say that x is 12-by-1, yet you write x0 as 1-by-12. That could be the problem. Try
x0 = zeros(n_asset,1); % Now x0 is 12-by-1, and so is x
You then need to change your definition of the objective.
fun = @(x) -(sqrt(variance)'*x)/sqrt(x'*Cov*x);
Alan Weiss
MATLAB mathematical toolbox documentation
  2 件のコメント
Leonardo Coccia
Leonardo Coccia 2021 年 7 月 9 日
Thanks very much Alan! Now it seems to work properly. Thanks again
Alan Weiss
Alan Weiss 2021 年 7 月 9 日
I'm glad that my suggestions helped. Please accept the answer.
Alan Weiss
MATLAB mathematical toolbox documentation

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver 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