My Diet



   {  Exmpl3.4-6_MyDiet.mpl  }

   {  Winston, Operations Research, Applications and Algorithms, 4th ed.  }

   {  Chapter 3.4,  Example 6,  Diet Problem,  Size: 4x4,  Page 69  }


TITLE
    MyDietProblem;

INDEX
     foods     := (Brownie, Icecream, Cola, Cheesecake);
     nutrients := (Calories, Chocolate, Sugar, Fat);

DATA
    FoodCost[foods]    := (0.50, 0.20, 0.30, 0.80);

    NutriReq[nutrients] := (500, 6, 10, 8);

    NutriValues[foods,nutrients] = (400,   3,  2,  2,
                                    200,   2,  2,  4,
                                    150,   0,  4,  1,
                                    500,   0,  4,  5);

VARIABLE
     Consume[foods] -> "";

MODEL

     MIN Cost = SUM(foods: FoodCost[foods] * Consume[foods]);

SUBJECT TO

    Required[nutrients] -> "":

        SUM(foods: NutriValues * Consume) >= NutriReq;

END



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