model chip
uses "mmxprs"
declarations
Products: set of string
Operations: set of string
Profit: array(Products) of real
LabourTime: array(Operations, Products) of real
LabourLimit: array(Operations) of real
Make: array(Products) of mpvar
end-declarations
initializations from "Chip.dat"
Products Operations Profit LabourLimit LabourTime
end-initializations
!Define the objective
TotalProfit := sum(p in Products)Profit(p)*Make(p)
!Define the constraints
forall(o in Operations) LabourCS(o):=
sum(p in Products) LabourTime(o, p)*Make(p) <= LabourLimit(o)
!Maximize the objective
maximize(TotalProfit)
!Write out the solution
forall(p in Products)
writeln("Make ", getsol(Make(p)), " ", p)
!
!Write out the objective value
!
writeln
writeln("Daily profit is £", getobjval)
!
!Indicate that the model has ended
!
end-model