Accelerating the pace of engineering and science

# Documentation

### Contents

Add linear inequality constraints for portfolio weights to existing constraints for PortfolioMAD object

## Description

obj = addInequality(obj,AInequality,bInequality) adds linear inequality constraints for portfolio weights to existing constraints.

Given linear inequality constraint matrix AInequality and vector bInequality, every weight in portfolio Port must satisfy the following:

AInequality * Port <= bInequality

addInequality "stacks" additional linear inequality constraints onto any existing linear inequality constraints that already exist in the input PortfolioMAD object. If no constraints already exist, this method is the same as setInequality.

## Tips

• You can also use dot notation to add linear inequality constraints for portfolio weights to existing constraints.

• You can remove linear inequality constraints for portfolio weights from a MAD portfolio object using dot notation.

obj = obj.setInequality([ ], [ ])

## Input Arguments

 obj MAD portfolio object [PortfolioMAD]. AInequality Matrix to form linear inequality constraints [matrix]. bInequality Vector to form linear inequality constraints [vector].
 Note:   An error results if AInequality is empty and bInequality is nonempty, or if AInequality is nonempty and bInequality is empty.

## Attributes

 Access public Static false Hidden false

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

## Examples

expand all

Set a linear inequality constraint to ensure that the first three assets constitute at most 50% of a portfolio. Then add another linear inequality constraint to ensure that the last three assets constitute at least 50% of a portfolio.

A = [ 1 1 1 0 0 ];    % first inequality constraint
b = 0.5;
p = setInequality(p, A, b);

A = [ 0 0 -1 -1 -1 ];    % second inequality constraint
b = -0.5;

disp(p.NumAssets);
disp(p.AInequality);
disp(p.bInequality);
5

1     1     1     0     0
0     0    -1    -1    -1

0.5000
-0.5000