# Portfolio optimization with non-linear cost

I am trying to solve a mean-variance problem with a non-linear market impact cost term in there. This is the problem I am trying to solve

$$\max_x \left ( \alpha x - \gamma x' \Sigma x - a\sqrt{|x-x_0|} \right ) \quad s.t. \quad \text{unconstrained}.$$

where, $x_0$ is the current portfolio holding.

I am using MATLAB's quadprog program to solve this problem. How can I setup my optimization problem correctly to incorporate the sqrt term in the objective ? I am sure there is a way to do this, but I am not aware of it.

• @MatthewGunn .. I understand that, but the square root function is the most widely used market impact cost model. I was just trying to figure out how practitioners are able to incorporate such a model in a portfolio optimization framework. Maybe they use approximations like a piece-wise linear function ? Jul 30 '18 at 17:20
• What makes an optimization problem easy vs. hard isn't linear vs. non-linear. It's convex vs. non-convex. A starting point may be to use fminunc or fmincon and see if you can get reasonable results. If you have few variables, you can grid search. Jul 31 '18 at 12:27

You're not going to be able to solve it with quadprog because $-x^2 - \sqrt{|x|}$ can't be represented as a quadratic function. While the original problem, $\max_\mathbf{x} \mathbf{a} \cdot \mathbf{x} - \gamma \mathbf{x}'\Sigma \mathbf{x}$ is a convex optimization problem (and convex problems can, in general, be efficiently solved), your problem isn't convex. Your objective for maximization is a sum of a concave and a quasi-convex. You can try using fmincon, but be aware it may give you local rather than global optima. There's reasonable stuff you can do, but it's not a trivial problem to find a global solution.

Side note: why are convex problems easier? For a convex function, a sub-gradient evaluated locally has global implications: you get a global lower bound.

### Example:

Notice the local optima. • I have seen papers (sorry can't find links) which suggest for values close to the solution the cost is linear, rather than square root, which avoids this problem. Very nice answer btw,
– Attack68
Jul 31 '18 at 10:42