(weight) constraint within constraint using fmincon
显示 更早的评论
I'm at the moment doing some optimal asset allocation while using fmincon.
For example if I have 8 assets, I use
max_alloc=[1;1;0.5;1;1;1;1;1];
as upper bound constraint which shows that the maximum allocation in every asset can be 100% besides the third which is capped at 50%. However, I would like to add an extra constraint which makes the cap on the fourth asset dependable on the max cap of the third asset.
Like,
if weights(3,1)>0.3
weights(4,1)<0.2
end
How do I add this in my fmincon function? Since my upperbound is just a 8x1 vector.
2 个评论
Sargondjani
2012-5-10
it looks non-differentiable to me. fmincon assumes differentiability of the constraint.
you could either:
1. see if the constraint would bind, and if so implement the constraint
2. replace the constraint with a differentiable constraint, for instance on the sum of the weigths of 3 and 4. That seems more sensible to me: i mean, if w3=0.3 then w4 can be 0.5 and when w3 goes to 0.30001 then w4 is forced to 0.2. That doesnt seem proper risk management to me...
DankoJones
2012-5-16
回答(2 个)
John D'Errico
2012-5-10
0 个投票
Then these are not simple bound constraints, are they?
That would make them inequalities. Can you write down what the form of what that relationship is? Is it linear? Is it nonlinear?
If it is not even differentiable, then fmincon cannot be used.
John
类别
在 帮助中心 和 File Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!