setDefaultConstraints

Class: PortfolioMAD

Set up portfolio constraints with nonnegative weights that sum to 1 for PortfolioMAD object

Syntax

obj = setDefaultConstraints(obj)
obj = setDefaultConstraints(obj,NumAssets)

Description

obj = setDefaultConstraints(obj) sets up portfolio constraints with nonnegative weights that must sum to 1.

obj = setDefaultConstraints(obj,NumAssets) sets up portfolio constraints with nonnegative weights that must sum to 1 with an additional option for NumAssets.

A "default" portfolio set has LowerBound = 0 and LowerBudget = UpperBudget = 1 such that a portfolio Port must satisfy sum(Port) = 1 with Port >= 0 .

Tips

  • You can also use dot notation to set up the default portfolio set.

    obj = obj.setDefaultConstraints(NumAssets);
  • This method does not modify any existing constraints in a PortfolioMAD object other than the bound and budget constraints. If an UpperBound constraint exists, it is cleared and set to [].

Input Arguments

obj

MAD portfolio object [PortfolioMAD].

NumAssets

(Optional) Number of assets in a PortfolioMAD object [scalar]. NumAssets cannot be used to change the dimension of a PortfolioMAD object.

Default: 1

Output Arguments

obj

Updated MAD portfolio object [PortfolioMAD].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

expand all

Define Default Constraints for the PortfolioMAD Object

Assuming you have 20 assets, you can define the "default" portfolio set.

p = PortfolioMAD('NumAssets', 20);
p = setDefaultConstraints(p);
disp(p);
  PortfolioMAD with properties:

         BuyCost: []
        SellCost: []
    RiskFreeRate: []
        Turnover: []
     BuyTurnover: []
    SellTurnover: []
    NumScenarios: []
            Name: []
       NumAssets: 20
       AssetList: []
        InitPort: []
     AInequality: []
     bInequality: []
       AEquality: []
       bEquality: []
      LowerBound: [20x1 double]
      UpperBound: []
     LowerBudget: 1
     UpperBudget: 1
     GroupMatrix: []
      LowerGroup: []
      UpperGroup: []
          GroupA: []
          GroupB: []
      LowerRatio: []
      UpperRatio: []

Was this topic helpful?