# Can a machine learning approach solve this constrained optimisation problem?

I had done with different classification, regression and clustering approaches for predictions of values, etc. I was wondering if there is a machine learning approach for distribution of a whole based on some features (I do not know if there is an approach for that I just could not find one with my research).

An easy example might be lets consider we have height and weight data of many children and we have to distribute a given number of pizza slices amongst them so that skinny children get more pizza as compared to obese ones because pizza is more beneficial for skinny as compared to obese. So might have to find out the optimum number of slices for each child out of the total number of slices so that each child gets maximum possible nutrients. A more complex version could incorporate more features like age, overall health, blood sugar content, physical activity index, daily calorie consumption, and others.

A similar example might be to find out the optimal value of fuel to be allocated to each vehicle if we have a total of 100 gallons. Features might be distance they have to travel, mpg, driver competency, engine horsepower, etc., so that all of them might travel the maximum distance possible.

So, can we achieve a task like this with machine learning/deep learning approaches? If not what are the hurdles achieving this?

• Hi. What do you mean by "for distribution of a whole"? I don't understand why you're using this expression. Your problem is about allocating resources given some constraints .
– nbro
Commented Jun 15, 2020 at 10:22
• Hi @nbro! I used that because I could not think of any term more explaining than this . Thanks for the edit though it makes it more clear! Commented Jun 15, 2020 at 10:47

Sounds more like a optimization problem than a deep learning / machine learning problem to me.

For machine learning you would have the features of every child / vehicle and the optimal amount of pizza / fuel already given, but you don't know how exactly the optimal amount is computed. So the target is to find a function which maps features to target.

However in your case you don't know the optimal value, you just have a number of constraints. So my suggestion would be to use linear programming.

Here is an simple example: drive the maximum distance with a given amount of fuel

$$\text{max }\ m_1 \cdot x_1 + ... + m_n \cdot x_n$$ $$\text{s.t. }\ x_1 + ... + x_n \leq F$$ $$m_i \cdot x_i \geq T_i\ \forall\ 1 \leq i \leq n$$

$$x_i$$ is the amount of fuel (in gallons) given to car $$i$$, $$m_i$$'s are miles-per-gallon for car $$i$$. $$F$$ is the total amount of fuel available, this is our first constraint, we cannot distribute more fuel than we have. The second constraint say's that we like to drive at least $$T_i$$ miles with car $$i$$. This ensures we do not just give all the fuel to the most efficient car.

You can come up with more constraints for drivers competency, engine horse power etc. In order so solve your problem with linear programming, you just have to make sure it is still linear and convex. Problems of this kind can be solved using the Simplex algorithm (scipy.optimize.linprog).
If your objective or your constraints are more complex you can use numerical methods for non-linear constrained optimization problems (see scipy.optimize for algorithms).

• So @Tinu it means this type of problems cannot be solved by machine learning approaches even though total amount is given? Commented Jun 15, 2020 at 10:46