Documentation Center

  • Trial Software
  • Product Updates

addEquality

Class: PortfolioCVaR

Add linear equality constraints for portfolio weights to existing constraints in PortfolioCVaR object

Syntax

obj = addEquality(obj,AEquality,bEquality)

Description

obj = addEquality(obj,AEquality,bEquality) adds linear equality constraints for portfolio weights to existing constraints.

Given a linear equality constraint matrix AEquality and vector bEquality, every weight in a portfolio Port must satisfy the following:

AEquality * Port = bEquality

This method "stacks" additional linear equality constraints onto any existing linear equality constraints that already exist in the input PortfolioCVaR object. If no constraints already exist, this method is the same as setEquality.

Tips

  • Use dot notation to add the linear equality constraints for portfolio weights.

    obj = obj.addEquality(AEquality, bEquality)
  • To remove linear equality constraints from a CVaR portfolio object.

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

Input Arguments

obj

CVaR portfolio object [PortfolioCVaR].

AEquality

Matrix to form linear equality constraints [matrix].

bEquality

Vector to form linear equality constraints [vector].

    Note:   An error results if AEquality is empty and bEquality is nonempty or if AEquality is nonempty and bEquality 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 a Linear Equality Constraint

Use the addEquality method to create linear equality constraints. Add another linear equality constraint to ensure that the last three assets constitute 50% of a portfolio.

p = PortfolioCVaR;
A = [ 1 1 1 0 0 ];    % First equality constraint
b = 0.5;
p = p.setEquality(A, b);

A = [ 0 0 1 1 1 ];    % Second equality constraint
b = 0.5;
p = p.addEquality(A, b);

disp(p.NumAssets);
disp(p.AEquality);
disp(p.bEquality);
     5

     1     1     1     0     0
     0     0     1     1     1

    0.5000
    0.5000

See Also

|

More About

Was this topic helpful?