The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

99 lines
3.5 KiB

2 months ago
  1. # STIGLER'S NUTRITION MODEL
  2. #
  3. # This model determines a least cost diet which meets the daily
  4. # allowances of nutrients for a moderately active man weighing 154 lbs.
  5. #
  6. # References:
  7. # Dantzig G B, "Linear Programming and Extensions."
  8. # Princeton University Press, Princeton, New Jersey, 1963,
  9. # Chapter 27-1.
  10. set N;
  11. /* nutrients */
  12. set F;
  13. /* foods */
  14. param b{N};
  15. /* required daily allowances of nutrients */
  16. param a{F,N};
  17. /* nutritive value of foods (per dollar spent) */
  18. var x{f in F} >= 0;
  19. /* dollars of food f to be purchased daily */
  20. s.t. nb{n in N}: sum{f in F} a[f,n] * x[f] = b[n];
  21. /* nutrient balance (units) */
  22. minimize cost: sum{f in F} x[f];
  23. /* total food bill (dollars) */
  24. data;
  25. param : N : b :=
  26. Calorie 3 /* thousands */
  27. Protein 70 /* grams */
  28. Calcium 0.8 /* grams */
  29. Iron 12 /* milligrams */
  30. Vitamin-A 5 /* thousands IUs */
  31. Vitamin-B1 1.8 /* milligrams */
  32. Vitamin-B2 2.7 /* milligrams */
  33. Niacin 18 /* milligrams */
  34. Vitamin-C 75 /* milligrams */ ;
  35. set F := Wheat Cornmeal Cannedmilk Margarine Cheese Peanut-B Lard
  36. Liver Porkroast Salmon Greenbeans Cabbage Onions Potatoes
  37. Spinach Sweet-Pot Peaches Prunes Limabeans Navybeans;
  38. param a default 0
  39. : Calorie Protein Calcium Iron Vitamin-A Vitamin-B1 :=
  40. # (1000) (g) (g) (mg) (1000IU) (mg)
  41. Wheat 44.7 1411 2.0 365 . 55.4
  42. Cornmeal 36 897 1.7 99 30.9 17.4
  43. Cannedmilk 8.4 422 15.1 9 26 3
  44. Margarine 20.6 17 .6 6 55.8 .2
  45. Cheese 7.4 448 16.4 19 28.1 .8
  46. Peanut-B 15.7 661 1 48 . 9.6
  47. Lard 41.7 . . . .2 .
  48. Liver 2.2 333 .2 139 169.2 6.4
  49. Porkroast 4.4 249 .3 37 . 18.2
  50. Salmon 5.8 705 6.8 45 3.5 1
  51. Greenbeans 2.4 138 3.7 80 69 4.3
  52. Cabbage 2.6 125 4 36 7.2 9
  53. Onions 5.8 166 3.8 59 16.6 4.7
  54. Potatoes 14.3 336 1.8 118 6.7 29.4
  55. Spinach 1.1 106 . 138 918.4 5.7
  56. Sweet-Pot 9.6 138 2.7 54 290.7 8.4
  57. Peaches 8.5 87 1.7 173 86.8 1.2
  58. Prunes 12.8 99 2.5 154 85.7 3.9
  59. Limabeans 17.4 1055 3.7 459 5.1 26.9
  60. Navybeans 26.9 1691 11.4 792 . 38.4
  61. : Vitamin-B2 Niacin Vitamin-C :=
  62. # (mg) (mg) (mg)
  63. Wheat 33.3 441 .
  64. Cornmeal 7.9 106 .
  65. Cannedmilk 23.5 11 60
  66. Margarine . . .
  67. Cheese 10.3 4 .
  68. Peanut-B 8.1 471 .
  69. Lard .5 5 .
  70. Liver 50.8 316 525
  71. Porkroast 3.6 79 .
  72. Salmon 4.9 209 .
  73. Greenbeans 5.8 37 862
  74. Cabbage 4.5 26 5369
  75. Onions 5.9 21 1184
  76. Potatoes 7.1 198 2522
  77. Spinach 13.8 33 2755
  78. Sweet-Pot 5.4 83 1912
  79. Peaches 4.3 55 57
  80. Prunes 4.3 65 257
  81. Limabeans 38.2 93 .
  82. Navybeans 24.6 217 . ;
  83. end;