getGroups

Class: PortfolioMAD

Obtain group constraint arrays from PortfolioMAD object

Syntax

[GroupMatrix,LowerGroup,UpperGroup] = getGroups(obj)

Description

[GroupMatrix,LowerGroup,UpperGroup] = getGroups(obj) obtains the group constraint arrays from a PortfolioMAD object.

Tips

You can also use dot notation to obtain the group constraint arrays from a PortfolioMAD object.

[GroupMatrix, LowerGroup, UpperGroup] = obj.getGroups;

Input Arguments

obj

MAD portfolio object [PortfolioMAD].

Output Arguments

GroupMatrix

Group constraint matrix [matrix].

LowerGroup

Lower bound for group constraints [vector].

UpperGroup

Upper bound for group constraints [vector].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

expand all

Obtain Group Constraints

Suppose you have a portfolio of five assets and you want to ensure that the first three assets constitute at most 30% of your portfolio. Given a PortfolioMAD object p with the group constraints set, obtain the values for GroupMatrix, LowerGroup, and UpperGroup.

G = [ true true true false false ];
p = PortfolioMAD;
p = setGroups(p, G, [], 0.3);
[GroupMatrix, LowerGroup, UpperGroup] = getGroups(p)
GroupMatrix =

     1     1     1     0     0


LowerGroup =

     []


UpperGroup =

    0.3000

Was this topic helpful?