Documentation Center

  • Trial Software
  • Product Updates

addInequality

Class: PortfolioCVaR

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

Syntax

obj = addInequality(obj,AInequality,bInequality)

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

Tips

  • Use dot notation to add linear inequality constraints for portfolio weights to existing constraints.

    obj = obj.addInequality(AInequality, bInequality)
  • To remove linear inequality constraints for portfolio weights from a CVaR portfolio object.

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

Input Arguments

obj

CVaR portfolio object [PortfolioCVaR].

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.

Output Arguments

obj

Updated CVaR portfolio object [PortfolioCVaR].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

expand all

Add Linear Inequality Constraint

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.

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

A = [ 0 0 -1 -1 -1 ];    % second inequality constraint
b = -0.5;
p = p.addInequality(A, b);

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

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

    0.5000
   -0.5000

See Also

|

More About

Was this topic helpful?