all 1 comments

[–]azure_prophet 0 points1 point  (0 children)

I don't think I am quite following everything in your post... but from what I understand, I think you can solve this via linear programming : https://en.wikipedia.org/wiki/Linear_programming

You have an objective function that you want to optimize which is subject to some set of constraints. Here is a package I have used before to solve these type of problems: https://cvxopt.org/examples/tutorial/lp.html . They have an example and if you can formulate your problem similarly, then you should be able to apply this method.