setInequality

Class: PortfolioCVaR

Set up linear inequality constraints for portfolio weights in PortfolioCVaR object

Syntax

obj = setInequality(obj,AInequality,bInequality)

Description

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 portfolio Port must satisfy the following:

AInequality * Port <= bInequality

Tips

  • 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.

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

Set Linear Inequality Constraints

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 CVaR portfolio object p, set the linear inequality constraints with the following.

A = [ 1 1 1 0 0 ];
b = 0.5;
p = PortfolioCVaR;
p = setInequality(p, A, b);

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

     1     1     1     0     0

    0.5000

Was this topic helpful?