%% Set Group Ratio Constraints for a Portfolio Object
% Suppose you want to ensure that the ratio of financial to nonfinancial companies in your portfolio never exceeds 50%. Assume you have six assets with three financial companies (assets 1-3) and three nonfinancial companies (assets 4-6). Group ratio constraints can be set with:

GA = [ true true true false false false ];    % financial companies
GB = [ false false false true true true ];    % nonfinancial companies
p = Portfolio;
p = setGroupRatio(p, GA, GB, [], 0.5);

disp(p.NumAssets);
disp(p.GroupA);
disp(p.GroupB);
disp(p.UpperRatio);

% Copyright 2015 The MathWorks, Inc.