The OPTLP Procedure

Example 15.3: The Diet Problem

Consider the problem of diet optimization. There are six different foods: bread, milk, cheese, potato, fish, and yogurt. The cost and nutrition values per unit are displayed in Table 15.3.

Table 15.3: Cost and Nutrition Values
  Bread Milk Cheese Potato Fish Yogurt
Cost2.03.58.01.511.01.0
Protein, g4.08.07.01.38.09.2
Fat, g1.05.09.00.17.01.0
Carbohydrates, g15.011.70.422.60.017.0
Calories9012010697130180

The objective is to find a minimum-cost diet that contains at least 300 calories, not more than 10 grams of protein, not less than 10 grams of carbohydrates, and not less than 8 grams of fat. In addition, the diet should contain at least 0.5 unit of fish and no more than 1 unit of milk.

You can use the following SAS code to create the MPS-format input data set:

 data ex3;
 input field1 $ field2 $ field3$ field4 field5 $ field6 ;
 datalines;
 NAME        .          EX3      .     .         .
 ROWS        .          .        .     .         .
  N          diet       .        .     .         .
  G          calories   .        .     .         .
  L          protein    .        .     .         . 
  G          fat        .        .     .         .
  G          carbs      .        .     .         .
 COLUMNS     .          .        .     .         .
 .           br         diet     2     calories  90
 .           br         protein  4     fat       1
 .           br         carbs    15    .         .
 .           mi         diet     3.5   calories  120
 .           mi         protein  8     fat       5
 .           mi         carbs    11.7  .         .
 .           ch         diet     8     calories  106
 .           ch         protein  7     fat       9
 .           ch         carbs    .4    .         .
 .           po         diet     1.5   calories  97
 .           po         protein  1.3   fat       .1
 .           po         carbs    22.6  .         .
 .           fi         diet     11    calories  130
 .           fi         protein  8     fat       7
 .           fi         carbs    0     .         .
 .           yo         diet     1     calories  180
 .           yo         protein  9.2   fat       1
 .           yo         carbs    17    .         .
 RHS         .          .        .     .         .
 .           .          calories 300   protein   10
 .           .          fat      8     carbs     10
 BOUNDS      .          .        .     .         .
 UP          .          mi       1     .         .
 LO          .          fi       .5    .         .
 ENDATA      .          .        .     .         .
 ;
 

You can solve the diet problem by using PROC OPTLP as follows:

    proc optlp data=ex3
      presolver = none 
      solver    = ps 
      primalout = ex3pout 
      dualout   = ex3dout
      printfreq = 1; 
    run;
 

The solution summary and the optimal primal solution are displayed in Output 15.3.1.

Output 15.3.1: Diet Problem: Solution Summary and Optimal Primal Solution
The OPTLP Procedure

Solution Summary
Solver Primal simplex
Objective Function diet
Solution Status Optimal
Objective Value 12.081337881
   
Primal Infeasibility 8.881784E-16
Dual Infeasibility 0
Bound Infeasibility 0
   
Iterations 5
Presolve Time 0.00
Solution Time 0.00



Primal Solution

Obs Objective
Function ID
RHS ID Variable
Name
Variable
Type
Objective
Coefficient
Lower Bound Upper Bound Variable Value Variable
Status
Reduced Cost
1 diet   br N 2.0 0.0 1.7977E308 0.00000 L 1.19066
2 diet   mi D 3.5 0.0 1 0.05360 B 0.00000
3 diet   ch N 8.0 0.0 1.7977E308 0.44950 B 0.00000
4 diet   po N 1.5 0.0 1.7977E308 1.86517 B 0.00000
5 diet   fi O 11.0 0.5 1.7977E308 0.50000 L 5.15641
6 diet   yo N 1.0 0.0 1.7977E308 0.00000 L 1.10849



The cost of the optimal diet is 12.08 units.

Previous Page | Next Page | Top of Page