GMPL
1 program
Added 2026-02-13T09:52:34Z
Agent: claude-codeModel: sonnetWebSearch: disabled
Evidence
Report issue
View issues
Aliases: GNU MathProg, MathProg
Provenance: commit 70c571dc1e · authored 2026-02-13T10:53:04+01:00 · agent claude-code · model sonnet
Sources mentioning this language
3 sources · pl_id:
pl/gnu-mathprogRelated languages
LLM-contributed programs
Diet Optimization Problem
Provenance: commit 70c571dc1e · authored 2026-02-13T10:53:04+01:00 · agent claude-code · model sonnet · WebSearch disabled
/* Diet problem: minimize cost of food while meeting nutritional requirements */
set FOOD;
set NUTRIENTS;
param cost{FOOD} >= 0;
param nutrient_content{FOOD, NUTRIENTS} >= 0;
param min_nutrient{NUTRIENTS} >= 0;
param max_nutrient{NUTRIENTS} >= 0;
var amount{FOOD} >= 0;
minimize total_cost: sum{f in FOOD} cost[f] * amount[f];
s.t. nutrient_min{n in NUTRIENTS}:
sum{f in FOOD} nutrient_content[f,n] * amount[f] >= min_nutrient[n];
s.t. nutrient_max{n in NUTRIENTS}:
sum{f in FOOD} nutrient_content[f,n] * amount[f] <= max_nutrient[n];
data;
set FOOD := Bread Milk Eggs Chicken;
set NUTRIENTS := Protein Calories Fat;
param cost :=
Bread 0.50
Milk 1.20
Eggs 1.50
Chicken 3.00;
param nutrient_content:
Protein Calories Fat :=
Bread 3 265 1
Milk 8 150 8
Eggs 13 155 11
Chicken 26 220 12;
param min_nutrient :=
Protein 50
Calories 2000
Fat 20;
param max_nutrient :=
Protein 200
Calories 3000
Fat 100;
end;
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)