Hi!
I am looking to solve a diet-optimization problem, whereby my objective function is to minimize the difference between the values (portion for each food variable) selected by the model (call them 'X') and the portion size in the mean population diet (call them 'M'). The objective function is therefore the sum of the absolute value difference (standardized by dividing each difference by M) for all the food variables. Because the absolute value yields a non linear function, and I really need a linear function so I can solve using the Simplex method, the objective function is transformed as follows...
So, I caret new non negative decision variables N and P (that represent the positive and negative deviation values)
If X < M, then N=(M-X)/M, and P= 0
If X > M, then N=0, and P= (X-M)/M
If X= M, then N=0, P=0
such that the new objective function 'Y' = sum (N + P) for all the food variables.
Trouble is... I am having a hard time getting back the final X value -- i.e. the portion size the model is selecting. Yet, I need to assign these to a column, so that I can take the sumproduct of these values with another array of nutrients to ensure the total diet nutrient about selected by the model, conforms to nutrient constraints I define.
Here's where I am at... I think there's probably some errors in my logic somewhere.
[Here's where I'm at](http://i.imgur.com/WRnCmfz.png)
Your help is appreciated... sorry if this seems convoluted.
I am looking to solve a diet-optimization problem, whereby my objective function is to minimize the difference between the values (portion for each food variable) selected by the model (call them 'X') and the portion size in the mean population diet (call them 'M'). The objective function is therefore the sum of the absolute value difference (standardized by dividing each difference by M) for all the food variables. Because the absolute value yields a non linear function, and I really need a linear function so I can solve using the Simplex method, the objective function is transformed as follows...
So, I caret new non negative decision variables N and P (that represent the positive and negative deviation values)
If X < M, then N=(M-X)/M, and P= 0
If X > M, then N=0, and P= (X-M)/M
If X= M, then N=0, P=0
such that the new objective function 'Y' = sum (N + P) for all the food variables.
Trouble is... I am having a hard time getting back the final X value -- i.e. the portion size the model is selecting. Yet, I need to assign these to a column, so that I can take the sumproduct of these values with another array of nutrients to ensure the total diet nutrient about selected by the model, conforms to nutrient constraints I define.
Here's where I am at... I think there's probably some errors in my logic somewhere.
[Here's where I'm at](http://i.imgur.com/WRnCmfz.png)
Your help is appreciated... sorry if this seems convoluted.