Discussion:
Fmincon for -X/Y where Y -> 0
(too old to reply)
M
2012-05-23 23:01:09 UTC
Permalink
I am using FMINCON for portfolio optimization and have a specific objective function that is giving me problems. I suspect it is due to the fact that it is a ratio where the denominator trends towards zero.
The specific formula that I am trying to optimize for is the Information Ratio, defined as:
% Return in excess of benchmark / Tracking Error
ir = - (ret - bmRet) / portTE(weights);
portTE is defined as:
te = 252*(x-cWgt)'*V*(x-cWgt) - TEmax^2;
Where x is the weights (being guessed by FMINCON), cWgt is the benchmark weights, and V is a covariance matrix.
I have constraints on the weights such as none can exceed a certain percentage of the portfolio, etc. so theoretically the portTE will not likely reach 0 (because the benchmark allows bigger weights)... but portTE will get increasingly smaller as the weights converge towards the benchmark weights nonetheless.
When I run the optimization, each iteration shows the result f(x) getting increasingly smaller, but the incremental steps are so large that it does not exit. Then after a certain point, the max constraint violation jumps and it starts showing "unreliable." (Example pasted below).
So... Is this just one of those types of problems that is not suited for FMINCON optimization? Or is this something that can be done and I just need a bit more guidance? Your advice is much appreciated!
Max Line search Directional First-order
Iter F-count f(x) constraint steplength derivative optimality Procedure
0 511 -0.0917309 0.2084 Infeasible start point
1 1022 -8.22854 4.441e-016 1 -132 111
2 1533 -12.3504 8.882e-016 1 -141 312
3 2044 -14.5376 9.992e-016 1 -206 304
4 2556 -18.3135 1.11e-015 0.5 -247 616
5 3068 -19.2534 4.441e-016 0.5 -559 664
6 3580 -43.4084 4.441e-016 0.5 -355 1.66e+003
7 4095 -46.0467 5.551e-016 0.0625 -870 986
8 4609 -66.8587 4.441e-016 0.125 -1.94e+003 1.58e+003
9 5122 -71.1512 2.22e-016 0.25 -1.04e+003 3.47e+003
10 5636 -81.1274 3.331e-016 0.125 -2.21e+003 1.93e+003
11 6155 -81.4471 0.009958 0.00391 -358 1.39e+003 unreliable
12 6675 -84.1157 0.009939 0.00195 -1e+003 2e+003 unreliable
13 7194 -86.1769 0.01128 0.00391 -1.39e+003 6.69e+003 unreliable
14 7714 -91.2555 0.01125 0.00195 -781 3.48e+003 unreliable
Matt J
2012-05-23 23:22:07 UTC
Permalink
Post by M
So... Is this just one of those types of problems that is not suited for FMINCON optimization? Or is this something that can be done and I just need a bit more guidance? Your advice is much appreciated!
===============
Well, the Hessian of ir looks like it could get highly singular as porTE gets smaller, which could cause numerical problems I suppose. It seems that instead of minimizing ir, you could equivalently be minimizing the following simpler function (it varies monotonically with ir)
f(x) = (x-cWgt)'*V*(x-cWgt)
If you have no non-linear constraints, you could even use QUADPROG for this instead, which would take advantage of the quadratic form of f(x).
Johan Löfberg
2012-05-24 07:54:09 UTC
Permalink
Sounds like a variant of Sharpe ratio optimization, which you normally can/should reformulate as QP. (maybe tricky here due to the TEmax^2 term, otherwise it would be exactly Sharpe ratio)
If not, you are correct in the observation that solvers don't like when you divide by things that can move towards zero, either at optimality or during solution process. Simple trick is to reformulate as
maximize t
s.t
(ret - bmRet) > t*portTE(weights)
Post by M
I am using FMINCON for portfolio optimization and have a specific objective function that is giving me problems. I suspect it is due to the fact that it is a ratio where the denominator trends towards zero.
% Return in excess of benchmark / Tracking Error
ir = - (ret - bmRet) / portTE(weights);
te = 252*(x-cWgt)'*V*(x-cWgt) - TEmax^2;
Where x is the weights (being guessed by FMINCON), cWgt is the benchmark weights, and V is a covariance matrix.
I have constraints on the weights such as none can exceed a certain percentage of the portfolio, etc. so theoretically the portTE will not likely reach 0 (because the benchmark allows bigger weights)... but portTE will get increasingly smaller as the weights converge towards the benchmark weights nonetheless.
When I run the optimization, each iteration shows the result f(x) getting increasingly smaller, but the incremental steps are so large that it does not exit. Then after a certain point, the max constraint violation jumps and it starts showing "unreliable." (Example pasted below).
So... Is this just one of those types of problems that is not suited for FMINCON optimization? Or is this something that can be done and I just need a bit more guidance? Your advice is much appreciated!
Max Line search Directional First-order
Iter F-count f(x) constraint steplength derivative optimality Procedure
0 511 -0.0917309 0.2084 Infeasible start point
1 1022 -8.22854 4.441e-016 1 -132 111
2 1533 -12.3504 8.882e-016 1 -141 312
3 2044 -14.5376 9.992e-016 1 -206 304
4 2556 -18.3135 1.11e-015 0.5 -247 616
5 3068 -19.2534 4.441e-016 0.5 -559 664
6 3580 -43.4084 4.441e-016 0.5 -355 1.66e+003
7 4095 -46.0467 5.551e-016 0.0625 -870 986
8 4609 -66.8587 4.441e-016 0.125 -1.94e+003 1.58e+003
9 5122 -71.1512 2.22e-016 0.25 -1.04e+003 3.47e+003
10 5636 -81.1274 3.331e-016 0.125 -2.21e+003 1.93e+003
11 6155 -81.4471 0.009958 0.00391 -358 1.39e+003 unreliable
12 6675 -84.1157 0.009939 0.00195 -1e+003 2e+003 unreliable
13 7194 -86.1769 0.01128 0.00391 -1.39e+003 6.69e+003 unreliable
14 7714 -91.2555 0.01125 0.00195 -781 3.48e+003 unreliable
2 Replies
1 View
Permalink to this page
Disable enhanced parsing
Thread Navigation
M 2012-05-23 23:01:09 UTC