Implementation
The standard deterministic model can be implemented as follows.
model "C-2 Glass production" uses "mmxprs" declarations NT = 12 ! Number of weeks in planning period WEEKS = 1..NT PRODS = 1.. 6 ! Set of products CAPW,CAPM: integer ! Capacity of workers and machines CAPS: integer ! Storage capacity DEM: array(PRODS,WEEKS) of integer ! Demand per product and per week CPROD: array(PRODS) of integer ! Production cost per product CSTOCK: array(PRODS) of integer ! Storage cost per product ISTOCK: array(PRODS) of integer ! Initial stock levels FSTOCK: array(PRODS) of integer ! Min. final stock levels TIMEW,TIMEM: array(PRODS) of integer ! Worker and machine time per unit SPACE: array(PRODS) of integer ! Storage space required by products produce: array(PRODS,WEEKS) of mpvar ! Production of products per week store: array(PRODS,WEEKS) of mpvar ! Amount stored at end of week end-declarations initializations from 'c2glass.dat' CAPW CAPM CAPS DEM CSTOCK CPROD ISTOCK FSTOCK TIMEW TIMEM SPACE end-initializations ! Objective: sum of production and storage costs Cost:= sum(p in PRODS, t in WEEKS) (CPROD(p)*produce(p,t) + CSTOCK(p)*store(p,t)) ! Stock balances forall(p in PRODS, t in WEEKS) Bal(p,t):= store(p,t) = if(t>1, store(p,t-1), ISTOCK(p)) + produce(p,t) - DEM(p,t) ! Final stock levels forall(p in PRODS) store(p,NT) >= FSTOCK(p) ! Capacity constraints forall(t in WEEKS) do LimitW(t):= sum(p in PRODS) TIMEW(p)*produce(p,t) <= CAPW ! Workers LimitM(t):= sum(p in PRODS) TIMEM(p)*produce(p,t) <= CAPM ! Machines LimitS(t):= sum(p in PRODS) SPACE(p)*store(p,t) <= CAPS ! Storage end-do ! Solve the problem minimize(Cost) ! Solution printing writeln("Total cost: ",getobjval) end-model
Workers' absence
For the implementation of the more fine-grained handling of workers' absence we introduce uncertains absent that are bounded by the estimated maximum number of absence hours per time period (ABSENCE) and we equally assume a limit of 5% on the total absence time across the planning period. In the work capacity constraints the absence needs to be deduced from the theoretically available work hours (we here assume that this value is 20% higher than the default limit in the basic model).
declarations ABSENCE: array(WEEKS) of real ! Max. absence (hours) absent: array(WEEKS) of uncertain ! Absence of personnel end-declarations ! Limit on total absence (uncertainty set) sum(t in WEEKS) absent(t) <= 0.05*CAPW*WEEKS.size forall(t in WEEKS) absent(t) <= ABSENCE(t) forall(t in WEEKS) absent(t) >= 0 ! Uncertains occur in several constraints setparam("ROBUST_UNCERTAIN_OVERLAP", true) ! Worker capacity constraints forall(t in WEEKS) LimitW(t):= sum(p in PRODS) TIMEW(p)*produce(p,t) <= CAPW*1.2 -absent(t)
Demand scenarios
For the formulation of the demand scenarios we need to modify the definition of the constraints that involve demand data, that is, the stock balance constraints. Before stating the scenario constraints, we need to copy the scenario data into the form that is expected by the scenario construct, namely the array SCENDATA that is indexed by the scenario counter and the uncertain demand associated with every time period.
declarations SCEN: range ! Demand scenarios SCENDEM: array(SCEN,PRODS,WEEKS) of integer ! Demand per product & week demand: array(PRODS,WEEKS) of uncertain ! Uncertain demand SCENDATA: array(SCEN,set of uncertain) of real ! Aux. data structure end-declarations ! Demand scenarios forall(s in SCEN, p in PRODS, t in WEEKS | SCENDEM(s,p,t)>0) SCENDATA(s, demand(p,t)):= SCENDEM(s,p,t) scenario(SCENDATA) ! Stock balances forall(p in PRODS, t in WEEKS) do Bal(p,t):= store(p,t) <= if(t>1, store(p,t-1), ISTOCK(p)) + produce(p,t) - demand(p,t) Bal2(p,t):= store(p,t) >= if(t>1, store(p,t-1), ISTOCK(p)) + produce(p,t) - max(s in SCEN) SCENDEM(s,p,t) end-do ! Uncertains occur in several constraints setparam("ROBUST_UNCERTAIN_OVERLAP", true)
Both sets of uncertainties can be applied at the same time. However, for the analysis of their effect it might be preferrable to apply only one at a time.
© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.