I am teaching myself a bit about linear programming. I have no problems setting up the analysis witht the Solver in Excel, but when I try to repeat the work in Mathematica, I struggle with setting up the function. I am using this posting from the
Analtics Made Skeezy blog as my starting point:
http://analyticsmadeskeezy.com/2012/08/29/optimal-blending-of-cocaine/I am using the LinearProgramming function as such:
LinearProgramming[c, m, b, {{l1, u1}, {l2, u2}, ...}]
I have set the "Dollars per Gram" variable for each ingredient as:
cocaineDpG = 100; methDpG = 30; benzedrineDpG = 15; ritalinDpG = 15; dextroADpG = 15; lactoseDpG = 0.25; talcomDpG = 0.10; bakingDpG = 0.10; inositolDpG = 0.50; b12DpG = 1; manitolDpG = 0.50; dextroseDpG = 0.25; cornDpG = 0.10;
and the uper and lower limits for each ingredient as:
cocaine = {0, 100}; meth = {0, 100}; benzedrine = {0, 100}; ritalin = {0, 100}; dextroamphetamine = {0, 100}; lactose = {0, 100}; talcom = {0, 100}; baking = {0, 100}; inositol = {0, 100}; b12 = {0, 100}; manitol = {0, 100}; dextrose = {0, 100}; corn = {0, 100};
Our goal is to find the minimum value for the "Price per Kilo" which I have set up as:
ppk = (cocaineDpG*cocaine) + (methDpG*meth) + (benzedrineDpG*benzedrine) + (ritalinDpG*ritalin) + (dextroADpG*dextroA) + (lactoseDpG*lactose) + (talcomDpG*talcom) + (bakingDpG*baking) + (inositolDpG*inositol) + (b12DpG*b12) + (manitolDpG*manitol) + (dextroseDpG*dextrose) + (cornDpG*corn);
I have set up the upper and lower limits for the attributes as:
buzz = {0.80, 1.10}; sweet = {-0.10, 0.10}; texture = {-0.05, 0.05}; comedown = {0, 0.30}; addictiveness = {0.90, Infinity};
and weight as:
grams= cocaine + meth + benzedrine + ritalin + dextroA + lactose + talcom + baking + inositol + b12 + manitol + dextrose + corn
My Mathematica fucntion is now set up as such:
LinearProgramming[ ppk, m, b, { {cocaine}, {meth}, {benzdrine}, {ritalin}, {dextroA}, {lactose}, {talcom}, {baking}, {inositol}, {b12}, {manitol}, {dextrose}, {corn} }, Method -> "Simplex"]
How should I incorporate the attributes and weight to complete the function? Since the attributes have upper and lower limits, should I add them into the ist of ingredients with limits or should they be set up to take the place of the "b" in the function?
Any thoughts? I really appreciate any help.
Thanks,
JR