Help with the function fmincon for optimizing a portfolio
2 次查看(过去 30 天)
显示 更早的评论
Hi. Simple Q ...
I'm optimizing the weights in the DOW30 for that past 100 weeks (a 100x30 matrix). The constraints are that each of the constituent weights has to be between 0 and 1 AND the total of the 30 weights = 1. Simple.
I'm having a hard time understanding the arguments passed to fmincon. X0,A,B,Aeq,Beq. I get that UB=1, LB=0. But which argument caps the total weight to 1? And which arguments do I not use?
Thanks a ton.
0 个评论
采纳的回答
Walter Roberson
2017-1-4
Use Aeq = ones(1,number_of_variables) and beq = 1 and lb = zeros(1, number_of_variables) and ub = ones(1, number_of_variables) and A empty and b empty
This will express that the sum of 1 times each of the variables, must exactly total 1
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!