Disclaimer: for privacy's sake, I have changed this data to fit a story different than it's actual use case. Hopefully this feels more like a weekly challenge to help understand the need I have.
Problem: Santa is sick and needs his elves to deliver gifts.
In the workflow I have attached, one input contains a list of states, zip codes, and their populations. The other input has the director of elves. We need to give each elf a list of unique zip codes that they are assigned to visit to deliver gifts and we need for total population of houses to be as evenly balanced as possible across all of the elves. There are some nuances though that make this difficult to automate.
I've attached a workflow with some sample data in the style of a weekly challenge. I'd appreciate any help or guidance on the best way to approach this. I don't have experience with the tile or multi-field tile tools, but my gut says the best approach includes that and maybe some kind of iterative macro.
Are Elf-Managers Chimney-abled?
Edit: It very clearly states in the dataset that they are not chimney-abled.
I have a starting point that ignores the 1/3 calculation for managers and treats them as Door_Elfs.
This start file assigns each elf to either Door or Chimney and has a mostly equal population split.
Left to configure:
Great job sharing this thematic reprex!
I would suggest using locations of each Elf in your solution. You can use a spatial file for each ZIP as well. With both of these, you can connect a Find Nearest where the target is an elf, and the universe (where you find the nearest) is a ZIP. Then you can connect each one Elf with the ZIP that minimises the total sum of distances. I would suggest having a look at locatio optimiser macro functionality as well, but that is just to help delineate for you (and me both) that you will get this done using an iterative macro.
The iterative macro can find the 1st nearest ZIP for each Elf, and then use that ZIP that was found as starting centroid for the next iteration where the subset of ZIPs that are available in the Universe has been reduced (unmatched output from the find Nearest)...
This isn't easy, I agree, but if I have time later today, I will have a look into it
It took some time.... but I think I have solved it!
Solutions Steps