% Assume each row is a unit.
% Could be optimized using dynamic programming. 

function fit = fitness(A)

     fit = 0;

     [N,n] = size(A);
     for i=1:N
       fit = fit + indfit(A(i,1:n),A);
     end
