Added check to ensure cost matrix is square in linear assignment
increased the strictness of the check that the site groupings are the right
size.