You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

331 lines
10 KiB

3 months ago
  1. # PROD, a multiperiod production model
  2. #
  3. # References:
  4. # Robert Fourer, David M. Gay and Brian W. Kernighan, "A Modeling Language
  5. # for Mathematical Programming." Management Science 36 (1990) 519-554.
  6. ### PRODUCTION SETS AND PARAMETERS ###
  7. set prd 'products'; # Members of the product group
  8. param pt 'production time' {prd} > 0;
  9. # Crew-hours to produce 1000 units
  10. param pc 'production cost' {prd} > 0;
  11. # Nominal production cost per 1000, used
  12. # to compute inventory and shortage costs
  13. ### TIME PERIOD SETS AND PARAMETERS ###
  14. param first > 0 integer;
  15. # Index of first production period to be modeled
  16. param last > first integer;
  17. # Index of last production period to be modeled
  18. set time 'planning horizon' := first..last;
  19. ### EMPLOYMENT PARAMETERS ###
  20. param cs 'crew size' > 0 integer;
  21. # Workers per crew
  22. param sl 'shift length' > 0;
  23. # Regular-time hours per shift
  24. param rtr 'regular time rate' > 0;
  25. # Wage per hour for regular-time labor
  26. param otr 'overtime rate' > rtr;
  27. # Wage per hour for overtime labor
  28. param iw 'initial workforce' >= 0 integer;
  29. # Crews employed at start of first period
  30. param dpp 'days per period' {time} > 0;
  31. # Regular working days in a production period
  32. param ol 'overtime limit' {time} >= 0;
  33. # Maximum crew-hours of overtime in a period
  34. param cmin 'crew minimum' {time} >= 0;
  35. # Lower limit on average employment in a period
  36. param cmax 'crew maximum' {t in time} >= cmin[t];
  37. # Upper limit on average employment in a period
  38. param hc 'hiring cost' {time} >= 0;
  39. # Penalty cost of hiring a crew
  40. param lc 'layoff cost' {time} >= 0;
  41. # Penalty cost of laying off a crew
  42. ### DEMAND PARAMETERS ###
  43. param dem 'demand' {prd,first..last+1} >= 0;
  44. # Requirements (in 1000s)
  45. # to be met from current production and inventory
  46. param pro 'promoted' {prd,first..last+1} logical;
  47. # true if product will be the subject
  48. # of a special promotion in the period
  49. ### INVENTORY AND SHORTAGE PARAMETERS ###
  50. param rir 'regular inventory ratio' >= 0;
  51. # Proportion of non-promoted demand
  52. # that must be in inventory the previous period
  53. param pir 'promotional inventory ratio' >= 0;
  54. # Proportion of promoted demand
  55. # that must be in inventory the previous period
  56. param life 'inventory lifetime' > 0 integer;
  57. # Upper limit on number of periods that
  58. # any product may sit in inventory
  59. param cri 'inventory cost ratio' {prd} > 0;
  60. # Inventory cost per 1000 units is
  61. # cri times nominal production cost
  62. param crs 'shortage cost ratio' {prd} > 0;
  63. # Shortage cost per 1000 units is
  64. # crs times nominal production cost
  65. param iinv 'initial inventory' {prd} >= 0;
  66. # Inventory at start of first period; age unknown
  67. param iil 'initial inventory left' {p in prd, t in time}
  68. := iinv[p] less sum {v in first..t} dem[p,v];
  69. # Initial inventory still available for allocation
  70. # at end of period t
  71. param minv 'minimum inventory' {p in prd, t in time}
  72. := dem[p,t+1] * (if pro[p,t+1] then pir else rir);
  73. # Lower limit on inventory at end of period t
  74. ### VARIABLES ###
  75. var Crews{first-1..last} >= 0;
  76. # Average number of crews employed in each period
  77. var Hire{time} >= 0; # Crews hired from previous to current period
  78. var Layoff{time} >= 0; # Crews laid off from previous to current period
  79. var Rprd 'regular production' {prd,time} >= 0;
  80. # Production using regular-time labor, in 1000s
  81. var Oprd 'overtime production' {prd,time} >= 0;
  82. # Production using overtime labor, in 1000s
  83. var Inv 'inventory' {prd,time,1..life} >= 0;
  84. # Inv[p,t,a] is the amount of product p that is
  85. # a periods old -- produced in period (t+1)-a --
  86. # and still in storage at the end of period t
  87. var Short 'shortage' {prd,time} >= 0;
  88. # Accumulated unsatisfied demand at the end of period t
  89. ### OBJECTIVE ###
  90. minimize cost:
  91. sum {t in time} rtr * sl * dpp[t] * cs * Crews[t] +
  92. sum {t in time} hc[t] * Hire[t] +
  93. sum {t in time} lc[t] * Layoff[t] +
  94. sum {t in time, p in prd} otr * cs * pt[p] * Oprd[p,t] +
  95. sum {t in time, p in prd, a in 1..life} cri[p] * pc[p] * Inv[p,t,a] +
  96. sum {t in time, p in prd} crs[p] * pc[p] * Short[p,t];
  97. # Full regular wages for all crews employed, plus
  98. # penalties for hiring and layoffs, plus
  99. # wages for any overtime worked, plus
  100. # inventory and shortage costs
  101. # (All other production costs are assumed
  102. # to depend on initial inventory and on demands,
  103. # and so are not included explicitly.)
  104. ### CONSTRAINTS ###
  105. rlim 'regular-time limit' {t in time}:
  106. sum {p in prd} pt[p] * Rprd[p,t] <= sl * dpp[t] * Crews[t];
  107. # Hours needed to accomplish all regular-time
  108. # production in a period must not exceed
  109. # hours available on all shifts
  110. olim 'overtime limit' {t in time}:
  111. sum {p in prd} pt[p] * Oprd[p,t] <= ol[t];
  112. # Hours needed to accomplish all overtime
  113. # production in a period must not exceed
  114. # the specified overtime limit
  115. empl0 'initial crew level': Crews[first-1] = iw;
  116. # Use given initial workforce
  117. empl 'crew levels' {t in time}: Crews[t] = Crews[t-1] + Hire[t] - Layoff[t];
  118. # Workforce changes by hiring or layoffs
  119. emplbnd 'crew limits' {t in time}: cmin[t] <= Crews[t] <= cmax[t];
  120. # Workforce must remain within specified bounds
  121. dreq1 'first demand requirement' {p in prd}:
  122. Rprd[p,first] + Oprd[p,first] + Short[p,first]
  123. - Inv[p,first,1] = dem[p,first] less iinv[p];
  124. dreq 'demand requirements' {p in prd, t in first+1..last}:
  125. Rprd[p,t] + Oprd[p,t] + Short[p,t] - Short[p,t-1]
  126. + sum {a in 1..life} (Inv[p,t-1,a] - Inv[p,t,a])
  127. = dem[p,t] less iil[p,t-1];
  128. # Production plus increase in shortage plus
  129. # decrease in inventory must equal demand
  130. ireq 'inventory requirements' {p in prd, t in time}:
  131. sum {a in 1..life} Inv[p,t,a] + iil[p,t] >= minv[p,t];
  132. # Inventory in storage at end of period t
  133. # must meet specified minimum
  134. izero 'impossible inventories' {p in prd, v in 1..life-1, a in v+1..life}:
  135. Inv[p,first+v-1,a] = 0;
  136. # In the vth period (starting from first)
  137. # no inventory may be more than v periods old
  138. # (initial inventories are handled separately)
  139. ilim1 'new-inventory limits' {p in prd, t in time}:
  140. Inv[p,t,1] <= Rprd[p,t] + Oprd[p,t];
  141. # New inventory cannot exceed
  142. # production in the most recent period
  143. ilim 'inventory limits' {p in prd, t in first+1..last, a in 2..life}:
  144. Inv[p,t,a] <= Inv[p,t-1,a-1];
  145. # Inventory left from period (t+1)-p
  146. # can only decrease as time goes on
  147. ### DATA ###
  148. data;
  149. set prd := 18REG 24REG 24PRO ;
  150. param first := 1 ;
  151. param last := 13 ;
  152. param life := 2 ;
  153. param cs := 18 ;
  154. param sl := 8 ;
  155. param iw := 8 ;
  156. param rtr := 16.00 ;
  157. param otr := 43.85 ;
  158. param rir := 0.75 ;
  159. param pir := 0.80 ;
  160. param : pt pc cri crs iinv :=
  161. 18REG 1.194 2304. 0.015 1.100 82.0
  162. 24REG 1.509 2920. 0.015 1.100 792.2
  163. 24PRO 1.509 2910. 0.015 1.100 0.0 ;
  164. param : dpp ol cmin cmax hc lc :=
  165. 1 19.5 96.0 0.0 8.0 7500 7500
  166. 2 19.0 96.0 0.0 8.0 7500 7500
  167. 3 20.0 96.0 0.0 8.0 7500 7500
  168. 4 19.0 96.0 0.0 8.0 7500 7500
  169. 5 19.5 96.0 0.0 8.0 15000 15000
  170. 6 19.0 96.0 0.0 8.0 15000 15000
  171. 7 19.0 96.0 0.0 8.0 15000 15000
  172. 8 20.0 96.0 0.0 8.0 15000 15000
  173. 9 19.0 96.0 0.0 8.0 15000 15000
  174. 10 20.0 96.0 0.0 8.0 15000 15000
  175. 11 20.0 96.0 0.0 8.0 7500 7500
  176. 12 18.0 96.0 0.0 8.0 7500 7500
  177. 13 18.0 96.0 0.0 8.0 7500 7500 ;
  178. param dem (tr) :
  179. 18REG 24REG 24PRO :=
  180. 1 63.8 1212.0 0.0
  181. 2 76.0 306.2 0.0
  182. 3 88.4 319.0 0.0
  183. 4 913.8 208.4 0.0
  184. 5 115.0 298.0 0.0
  185. 6 133.8 328.2 0.0
  186. 7 79.6 959.6 0.0
  187. 8 111.0 257.6 0.0
  188. 9 121.6 335.6 0.0
  189. 10 470.0 118.0 1102.0
  190. 11 78.4 284.8 0.0
  191. 12 99.4 970.0 0.0
  192. 13 140.4 343.8 0.0
  193. 14 63.8 1212.0 0.0 ;
  194. param pro (tr) :
  195. 18REG 24REG 24PRO :=
  196. 1 0 1 0
  197. 2 0 0 0
  198. 3 0 0 0
  199. 4 1 0 0
  200. 5 0 0 0
  201. 6 0 0 0
  202. 7 0 1 0
  203. 8 0 0 0
  204. 9 0 0 0
  205. 10 1 0 1
  206. 11 0 0 0
  207. 12 0 0 0
  208. 13 0 1 0
  209. 14 0 1 0 ;
  210. end;