Formulates groups using the Hungarian Method