Divide into groups

Introduction
Suppose you have a large group of men and women and you want to divide them into smaller groups with approximately equally many men and women in each. Then this page may be able to help you.

PDF files
When:
  • The large group has size between 8 and 50
  • The smaller groups have size 3 or 4, or the smaller groups have size 4 or 5
  • Each smaller group contains at least one man and one woman.
  • For a given division into smaller groups, the maximal imbalance between men and women in any smaller group is minimized.
  • The imbalance between men and woman in the larger group is not too big.
then the following PDF files will show you all possible ways to divide the larger group into smaller groups:
Google Sheet (new)
When:
  • The large group has size between 5 and 60
  • The smaller groups have size 3 or 4, or the smaller groups have size 4 or 5
  • Each smaller group contains at least one man and one woman.
  • For a given division into smaller groups, the maximal imbalance between men and women in any smaller group is minimized.
then the following Google Sheet allows you to specify the number of men and women and it will show you all possible ways to divide the larger group into smaller groups:
You will not have edit access to this sheet, so you will need to make your own copy (when logged into a Google account, select "File" and then "Make a copy").

Questions and answers
Question: How did you create the PDF files?
Answer: I wrote a program I called GenerateGroups.java and a small script to process its output into the PDF files above - see more below.

Question: I have used material on this page to divide real people into groups. Would you like to know about it?
Answer: Yes, please contact me and tell me more :-)

Question: I have used material on this page for a completely different use case. Would you like to know about it?
Answer: Yes, please contact me and tell me more :-)

Question: I want an App instead of PDF files. Will you make one?
Answer: Maybe, who knows. If you want to make this App yourself, you are very welcome to reuse relevant parts of the GenerateGroups.java program. I have tried to make it easy to reuse and it should be possible to use it as is in an Android App since Android Apps are normally written in Java. If you use GenerateGroups.java as is or in a rewritten form in your App, I would appreciate a credit to me or this page.

Question: I want some other group sizes than what is in the PDF files. How can I do this?
Answer: You can contact me and I may fell inspired to generate a relevant PDF file for you. Or you can run GenerateGroups.java program yourself.

Question: I want the pages to be laid out differently. How can I do this?
Answer: You can contact me and I may fell inspired to generate a relevant PDF file for you. Or you can run GenerateGroups.java program yourself.

Question: I have an idea for an improvement. What should I do?
Answer: You can can contact me and I may fell inspired to make the improvement. Or you can try to make the improvement yourself based on the GenerateGroups.java program.

Question: I have made some improvements myself. Will you include them here or link to my work?
Answer: Very likely - please contact me.

Question: I or someone else did something better or similar - would you like to know about it?
Answer: Yes - absolutely - please contact me.

Question: Why havn't you written GenerateGroups.java in JavaScript so it can be run easily in a browser?
Answer: I have never written anything in JavaScript, so that would have taken much longer time for me. Further, getting nice PDF files would probably have been harder if I had followed this approach.

Question: I fond a bug - what should I do?
Answer: Please contact me.

Question: Why did you do this work?
Answer: I was encouraged to write an App for this problem by a frequent organizer workshops. However, since I am a bit old-fashioned, and since it was easier, I created PDF files instead.

The GenerateGroups.java program
You can download the GenerateGroups.java program that generated the data for the PDF files above.

You can compile and run it on your own computer. You can also try to run it online which may be easier - a Google search for run java online gave me this page where you can do this. On this page, just paste in the GenerateGroups.java program and press Execute. If you give some random CommandLine arguments and press Execute the GenerateGroups.java program will print a list of valid CommandLine arguments which can be used to tweak what it generates. The page unfortunately limits how large an output GenerateGroups.java can make - you can try to give appropriate CommandLine arguments to GenerateGroups.java to work around that limitation.

You can download the generate-groups.sh script that generated the PDF files above. The script runs GenerateGroups.java and feeds the output into various standard open source programs. See more details at the beginning of the script. You probably cannot easily run this script online.

The data for the Google Sheet above was generated by running GenerateGroups.java with the CommandLine arguments "--csv --mintotal:5 --maxtotal:60 --full". The output of that command is here 

How to contact me
You can find my contact details at my personal website.