Task allocation and partitioning of social insects