Very interesting question but since this post is not about non-working programming code, consider asking on other StackExchange sites (CrossValidated, CodeReview, DataScience) and keep question specific and not for open-ended constraints. This sounds like an optimization question with multiple variable constraints. —
Parfait just now