model blending
uses "mmxprs"
declarations
products = 1..2
resources = 1..3
benefit: array(products) of real
limit: array(resources) of real
use:array(resources,products) of real
make: array(products) of mpvar
end-declarations
! Initialize values
initializations from "blending.dat"
benefit limit use
end-initializations
! Objective function
total_benefit:= sum(p in products) benefit(p)*make(p)
! Constraints
forall(r in resources) do
sum(p in products) use(r,p)*make(p) <= limit(r)
end-do
maximize(total_benefit)
forall(p in products) do
writeln("Amount produced of product ",p,": ",getsol(make(p)),".")
end-do
writeln
writeln("The net benefit is ",getobjval,".")
end-model