# Resource constrained LP problem

I am working on Diet Allocation problem. Where we need to provide food piece for protein deficiency. The data is as below:

Data=
[{'Individual_ID': 'A', 'State': 'H1', 'Country_Code': 'C1', 'Present_Protein': 750},
{'Individual_ID': 'B', 'State': 'H1', 'Country_Code': 'C1', 'Present_Protein': 730},
{'Individual_ID': 'C', 'State': 'H2', 'Country_Code': 'C2', 'Present_Protein': 740},
{'Individual_ID': 'D', 'State': 'H3', 'Country_Code': 'C2', 'Present_Protein': 850},
{'Individual_ID': 'E', 'State': 'H3', 'Country_Code': 'C2', 'Present_Protein': 750}]


We can allocate at max one type of supplement to one individual.

Objective = min (cost)
Subjected to individual_protein > Min_requirement
And we have infinite food packet available.


This is plain and simple and I am able to do this easily. Problem start in next part.

Now for part 2: I have constraint over food type. (Example only 1 packet of each food is available). And I have predefined priority (i.e. funding company prefer allocation in particular country over another country and/or particular state over other state and/or particular ind over other indv)..

Can such constraint be added in LP problem? If yes, how?

• Do you need to keep it as an LP? I have some ideas but most likely you'll need to add integer variables – dhasson Aug 4 at 22:51
• @dhasson No, Not required to be LP as long as it solves the problem. Please enlighten with ideas. – Greg Aug 5 at 3:43
• Could you elaborate on the priorities? 1) Is it always one preference rule, or could it be the case that they have preferences over countries, preferences over states and over individuals (all three at the same time)? In that case, I guess there's a hierarchy between those preferences? 2) And how should the preferences be treated: are they strongly enforced or just desirable with trade-offs? E.g. if you have 3 people, one of them preferred over the other 2. Can we assign a specific packet to a less preferred person because it's cheaper to give it to them (maybe for a better global optimum)? – dhasson Aug 5 at 6:06
• 1) Correct. So Priority could be (just an example) C1 > H2 > H3 > C2. So, in this case I would always prefer allocation to every possibility under C1. If we have more resources available after satisfying C1 then we will move to H2 and so on... 2) Preferences are to be strongly enforced. – Greg Aug 5 at 7:45
• Do you have your code available for your solution to the problem with the food type and country constraints? – Richard Aug 6 at 20:05