www.gusucode.com > GAVPai_Book_MathworksCntrlFileEx_May2019 > GAVPai_Book_MathworksCntrlFileEx_May2019/satisfy_lowbounds.m

    % function computes Step 1 of Repair Strategy (see Chapter 4, Sec. 4.5)
% levitate weights to satisfy their lower bounds 

function upgraded_weight_mat = satisfy_lowbounds(weight_mat, low_bounds, assetsindx)

[row_mat, col_mat]=size(weight_mat);   
 len = length(assetsindx);
for j=1:len
    j_indx = assetsindx(j);
    for i=1:row_mat
    if (weight_mat(i,j_indx) < low_bounds(1,j_indx))
        weight_mat(i,j_indx) = low_bounds(1,j_indx);
    end
    end
end
    upgraded_weight_mat = weight_mat;
end