Assign objects into groups based on their properties.