1# DIST, a product distribution 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
7###  SHIPPING SETS AND PARAMETERS  ###
8
9set whse 'warehouses';  # Locations from which demand is satisfied
10
11set dctr 'distribution centers' within whse;
12
13                        # Locations from which product may be shipped
14
15param sc 'shipping cost' {dctr,whse} >= 0;
16
17                        # Shipping costs, to whse from dctr, in $ / 100 lb
18
19param huge 'largest shipping cost' > 0;
20
21                        # Largest cost allowed for a usable shipping route
22
23param msr 'minimum size restriction' {dctr,whse} logical;
24
25                        # True indicates a minimum-size restriction on
26                        # direct shipments using this dctr --> whse route
27
28param dsr 'direct shipment requirement' {dctr} >= 0;
29
30                        # Minimum total demand, in pallets, needed to
31                        # allow shipment on routes subject to the
32                        # minimum size restriction
33
34###  PLANT SETS AND PARAMETERS  ###
35
36set fact 'factories' within dctr;
37
38                        # Locations where product is manufactured
39
40param rtmin 'regular-time total minimum' >= 0;
41
42                        # Lower limit on (average) total regular-time
43                        # crews employed at all factories
44
45param rtmax 'regular-time total maximum' >= rtmin;
46
47                        # Upper limit on (average) total regular-time
48                        # crews employed at all factories
49
50param otmin 'overtime total minimum' >= 0;
51
52                        # Lower limit on total overtime hours at all factories
53
54param otmax 'overtime total maximum' >= otmin;
55
56                        # Upper limit on total overtime hours at all factories
57
58param rmin 'regular-time minimums' {fact} >= 0;
59
60                        # Lower limits on (average) regular-time crews
61
62param rmax 'regular-time maximums' {f in fact} >= rmin[f];
63
64                        # Upper limits on (average) regular-time crews
65
66param omin 'overtime minimums' {fact} >= 0;
67
68                        # Lower limits on overtime hours
69
70param omax 'overtime maximums' {f in fact} >= omin[f];
71
72                        # Upper limits on overtime hours
73
74param hd 'hours per day' {fact} >= 0;
75
76                        # Regular-time hours per working day
77
78param dp 'days in period' {fact} > 0;
79
80                        # Working days in the current planning period
81
82###  PRODUCT SETS AND PARAMETERS  ###
83
84set prd 'products';     # Elements of the product group
85
86param wt 'weight' {prd} > 0;
87
88                        # Weight in 100 lb / 1000 cases
89
90param cpp 'cases per pallet' {prd} > 0;
91
92                        # Cases of product per shipping pallet
93
94param tc 'transshipment cost' {prd} >= 0;
95
96                        # Transshipment cost in $ / 1000 cases
97
98param pt 'production time' {prd,fact} >= 0;
99
100                        # Crew-hours to produce 1000 cases
101
102param rpc 'regular-time production cost' {prd,fact} >= 0;
103
104                        # Cost of production on regular time,
105                        # in $ / 1000 cases
106
107param opc 'overtime production cost' {prd,fact} >= 0;
108
109                        # Cost of production on overtime, in $ / 1000 cases
110
111###  DEMAND SETS AND PARAMETERS  ###
112
113param dt 'total demand' {prd} >= 0;
114
115                        # Total demands for products, in 1000s
116
117param ds 'demand shares' {prd,whse} >= 0.0, <= 1.0;
118
119                        # Historical demand data, from which each
120                        # warehouse's share of total demand is deduced
121
122param dstot {p in prd} := sum {w in whse} ds[p,w];
123
124                        # Total of demand shares; should be 1, but often isn't
125
126param dem 'demand' {p in prd, w in whse} := dt[p] * ds[p,w] / dstot[p];
127
128                        # Projected demands to be satisfied, in 1000s
129
130set rt 'shipping routes available' :=
131
132 {d in dctr, w in whse:
133         d <> w  and  sc[d,w] < huge  and
134         (w in dctr or sum {p in prd} dem[p,w] > 0)  and
135         not (msr[d,w] and sum {p in prd} 1000*dem[p,w]/cpp[p] < dsr[d]) };
136
137                        # List of ordered pairs that represent routes
138                        # on which shipments are allowed
139
140###  VARIABLES  ###
141
142var Rprd 'regular-time production' {prd,fact} >= 0;
143
144                        # Regular-time production of each product
145                        # at each factory, in 1000s of cases
146
147var Oprd 'overtime production' {prd,fact} >= 0;
148
149                        # Overtime production of each product
150                        # at each factory, in 1000s of cases
151
152var Ship 'shipments' {prd,rt} >= 0;
153
154                        # Shipments of each product on each allowed route,
155                        # in 1000s of cases
156
157var Trans 'transshipments' {prd,dctr} >= 0;
158
159                        # Transshipments of each product at each
160                        # distribution center, in 1000s of cases
161
162###  OBJECTIVE  ###
163
164minimize cost:  sum {p in prd, f in fact} rpc[p,f] * Rprd[p,f] +
165                sum {p in prd, f in fact} opc[p,f] * Oprd[p,f] +
166                sum {p in prd, (d,w) in rt} sc[d,w] * wt[p] * Ship[p,d,w] +
167                sum {p in prd, d in dctr} tc[p] * Trans[p,d];
168
169                        # Total cost:  regular production, overtime
170                        # production, shipping, and transshipment
171
172###  CONSTRAINTS  ###
173
174rtlim 'regular-time total limits':
175
176    rtmin <= sum {p in prd, f in fact}
177                        (pt[p,f] * Rprd[p,f]) / (dp[f] * hd[f]) <= rtmax;
178
179                        # Total crews must lie between limits
180
181otlim 'overtime total limits':
182
183    otmin <= sum {p in prd, f in fact} pt[p,f] * Oprd[p,f] <= otmax;
184
185                        # Total overtime must lie between limits
186
187rlim 'regular-time limits' {f in fact}:
188
189    rmin[f] <= sum {p in prd}
190                        (pt[p,f] * Rprd[p,f]) / (dp[f] * hd[f]) <= rmax[f];
191
192                        # Crews at each factory must lie between limits
193
194olim 'overtime limits' {f in fact}:
195
196    omin[f] <= sum {p in prd} pt[p,f] * Oprd[p,f] <= omax[f];
197
198                        # Overtime at each factory must lie between limits
199
200noRprd 'no regular production' {p in prd, f in fact: rpc[p,f] = 0}:
201
202    Rprd[p,f] = 0;
203
204noOprd 'no overtime production' {p in prd, f in fact: opc[p,f] = 0}:
205
206    Oprd[p,f] = 0;      # Do not produce where specified cost is zero
207
208bal 'material balance' {p in prd, w in whse}:
209
210    sum {(v,w) in rt}
211       Ship [p,v,w] + (if w in fact then Rprd[p,w] + Oprd[p,w]) =
212
213    dem[p,w] + (if w in dctr then sum {(w,v) in rt} Ship[p,w,v]);
214
215                        # Demand is satisfied by shipment into warehouse
216                        # plus production (if it is a factory)
217                        # minus shipment out (if it is a distn. center)
218
219trdef 'transshipment definition' {p in prd, d in dctr}:
220
221    Trans[p,d] >= sum {(d,w) in rt} Ship [p,d,w] -
222                  (if d in fact then Rprd[p,d] + Oprd[p,d]);
223
224                        # Transshipment at a distribution center is
225                        # shipments out less production (if any)
226
227###  DATA -- 3 PRODUCTS  ###
228
229data;
230
231set prd := 18REG 24REG 24PRO ;
232
233set whse := w01 w02 w03 w04 w05 w06 w08 w09 w12 w14 w15 w17
234            w18 w19 w20 w21 w24 w25 w26 w27 w28 w29 w30 w31
235            w32 w33 w34 w35 w36 w37 w38 w39 w40 w41 w42 w43
236            w44 w45 w46 w47 w48 w49 w50 w51 w53 w54 w55 w56
237            w57 w59 w60 w61 w62 w63 w64 w65 w66 w68 w69 w71
238            w72 w73 w74 w75 w76 w77 w78 w79 w80 w81 w82 w83
239            w84 w85 w86 w87 w89 w90 w91 w92 w93 w94 w95 w96
240            w98 x22 x23 ;
241
242set dctr := w01 w02 w03 w04 w05 w62 w76 w96 ;
243
244set fact := w01 w05 w96 ;
245
246param huge := 99. ;
247
248param rtmin := 0.0 ;
249param rtmax := 8.0 ;
250
251param otmin :=  0.0 ;
252param otmax := 96.0 ;
253
254param rmin  :=  w01 0.00   w05 0.00   w96 0.00 ;
255param rmax  :=  w01 3.00   w05 2.00   w96 3.00 ;
256
257param omin  :=  w01  0.0   w05  0.0   w96  0.0 ;
258param omax  :=  w01 48.0   w05  0.0   w96 48.0 ;
259
260param hd    :=  w01  8.0   w05  8.0   w96  8.0 ;
261
262param dp    :=  w01 19.0   w05 19.0   w96 19.0 ;
263
264param wt  :=  18REG  47.3    24REG  63.0    24PRO  63.0 ;
265
266param tc  :=  18REG  40.00   24REG  45.00   24PRO  45.00 ;
267
268param dt  :=  18REG 376.0    24REG 172.4    24PRO 316.3 ;
269
270param cpp :=  18REG 102.     24REG  91.     24PRO  91. ;
271
272param dsr := w01 96.  w02 96.  w03 96.  w04 96.  w05 96.
273             w62 96.  w76 96.  w96 96. ;
274
275param pt (tr) :
276
277       18REG     24REG     24PRO    :=
278
279w01    1.194     1.429     1.429
280w05    1.194     1.509     1.509
281w96    0.000     1.600     1.600    ;
282
283param rpc (tr) :
284
285       18REG     24REG     24PRO    :=
286
287w01    2119.       2653.    2617.
288w05    2489.       3182.    3176.
289w96       0.       2925.    2918.   ;
290
291param opc (tr) :
292
293       18REG     24REG     24PRO    :=
294
295w01    2903.     3585.     3579.
296w05       0.        0.        0.
297w96       0.     3629.     3622.    ;
298
299param sc  default 99.99 (tr) :
300
301         w01     w02     w03     w04     w05     w62     w76     w96  :=
302
303w01      .      2.97    1.14    2.08    2.37    1.26    2.42    1.43
304w02     4.74     .      4.17    6.12    7.41    3.78    7.04    5.21
305w03     2.45    4.74     .      3.67    2.84    0.90    2.41    2.55
306w04     1.74    5.03    2.43     .      3.19    2.45    2.69    0.58
307w05     2.70    5.16    2.84    2.85     .      3.26    3.34    2.71
308w06     1.99    4.17    2.13    2.19    2.52    2.06    2.00    1.51
309w08     0.21    2.92    1.24    2.07    2.29    1.25    2.32    1.55
310w09     0.66    3.76    1.41    2.47    1.82    1.66     .      1.87
311w12     1.38    3.83    1.68    2.53    2.39     .      1.96    1.94
312w14     2.47    1.58    2.40    3.59    3.85    2.25     .      3.05
313w15     1.06    4.95    2.48    1.39    3.41    1.96     .      1.02
314w17     0.88    3.39    1.46    2.00    2.67    1.45     .      1.46
315w18     7.90    6.57    7.79    9.59    10.81    .       .      6.70
316w19     1.42    4.12    1.96    1.99    3.52    1.88     .      1.26
317w20     3.03    1.59    2.34    4.76    3.98    1.88     .      3.73
318w24     1.58    2.80    2.27    2.87    3.19    1.31     .      2.05
319w25     1.51    5.05    2.74    0.57    2.98     .      2.95    0.27
320w26     1.75    3.61    2.70    1.54    4.07    3.52     .      1.03
321w27     2.48    6.87    3.17    1.59    2.08    3.45     .      0.99
322w28     2.05    6.83    2.97    1.13    2.91     .       .      1.26
323w29     4.03    3.68    4.46    3.20    5.50     .       .      3.20
324w30     2.48    5.78    2.99    2.24    1.79    3.10     .      1.39
325w31     2.34    5.41    2.87    1.67    1.66     .       .      1.39
326w32     14.36    .       .       .       .       .       .       .
327w33     3.87    4.27    5.11    3.48    5.66    4.03     .      3.05
328w34     3.26    4.80    3.21    2.70    4.14     .       .      1.77
329w35     2.34    2.84    2.89    3.35    3.78    2.68     .      2.52
330w36     2.43    5.69    2.96    2.95    1.02    2.61    1.07    2.54
331w37     2.23    4.64    2.41    1.99    4.30    2.61     .      1.44
332w38     4.66    4.36    5.23    3.04    4.46     .       .      3.82
333w39     1.11    3.51    1.10    2.53    3.07    1.12     .      2.23
334w40     2.99    4.78    4.23    1.57    3.92     .       .      1.80
335w41     4.93    4.00    5.43    4.45    6.31     .       .      3.81
336w42     3.86    6.55    5.03    2.11    4.41     .       .      2.63
337w43     4.61    4.45    3.77    1.22    4.31     .       .      2.35
338w44     2.05    4.48    1.06    3.70    3.46    1.10     .      3.21
339w45     0.92    3.42    1.58    3.04    1.82    1.94     .      2.52
340w46     1.36    2.44    0.95    3.08    2.78    0.39    2.16    2.37
341w47     1.30    3.39    1.60    2.49    4.29    2.04     .      1.68
342w48     1.65    3.78    1.03    2.97    2.21    1.31     .      2.74
343w49     1.96    3.00    1.50    3.24    3.68    1.00     .      2.99
344w50     0.90    4.14    1.60    1.95    3.61    1.61     .      1.52
345w51     1.59    3.95    0.25    2.96    2.58    1.00    2.41    2.71
346w53     1.59    3.79    1.28    3.12    3.10    0.89     .      2.98
347w54     1.72    4.36    1.61    2.92    2.34    1.91    1.97    3.05
348w55     2.45    2.73    2.21    4.47    4.30    2.57     .      4.48
349w56     1.10    3.73    1.59    2.74    2.33    1.45     .      2.44
350w57     0.95    3.39    1.37    2.30    2.47    1.15     .      1.95
351w59     3.29    5.35    3.32    3.81    1.52    3.38    1.34    4.08
352w60     2.41    6.12    2.46    3.65    2.35     .      1.37    4.06
353w61     3.32    5.50    3.41    3.38    1.23     .      0.99    4.28
354w62     1.12    3.00    0.82    3.22    2.95     .      3.33    2.53
355w63     3.59    6.36    3.25    4.12    1.84    3.59    1.46    4.03
356w64     1.85    4.45    2.17    3.43    2.13    2.03     .      4.02
357w65     2.78    4.79    2.81    2.94    1.54    2.90    1.07    2.94
358w66     3.90    5.79    3.05    3.65    1.36    3.39    1.22    3.57
359w68     2.61    5.20    2.90    2.34    1.68    3.19    1.48    2.31
360w69     2.94    5.21    2.78    3.43    0.21    3.26    0.68    2.54
361w71     2.06    4.98    2.38    2.44    1.59    2.97    1.05    2.55
362w72     2.61    5.50    2.83    3.12    1.35    3.23    0.88    2.99
363w73     8.52    6.16    8.03    8.83    10.44   7.38    10.26    .
364w74     6.11    5.46    9.07    9.38    10.80    .       .      8.25
365w75     2.66    4.94    2.87    3.69    1.52    3.15    1.24    4.00
366w76     1.99    5.26    2.23    3.36    0.58    3.17     .      2.50
367w77     4.32    3.07    5.05    3.88    6.04     .       .      4.15
368w78     5.60    2.59    5.78    5.56    7.10     .       .      5.60
369w79     4.25    2.32    4.93    4.57    6.04     .       .      4.58
370w80     5.94    4.00    5.60    7.02    9.46     .       .      7.51
371w81     5.39    2.21    5.10    6.22    6.46     .       .      6.58
372w82     8.80    5.69    9.29    9.88    11.69   8.63    11.52    .
373w83     4.40     .      5.24    5.21    5.81    3.91    7.04    5.33
374w84     5.87    5.43    6.17    5.70    7.63     .       .      5.70
375w85     3.90    3.65    3.38    4.57    5.64    3.05     .      5.04
376w86     5.48    2.10    5.70    6.37    7.33     .       .      6.19
377w87     8.88    5.54    9.50    9.71    11.64   8.85    11.68    .
378w89     4.62    4.01    4.03    6.30    6.30    3.81     .      7.77
379w90     4.35    2.72    4.61    4.01    5.60     .       .      3.20
380w91     7.61    4.42    7.83    6.85    8.79     .       .      7.66
381w92     7.15    2.69    6.91    7.20     .       .       .      7.06
382w93     3.17    3.95    4.37    3.74    5.05     .       .      2.40
383w94     1.21    3.07    0.90    2.74    3.17     .      2.63    2.39
384w95     5.82    3.29    6.55    7.06    11.47    .       .      7.83
385w96     1.77    5.20    2.72    0.59    3.47    2.48     .       .
386w98     3.04    1.92    3.64    3.70    4.90    3.05     .      3.88
387x22     4.08    6.25    4.15    4.30    1.77     .      1.77     .
388x23     3.39    5.74    3.55    4.08    1.69     .      1.47     .      ;
389
390param msr (tr) :
391
392         w01     w02     w03     w04     w05     w62     w76     w96    :=
393
394w01        0       0       0       0       0       0       1       0
395w02        0       0       0       0       0       0       1       0
396w03        0       0       0       0       0       0       1       0
397w04        0       0       0       0       0       0       1       0
398w05        0       0       0       0       0       0       0       0
399w06        0       1       1       1       1       1       1       1
400w08        0       1       1       1       1       1       1       1
401w09        0       1       1       1       1       1       0       1
402w12        0       1       1       1       1       0       1       1
403w14        1       1       1       1       1       0       0       1
404w15        0       1       1       1       1       1       0       1
405w17        0       1       1       1       1       1       0       1
406w18        0       1       1       1       1       0       0       1
407w19        0       1       1       1       1       0       0       1
408w20        1       1       1       1       1       0       0       1
409w24        0       1       1       1       1       0       0       1
410w25        0       1       1       1       1       0       1       0
411w26        1       1       1       0       1       1       0       1
412w27        1       1       1       0       1       1       0       1
413w28        1       1       1       0       1       0       0       1
414w29        0       1       1       1       1       0       0       1
415w30        1       1       1       0       1       1       0       1
416w31        1       1       1       0       1       0       0       1
417w32        0       0       0       0       0       0       0       0
418w33        1       0       1       1       1       1       0       1
419w34        1       1       1       0       1       0       0       1
420w35        1       1       1       1       1       0       0       1
421w36        0       1       1       1       0       1       1       1
422w37        1       1       1       0       1       1       0       1
423w38        1       1       1       0       1       0       0       1
424w39        0       1       1       1       1       1       0       1
425w40        1       1       1       0       1       0       0       1
426w41        1       0       1       1       1       0       0       1
427w42        1       1       1       0       1       0       0       1
428w43        1       1       1       0       1       0       0       1
429w44        1       1       1       1       1       0       0       1
430w45        0       1       1       1       1       1       0       1
431w46        0       1       1       1       1       0       1       1
432w47        0       1       1       1       1       1       0       1
433w48        0       1       1       1       1       0       0       1
434w49        1       1       1       1       1       0       0       1
435w50        0       1       1       1       1       1       0       1
436w51        0       1       1       1       1       0       1       1
437w53        1       1       1       1       1       0       0       1
438w54        0       1       1       1       1       1       1       1
439w55        0       1       1       1       1       0       0       1
440w56        0       1       1       1       1       1       0       1
441w57        0       1       1       1       1       1       0       1
442w59        0       1       1       1       0       1       1       1
443w60        0       1       1       1       1       0       1       1
444w61        0       1       1       1       0       0       1       1
445w62        0       0       0       0       0       0       1       0
446w63        0       1       1       1       0       1       1       1
447w64        0       1       1       1       1       1       0       1
448w65        0       1       1       1       0       1       1       1
449w66        0       1       1       1       0       1       1       1
450w68        0       1       1       1       0       1       1       1
451w69        0       1       1       1       0       1       1       1
452w71        0       1       1       1       0       1       1       1
453w72        0       1       1       1       0       1       1       1
454w73        0       1       1       1       0       1       1       0
455w74        0       1       1       1       0       0       0       1
456w75        0       1       1       1       0       1       1       1
457w76        0       0       0       0       0       0       0       0
458w77        1       0       1       1       1       0       0       1
459w78        1       0       1       1       1       0       0       1
460w79        1       0       1       1       1       0       0       1
461w80        1       0       1       1       1       0       0       1
462w81        1       0       1       1       1       0       0       1
463w82        1       0       1       1       1       1       1       0
464w83        1       0       1       1       1       0       1       1
465w84        1       0       1       1       1       0       0       1
466w85        1       1       1       1       1       0       0       1
467w86        1       0       1       1       1       0       0       1
468w87        1       0       1       1       1       1       1       0
469w89        1       0       1       1       1       1       0       1
470w90        0       1       1       1       1       0       0       1
471w91        1       0       1       1       1       0       0       1
472w92        1       0       1       1       1       0       0       1
473w93        1       1       1       0       1       0       0       1
474w94        0       0       1       1       1       0       1       1
475w95        1       0       1       1       1       0       0       1
476w96        0       0       0       0       0       0       0       0
477w98        1       0       1       1       1       1       0       1
478x22        1       1       1       1       0       0       1       0
479x23        1       1       1       1       0       0       1       0    ;
480
481param ds default 0.000 (tr) :
482
483         18REG     24REG     24PRO    :=
484
485w01      0.000     0.000     0.008
486w02      0.004     0.000     0.000
487w03      0.000     0.000     0.000
488w04      0.010     0.002     0.000
489w05      0.000     0.000     0.000
490w06      0.010     0.008     0.008
491w08      0.030     0.024     0.024
492w09      0.014     0.018     0.020
493w12      0.014     0.012     0.010
494w14      0.007     0.007     0.012
495w15      0.010     0.019     0.018
496w17      0.013     0.010     0.011
497w19      0.015     0.012     0.009
498w20      0.012     0.021     0.022
499w21      0.000     0.000     0.000
500w24      0.012     0.022     0.018
501w25      0.019     0.025     0.020
502w26      0.006     0.015     0.021
503w27      0.008     0.010     0.015
504w28      0.011     0.016     0.019
505w29      0.008     0.020     0.013
506w30      0.011     0.013     0.015
507w31      0.011     0.013     0.017
508w32      0.006     0.000     0.000
509w33      0.000     0.015     0.014
510w34      0.008     0.007     0.005
511w35      0.002     0.006     0.014
512w36      0.015     0.013     0.005
513w37      0.017     0.016     0.015
514w38      0.015     0.009     0.012
515w39      0.007     0.017     0.022
516w40      0.009     0.014     0.020
517w41      0.003     0.014     0.011
518w42      0.017     0.011     0.012
519w43      0.009     0.013     0.011
520w44      0.002     0.012     0.012
521w45      0.016     0.025     0.028
522w46      0.038     0.062     0.040
523w47      0.007     0.010     0.010
524w48      0.003     0.015     0.016
525w49      0.005     0.016     0.017
526w50      0.011     0.008     0.007
527w51      0.010     0.022     0.021
528w53      0.004     0.026     0.020
529w54      0.020     0.017     0.025
530w55      0.004     0.019     0.028
531w56      0.004     0.010     0.008
532w57      0.014     0.020     0.018
533w59      0.012     0.006     0.007
534w60      0.019     0.010     0.009
535w61      0.028     0.010     0.012
536w62      0.000     0.000     0.000
537w63      0.070     0.027     0.037
538w64      0.009     0.004     0.005
539w65      0.022     0.015     0.016
540w66      0.046     0.017     0.020
541w68      0.005     0.012     0.016
542w69      0.085     0.036     0.039
543w71      0.011     0.013     0.010
544w72      0.089     0.031     0.034
545w75      0.026     0.012     0.010
546w77      0.001     0.004     0.002
547w78      0.002     0.004     0.002
548w79      0.001     0.004     0.002
549w80      0.001     0.001     0.002
550w81      0.001     0.003     0.002
551w83      0.009     0.010     0.008
552w84      0.001     0.002     0.002
553w85      0.001     0.004     0.005
554w86      0.001     0.002     0.002
555w87      0.002     0.003     0.000
556w89      0.001     0.001     0.002
557w90      0.006     0.017     0.013
558w91      0.002     0.010     0.013
559w92      0.000     0.003     0.002
560w93      0.002     0.006     0.007
561w95      0.001     0.007     0.007
562w96      0.000     0.000     0.000
563w98      0.006     0.005     0.002    ;
564
565end;
566