Forum Discussion
Optimization problem - Group assignment based on preferences
N-vanEijk It is hard without more information and such but I did something like this a while ago for someone here and thought I could tweak that for multiple selections but that turned out more challenging than I expected. That said I have completed a function that will take a list of preferences, and a list of options/activities/classes with max attendance for each and will output an 'optimized' selection. The function will randomize the order then go through all first choices and assign all available, then go through all the 2nd choices for those that didn't get their first and assign any that are available, and so on. At the end if no choice was possible using this method it will (or has options to) assign a random class (they didn't pick) if one is available. As long as there is much more availablility than attendees this shouldn't be a problem. see the attached file and hopefully it will make sense. The grid on the right is the output.