Set up linear inequality constraints for portfolio weights
obj = setInequality(obj,AInequality,bInequality)
obj = setInequality(obj,AInequality,bInequality) sets up linear inequality constraints for portfolio weights.
Given a linear inequality constraint matrix AInequality and vector bInequality, every weight in a portfolio Port must satisfy the following:
AInequality * Port <= bInequality
You can also use dot notation to set up linear inequality constraints for portfolio weights.
obj = obj.setInequality(AInequality, bInequality);
To remove inequality constraints enter empty arguments. To add to existing inequality constraints, use addInequality.
Portfolio object [Portfolio].
Matrix to form linear inequality constraints [matrix].
Vector to form linear inequality constraints [vector].
To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.
Suppose you have a portfolio of five assets and you want to ensure that the first three assets are no more than 50% of your portfolio. Given a Portfolio object p, set the linear inequality constraints with the following.
A = [ 1 1 1 0 0 ]; b = 0.5; p = Portfolio; p = setInequality(p, A, b); disp(p.NumAssets); disp(p.AInequality); disp(p.bInequality);
5 1 1 1 0 0 0.5000