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

[{'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}]

enter image description here

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?

  • $\begingroup$ Do you need to keep it as an LP? I have some ideas but most likely you'll need to add integer variables $\endgroup$
    – dhasson
    Aug 4, 2020 at 22:51
  • $\begingroup$ @dhasson No, Not required to be LP as long as it solves the problem. Please enlighten with ideas. $\endgroup$
    – Greg
    Aug 5, 2020 at 3:43
  • $\begingroup$ 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)? $\endgroup$
    – dhasson
    Aug 5, 2020 at 6:06
  • $\begingroup$ 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. $\endgroup$
    – Greg
    Aug 5, 2020 at 7:45
  • $\begingroup$ Do you have your code available for your solution to the problem with the food type and country constraints? $\endgroup$
    – Richard
    Aug 6, 2020 at 20:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.