Set up portfolio constraints with nonnegative weights that sum to 1
obj = setDefaultConstraints(obj)
obj = setDefaultConstraints(obj,NumAssets)
obj = setDefaultConstraints(obj) sets up the portfolio constraints with nonnegative weights that must sum to 1.
obj = setDefaultConstraints(obj,NumAssets) sets up the 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 .
Use dot notation to set up the default portfolio set.
obj = obj.setDefaultConstraints(NumAssets);
This method does not modify any existing constraints in a Portfolio object other than the bound and budget constraints. If an UpperBound constraint exists, it is cleared and set to .
Portfolio object [Portfolio].
(Optional) Number of assets in portfolio [scalar]. NumAssets cannot be used to change the dimension of a Portfolio object.
To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.
Assuming you have 20 assets, you can define the "default" portfolio set.
p = Portfolio('NumAssets', 20); p = p.setDefaultConstraints; disp(p);
Portfolio with properties: BuyCost:  SellCost:  RiskFreeRate:  AssetMean:  AssetCovar:  Turnover:  BuyTurnover:  SellTurnover:  Name:  NumAssets: 20 AssetList:  InitPort:  AInequality:  bInequality:  AEquality:  bEquality:  LowerBound: [20x1 double] UpperBound:  LowerBudget: 1 UpperBudget: 1 GroupMatrix:  LowerGroup:  UpperGroup:  GroupA:  GroupB:  LowerRatio:  UpperRatio: