The OPTLP Procedure |
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 ValuesBread | Milk | Cheese | Potato | Fish | Yogurt | |
Cost | 2.0 | 3.5 | 8.0 | 1.5 | 11.0 | 1.0 |
Protein, g | 4.0 | 8.0 | 7.0 | 1.3 | 8.0 | 9.2 |
Fat, g | 1.0 | 5.0 | 9.0 | 0.1 | 7.0 | 1.0 |
Carbohydrates, g | 15.0 | 11.7 | 0.4 | 22.6 | 0.0 | 17.0 |
Calories | 90 | 120 | 106 | 97 | 130 | 180 |
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 SolutionThe cost of the optimal diet is 12.08 units.
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.