Diet Problem
{ Exmpl2.2-1_Diet.mpl }
{ AMPL A Modeling Language for Mathematical Programming, 2nd Edition }
{ Chapter 2.2, Diet Problem, Size: 8x8, Page 30 }
TITLE
Diet;
INDEX
nutr := (A, C, B1, B2);
food := (beef, chk, fish, ham, mch, mtl, spg, tur);
DATA
Cost[food] := (3.19,2.59,2.29,2.89,1.89,1.99,1.99,2.49);
F_min[food] := (0, 0, 0, 0, 0, 0, 0, 0);
F_max[food] := (100,100,100,100,100,100,100,100);
N_min[nutr] := (700,700,700,700);
N_max[nutr] := 1000 * (10,10,10,10);
Amount[food,nutr] := (60,20,10,15,
8, 0,20,20,
8,10,15,10,
40,40,35,10,
15,35,15,15,
70,30,15,15,
25,50,25,15,
60,20,15,10);
VARIABLE
Buy[food];
MODEL
MIN TotalCost = SUM(food: Cost * Buy);
SUBJECT TO
DietMax[nutr]: SUM(food: Buy * Amount) <= N_max;
DietMin[nutr]: SUM(food: Buy * Amount) >= N_min;
BOUNDS
Buy <= F_max;
END
Back To Top
|
Maximal Home Page
|
List of Models |
Previous Page
|
Next Page