balance_patients function

Utility function for determining the optimal values for generating the subpopulations.