Diet Problem


    {  Exmpl2.3-2_Diet.mpl  }

    {  AMPL A Modeling Language for Mathematical Programming, 2nd Edition }

    {  Chapter 2.3,  Diet Problem,  Size: 12x8,  Page 34 }


TITLE
    Diet2;

INDEX
    nutr := (A, C, B1, B2, Na, Cal);
    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] := (2, 2, 2, 2, 2, 2, 2, 2);
    F_max[food] := (10,10,10,10,10,10,10,10);
    N_min[nutr] := (700,700,700,700,  0,16000);
    N_max[nutr] := 1000 * (20,20,20,20,50,24);
    Amount[food,nutr] := (  60,  20,  10,  15, 938, 295,
                             8,   0,  20,  20,2180, 770,
                             8,  10,  15,  10, 945, 440,
                            40,  40,  35,  10, 278, 430,
                            15,  35,  15,  15,1182, 315,
                            70,  30,  15,  15, 896, 400,
                            25,  50,  25,  15,1329, 370,
                            60,  20,  15,  10,1397, 450);

INTEGER 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;
    Buy >= F_min;

END


Back To Top | Maximal Home Page | List of Models | Previous Page | Next Page