alpar@9: # PROD, a multiperiod production model alpar@9: # alpar@9: # References: alpar@9: # Robert Fourer, David M. Gay and Brian W. Kernighan, "A Modeling Language alpar@9: # for Mathematical Programming." Management Science 36 (1990) 519-554. alpar@9: alpar@9: ### PRODUCTION SETS AND PARAMETERS ### alpar@9: alpar@9: set prd 'products'; # Members of the product group alpar@9: alpar@9: param pt 'production time' {prd} > 0; alpar@9: alpar@9: # Crew-hours to produce 1000 units alpar@9: alpar@9: param pc 'production cost' {prd} > 0; alpar@9: alpar@9: # Nominal production cost per 1000, used alpar@9: # to compute inventory and shortage costs alpar@9: alpar@9: ### TIME PERIOD SETS AND PARAMETERS ### alpar@9: alpar@9: param first > 0 integer; alpar@9: # Index of first production period to be modeled alpar@9: alpar@9: param last > first integer; alpar@9: alpar@9: # Index of last production period to be modeled alpar@9: alpar@9: set time 'planning horizon' := first..last; alpar@9: alpar@9: ### EMPLOYMENT PARAMETERS ### alpar@9: alpar@9: param cs 'crew size' > 0 integer; alpar@9: alpar@9: # Workers per crew alpar@9: alpar@9: param sl 'shift length' > 0; alpar@9: alpar@9: # Regular-time hours per shift alpar@9: alpar@9: param rtr 'regular time rate' > 0; alpar@9: alpar@9: # Wage per hour for regular-time labor alpar@9: alpar@9: param otr 'overtime rate' > rtr; alpar@9: alpar@9: # Wage per hour for overtime labor alpar@9: alpar@9: param iw 'initial workforce' >= 0 integer; alpar@9: alpar@9: # Crews employed at start of first period alpar@9: alpar@9: param dpp 'days per period' {time} > 0; alpar@9: alpar@9: # Regular working days in a production period alpar@9: alpar@9: param ol 'overtime limit' {time} >= 0; alpar@9: alpar@9: # Maximum crew-hours of overtime in a period alpar@9: alpar@9: param cmin 'crew minimum' {time} >= 0; alpar@9: alpar@9: # Lower limit on average employment in a period alpar@9: alpar@9: param cmax 'crew maximum' {t in time} >= cmin[t]; alpar@9: alpar@9: # Upper limit on average employment in a period alpar@9: alpar@9: param hc 'hiring cost' {time} >= 0; alpar@9: alpar@9: # Penalty cost of hiring a crew alpar@9: alpar@9: param lc 'layoff cost' {time} >= 0; alpar@9: alpar@9: # Penalty cost of laying off a crew alpar@9: alpar@9: ### DEMAND PARAMETERS ### alpar@9: alpar@9: param dem 'demand' {prd,first..last+1} >= 0; alpar@9: alpar@9: # Requirements (in 1000s) alpar@9: # to be met from current production and inventory alpar@9: alpar@9: param pro 'promoted' {prd,first..last+1} logical; alpar@9: alpar@9: # true if product will be the subject alpar@9: # of a special promotion in the period alpar@9: alpar@9: ### INVENTORY AND SHORTAGE PARAMETERS ### alpar@9: alpar@9: param rir 'regular inventory ratio' >= 0; alpar@9: alpar@9: # Proportion of non-promoted demand alpar@9: # that must be in inventory the previous period alpar@9: alpar@9: param pir 'promotional inventory ratio' >= 0; alpar@9: alpar@9: # Proportion of promoted demand alpar@9: # that must be in inventory the previous period alpar@9: alpar@9: param life 'inventory lifetime' > 0 integer; alpar@9: alpar@9: # Upper limit on number of periods that alpar@9: # any product may sit in inventory alpar@9: alpar@9: param cri 'inventory cost ratio' {prd} > 0; alpar@9: alpar@9: # Inventory cost per 1000 units is alpar@9: # cri times nominal production cost alpar@9: alpar@9: param crs 'shortage cost ratio' {prd} > 0; alpar@9: alpar@9: # Shortage cost per 1000 units is alpar@9: # crs times nominal production cost alpar@9: alpar@9: param iinv 'initial inventory' {prd} >= 0; alpar@9: alpar@9: # Inventory at start of first period; age unknown alpar@9: alpar@9: param iil 'initial inventory left' {p in prd, t in time} alpar@9: := iinv[p] less sum {v in first..t} dem[p,v]; alpar@9: alpar@9: # Initial inventory still available for allocation alpar@9: # at end of period t alpar@9: alpar@9: param minv 'minimum inventory' {p in prd, t in time} alpar@9: := dem[p,t+1] * (if pro[p,t+1] then pir else rir); alpar@9: alpar@9: # Lower limit on inventory at end of period t alpar@9: alpar@9: ### VARIABLES ### alpar@9: alpar@9: var Crews{first-1..last} >= 0; alpar@9: alpar@9: # Average number of crews employed in each period alpar@9: alpar@9: var Hire{time} >= 0; # Crews hired from previous to current period alpar@9: alpar@9: var Layoff{time} >= 0; # Crews laid off from previous to current period alpar@9: alpar@9: var Rprd 'regular production' {prd,time} >= 0; alpar@9: alpar@9: # Production using regular-time labor, in 1000s alpar@9: alpar@9: var Oprd 'overtime production' {prd,time} >= 0; alpar@9: alpar@9: # Production using overtime labor, in 1000s alpar@9: alpar@9: var Inv 'inventory' {prd,time,1..life} >= 0; alpar@9: alpar@9: # Inv[p,t,a] is the amount of product p that is alpar@9: # a periods old -- produced in period (t+1)-a -- alpar@9: # and still in storage at the end of period t alpar@9: alpar@9: var Short 'shortage' {prd,time} >= 0; alpar@9: alpar@9: # Accumulated unsatisfied demand at the end of period t alpar@9: alpar@9: ### OBJECTIVE ### alpar@9: alpar@9: minimize cost: alpar@9: alpar@9: sum {t in time} rtr * sl * dpp[t] * cs * Crews[t] + alpar@9: sum {t in time} hc[t] * Hire[t] + alpar@9: sum {t in time} lc[t] * Layoff[t] + alpar@9: sum {t in time, p in prd} otr * cs * pt[p] * Oprd[p,t] + alpar@9: sum {t in time, p in prd, a in 1..life} cri[p] * pc[p] * Inv[p,t,a] + alpar@9: sum {t in time, p in prd} crs[p] * pc[p] * Short[p,t]; alpar@9: alpar@9: # Full regular wages for all crews employed, plus alpar@9: # penalties for hiring and layoffs, plus alpar@9: # wages for any overtime worked, plus alpar@9: # inventory and shortage costs alpar@9: alpar@9: # (All other production costs are assumed alpar@9: # to depend on initial inventory and on demands, alpar@9: # and so are not included explicitly.) alpar@9: alpar@9: ### CONSTRAINTS ### alpar@9: alpar@9: rlim 'regular-time limit' {t in time}: alpar@9: alpar@9: sum {p in prd} pt[p] * Rprd[p,t] <= sl * dpp[t] * Crews[t]; alpar@9: alpar@9: # Hours needed to accomplish all regular-time alpar@9: # production in a period must not exceed alpar@9: # hours available on all shifts alpar@9: alpar@9: olim 'overtime limit' {t in time}: alpar@9: alpar@9: sum {p in prd} pt[p] * Oprd[p,t] <= ol[t]; alpar@9: alpar@9: # Hours needed to accomplish all overtime alpar@9: # production in a period must not exceed alpar@9: # the specified overtime limit alpar@9: alpar@9: empl0 'initial crew level': Crews[first-1] = iw; alpar@9: alpar@9: # Use given initial workforce alpar@9: alpar@9: empl 'crew levels' {t in time}: Crews[t] = Crews[t-1] + Hire[t] - Layoff[t]; alpar@9: alpar@9: # Workforce changes by hiring or layoffs alpar@9: alpar@9: emplbnd 'crew limits' {t in time}: cmin[t] <= Crews[t] <= cmax[t]; alpar@9: alpar@9: # Workforce must remain within specified bounds alpar@9: alpar@9: dreq1 'first demand requirement' {p in prd}: alpar@9: alpar@9: Rprd[p,first] + Oprd[p,first] + Short[p,first] alpar@9: - Inv[p,first,1] = dem[p,first] less iinv[p]; alpar@9: alpar@9: dreq 'demand requirements' {p in prd, t in first+1..last}: alpar@9: alpar@9: Rprd[p,t] + Oprd[p,t] + Short[p,t] - Short[p,t-1] alpar@9: + sum {a in 1..life} (Inv[p,t-1,a] - Inv[p,t,a]) alpar@9: = dem[p,t] less iil[p,t-1]; alpar@9: alpar@9: # Production plus increase in shortage plus alpar@9: # decrease in inventory must equal demand alpar@9: alpar@9: ireq 'inventory requirements' {p in prd, t in time}: alpar@9: alpar@9: sum {a in 1..life} Inv[p,t,a] + iil[p,t] >= minv[p,t]; alpar@9: alpar@9: # Inventory in storage at end of period t alpar@9: # must meet specified minimum alpar@9: alpar@9: izero 'impossible inventories' {p in prd, v in 1..life-1, a in v+1..life}: alpar@9: alpar@9: Inv[p,first+v-1,a] = 0; alpar@9: alpar@9: # In the vth period (starting from first) alpar@9: # no inventory may be more than v periods old alpar@9: # (initial inventories are handled separately) alpar@9: alpar@9: ilim1 'new-inventory limits' {p in prd, t in time}: alpar@9: alpar@9: Inv[p,t,1] <= Rprd[p,t] + Oprd[p,t]; alpar@9: alpar@9: # New inventory cannot exceed alpar@9: # production in the most recent period alpar@9: alpar@9: ilim 'inventory limits' {p in prd, t in first+1..last, a in 2..life}: alpar@9: alpar@9: Inv[p,t,a] <= Inv[p,t-1,a-1]; alpar@9: alpar@9: # Inventory left from period (t+1)-p alpar@9: # can only decrease as time goes on alpar@9: alpar@9: ### DATA ### alpar@9: alpar@9: data; alpar@9: alpar@9: set prd := 18REG 24REG 24PRO ; alpar@9: alpar@9: param first := 1 ; alpar@9: param last := 13 ; alpar@9: param life := 2 ; alpar@9: alpar@9: param cs := 18 ; alpar@9: param sl := 8 ; alpar@9: param iw := 8 ; alpar@9: alpar@9: param rtr := 16.00 ; alpar@9: param otr := 43.85 ; alpar@9: param rir := 0.75 ; alpar@9: param pir := 0.80 ; alpar@9: alpar@9: param : pt pc cri crs iinv := alpar@9: alpar@9: 18REG 1.194 2304. 0.015 1.100 82.0 alpar@9: 24REG 1.509 2920. 0.015 1.100 792.2 alpar@9: 24PRO 1.509 2910. 0.015 1.100 0.0 ; alpar@9: alpar@9: param : dpp ol cmin cmax hc lc := alpar@9: alpar@9: 1 19.5 96.0 0.0 8.0 7500 7500 alpar@9: 2 19.0 96.0 0.0 8.0 7500 7500 alpar@9: 3 20.0 96.0 0.0 8.0 7500 7500 alpar@9: 4 19.0 96.0 0.0 8.0 7500 7500 alpar@9: 5 19.5 96.0 0.0 8.0 15000 15000 alpar@9: 6 19.0 96.0 0.0 8.0 15000 15000 alpar@9: 7 19.0 96.0 0.0 8.0 15000 15000 alpar@9: 8 20.0 96.0 0.0 8.0 15000 15000 alpar@9: 9 19.0 96.0 0.0 8.0 15000 15000 alpar@9: 10 20.0 96.0 0.0 8.0 15000 15000 alpar@9: 11 20.0 96.0 0.0 8.0 7500 7500 alpar@9: 12 18.0 96.0 0.0 8.0 7500 7500 alpar@9: 13 18.0 96.0 0.0 8.0 7500 7500 ; alpar@9: alpar@9: param dem (tr) : alpar@9: alpar@9: 18REG 24REG 24PRO := alpar@9: alpar@9: 1 63.8 1212.0 0.0 alpar@9: 2 76.0 306.2 0.0 alpar@9: 3 88.4 319.0 0.0 alpar@9: 4 913.8 208.4 0.0 alpar@9: 5 115.0 298.0 0.0 alpar@9: 6 133.8 328.2 0.0 alpar@9: 7 79.6 959.6 0.0 alpar@9: 8 111.0 257.6 0.0 alpar@9: 9 121.6 335.6 0.0 alpar@9: 10 470.0 118.0 1102.0 alpar@9: 11 78.4 284.8 0.0 alpar@9: 12 99.4 970.0 0.0 alpar@9: 13 140.4 343.8 0.0 alpar@9: 14 63.8 1212.0 0.0 ; alpar@9: alpar@9: param pro (tr) : alpar@9: alpar@9: 18REG 24REG 24PRO := alpar@9: alpar@9: 1 0 1 0 alpar@9: 2 0 0 0 alpar@9: 3 0 0 0 alpar@9: 4 1 0 0 alpar@9: 5 0 0 0 alpar@9: 6 0 0 0 alpar@9: 7 0 1 0 alpar@9: 8 0 0 0 alpar@9: 9 0 0 0 alpar@9: 10 1 0 1 alpar@9: 11 0 0 0 alpar@9: 12 0 0 0 alpar@9: 13 0 1 0 alpar@9: 14 0 1 0 ; alpar@9: alpar@9: end;