Linear objective with quadratic constraint

7 visualizaciones (últimos 30 días)
Kristian Lunow Nielsen
Kristian Lunow Nielsen el 16 de Abr. de 2016
Respondida: Steve Grikschat el 18 de Sept. de 2020
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 would like to maximize the portfolio return s.t. to a given level of std. deviation, therefore I have done the following:
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:
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

Respuestas (2)

Torsten
Torsten el 18 de Abr. de 2016
Take a look at the documentation of fmincon about the form of the functions "fun" and "nonlconstr".
Best wishes
Torsten.

Steve Grikschat
Steve Grikschat el 18 de Sept. de 2020
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

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by