set MACHINE; set PRODUCT; var P{p in PRODUCT} >= 0; # P gives the total amount of product p produced var X{m in MACHINE, p in PRODUCT} >= 0; # X[m,p] gives the proportion of the day that # machine m spends producing product j var TOTAL>=0; # the total production param table{m in MACHINE, p in PRODUCT} >= 0; # the table in the book. param proportion{p in PRODUCT}>=0; # the proportion of the total production which is product p maximize production: TOTAL; subject to findtot: TOTAL = sum{p in PRODUCT} P[p]; subject to balance {p in PRODUCT}: P[p] = proportion[p]*TOTAL; subject to definitions {p in PRODUCT}: P[p]=sum{j in MACHINE} table[j,p]*X[j,p]; # amount produced of product p depends on the time spent by each machine # making product p subject to conservation {m in MACHINE}: sum{p in PRODUCT} X[m,p] <= 1; # X represents a fraction of a day, so the total time spent # by machine m must add up to no more than 1.