(!****************************************************** Mosel Example Problems ====================== file a4sugar.mos ```````````````` Production of cane sugar Sugar cane harvesting is highly mechanized, however, once harvested the sugar content decreases rapidly through fermentation. The sugar content of each wagon depends on maturity of the sugar cane and where it was grown. A production schedule for the current lot must be determined so that it minimizes the total loss of sugar. The problem formulation uses binary variables to assign wagons to time slots and 'ceil' in the calculation of an upper bound on the number of time slots needed. (c) 2008-2022 Fair Isaac Corporation author: S. Heipcke, Feb. 2002, rev. Mar. 2022 *******************************************************!) model "A-4 Cane sugar production" uses "mmxprs", "mmsystem" declarations NW = 11 ! Number of wagon loads of sugar NL = 3 ! Number of production lines WAGONS = 1..NW SLOTS = 1..ceil(NW/NL) ! Time slots for production LOSS: array(WAGONS) of real ! Loss in kg/hour LIFE: array(WAGONS) of real ! Remaining time per lot DUR: integer ! Duration of the production process: array(WAGONS,SLOTS) of mpvar ! 1 if wagon processed in slot, ! 0 otherwise end-declarations initializations from 'a4sugar.dat' LOSS LIFE DUR end-initializations ! Objective function TotalLoss:= sum(w in WAGONS, s in SLOTS) s*DUR*LOSS(w)*process(w,s) ! Assignment forall(w in WAGONS) sum(s in SLOTS) process(w,s) = 1 ! Wagon loads per time slot forall(s in SLOTS) sum(w in WAGONS) process(w,s) <= NL ! Limit on raw product life forall(w in WAGONS) sum(s in SLOTS) s*process(w,s) <= LIFE(w)/DUR forall(w in WAGONS, s in SLOTS) process(w,s) is_binary ! Solve the problem minimize(TotalLoss) ! Solution printing writeln("Total loss: ", getobjval) forall(s in SLOTS) do write("Slot ", s, ": ") forall(w in WAGONS | getsol(process(w,s))>0) write(formattext("wagon %2d (%3g) ", w, s*DUR*LOSS(w))) writeln end-do end-model