A good machine learning approach for distribution of a whole?
The example you describe looks more like an optimization problem, possibly related to operations research but I'm not sure.

Naturally ML can be used to approximate the optimal solution(s) for this kind of problem. For example genetic algorithms are a common way to find the "approximately best" solution to an optimization problem.

This kind of problem can also sometimes be formalized as a regression problem, depending on the exact constraints to satisfy.