Financial Toolbox    

Specifying Additional Constraints

The example above defined a constraints matrix that specified a set of typical scenarios. It defined groups of assets, specified upper and lower bounds for total allocation in each of these groups, and it set the total allocation of one of the groups to a fixed value. Constraints like these are common occurrences. The function portcons was created to simplify the creation of the constraint matrix for these and other common portfolio requirements. portcons takes as input arguments a list of constraint-specifier strings, followed by the data necessary to build the constraint specified by the strings.

Assume that you need to add more constraints to the previous example. Specifically, add a constraint indicating that the sum of weights in any portfolio should be equal to 1, and another set of constraints (one per asset) indicating that the weight for each asset must greater than 0. This translates into five more constraint rows: two for the new equality, and three indicating that each weight must be greater or equal to 0. The total number of inequalities in the example is now 13. Clearly, creating the constraint matrix can turn into a tedious task.

To create the new constraint matrix using portcons, use two separate constraint-specifier strings:

The only data requirement for the constraint-specifier string 'Default' is NumAssets (the total number of assets). The constraint-specifier string 'GroupLims' requires three different arguments: a Groups matrix indicating the assets that belong to each group, the GroupMin vector indicating the minimum bounds for each group, and the GroupMax vector indicating the maximum bounds for each group. Based on Table 2-6, Group Membership, build the Group matrix, with each row representing a group, and each column representing an asset.

Table 2-5, Maximum and Minimum Group Exposure, has the information to build GroupMin and GroupMax.

Given that the number of assets is three, build the constraint matrix by calling portcons.

In most cases, portcons('Default') returns the minimal set of constraints required for calling portopt. If ConSet is not specified in the call to portopt, the function calls portcons passing 'Default' as its only specifier.

Now use portopt to obtain the vectors and arrays representing the risk, return, and weights for the portfolios computed along the efficient frontier.

In this case the constraints allow only one optimum portfolio.


  Linear Constraint Equations Solving Sample Problems