How to assign a count constraint to linear optimization
Show older comments
Hi There !
I am relatively new to optimization toolbox.
I want to use linear optimizer linprog to setup a linear portfolio weighting problem. I can setup all constraints but cannot setup the constraint that minimum number of variables that need to be used are 120.
In this case, I want to optimize the weights of the securities in the portfolio but also ensure atleast 120 securities are used. Should I use a nonlinear optimizer with a constraint objective function or am I missing something and there is a clever way to code this into a linear optimization ?
Can someone please help ?
Regards, Abhishek
4 Comments
Abhishek BANERJEE
on 18 Feb 2013
No, that won't work because Xn>=0 also means that Xn can equal 0, i.e., not be used. The constraint you really want is Xn>0 and this leads to an ill-defined problem. much like minimizing the 1D function f(x)=x on x>0.
Incidentally, you would not use the rows of the inequality constraints to enforce Xn>=0. You would use LINPROG's 6th input argument lb.
Abhishek BANERJEE
on 19 Feb 2013
Edited: Abhishek BANERJEE
on 20 Feb 2013
Matt J
on 20 Feb 2013
My point was only that the way to enforce constraints of the form lb<=x<=ub is NOT with the arguments A,b.
Accepted Answer
More Answers (0)
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!