set ITEMS;
set RESOURCES;
param item_resource{ITEMS, RESOURCES};
# amount of resource required for producing 1 unit
param capacity{RESOURCES};
param profit{ITEMS};
param demand{ITEMS};
var number_of_units{ITEMS} integer;
# number of units to produce for each furniture piece
maximize total_profit: sum{i in ITEMS} profit[i]*number_of_units[i];
subject to Capacity_constraints{j in RESOURCES}:
sum{i in ITEMS} item_resource[i,j]*number_of_units[i] <= capacity[j];
subject to Demand_constraints{i in ITEMS}:
number_of_units[i] >= demand[i];
data;
set ITEMS:= table chair desk;
set RESOURCES:= pine oak labor;
param item_resource:
pine oak labor :=
table 5 2 3
chair 1 3 2
desk 9 4 5;
param capacity:=
pine 1500
oak 1000
labor 800;
param: profit demand :=
table 12 40
chair 5 130
desk 15 30 ;