%% Set Group Constraints for a PortfolioMAD Object
% 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 PortfolioMAD object p, set the group constraints with the following.

G = [ true true true false false ];
p = PortfolioMAD;
p = setGroups(p, G, [], 0.3);

disp(p.NumAssets);
disp(p.GroupMatrix);
disp(p.UpperGroup);

% Copyright 2015 The MathWorks, Inc.