Linear objective with quadratic constraint
2 次查看(过去 30 天)
显示 更早的评论
Hey guys!
I'm trying to solve a portfolio optimization problem with a maximum return strategy, which implies that I try to maximize the return for a given level of std.deviation. As far as I know this kind of problem involves Fmincon as optimizer.
I have used the following set up but i'm facing some challenges; http://se.mathworks.com/help/optim/ug/linear-or-quadratic-problem-with-quadratic-constraints.html?refresh=true
I would like to maximize the portfolio return s.t. to a given level of std. deviation, therefore I have done the following:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161520/image.png)
I've set Q=zero(2,2) (as I have a portfolio of two assets) and c = zero(1,1) which implies that I end up with the problem to minimize f'x (which should be negative in order to maximize it). In my constraint I have set k equal to zero and d equal to minus my maximum level of daily std. deviation.
This should as far is i'm aware do the job, but when I try to run the optimization I get the following error message:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161522/image.png)
As far as i'm aware my dimension should be fine, as my f vektor is a 2x1 which is transposed and therefor f'x is 1x1. H is a 2x2 and x should be a 2x1, which should imply that the dimension in the constraint should be fine.
I would really appreciate if someone could point out where the error lies.
I could poste the entire code, but I thought that it would be to much and that's why I referred to the link above.
Best regards,
Kristian Lunow Nielsen
0 个评论
回答(2 个)
Torsten
2016-4-18
Take a look at the documentation of fmincon about the form of the functions "fun" and "nonlconstr".
Best wishes
Torsten.
0 个评论
Steve Grikschat
2020-9-18
As of R2020b, Optimization Toolbox now has a dedicated solver for second-order cone programming, which can be used to solve quadratic constrained problems.
https://www.mathworks.com/help//optim/ug/convert-qp-to-socp.html
Function reference:
coupled with a function to make a second-order cone constraint
For an example see
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!