aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/glpk-4.65/examples/prod.mod
blob: aa793f76e54758a1c71e221e79243d1cf9b5ac97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# PROD, a multiperiod production model
#
# References:
# Robert Fourer, David M. Gay and Brian W. Kernighan, "A Modeling Language
# for Mathematical Programming." Management Science 36 (1990) 519-554.

###  PRODUCTION SETS AND PARAMETERS  ###

set prd 'products';    # Members of the product group

param pt 'production time' {prd} > 0;

                        # Crew-hours to produce 1000 units

param pc 'production cost' {prd} > 0;

                        # Nominal production cost per 1000, used
                        # to compute inventory and shortage costs

###  TIME PERIOD SETS AND PARAMETERS  ###

param first > 0 integer;
                        # Index of first production period to be modeled

param last > first integer;

                        # Index of last production period to be modeled

set time 'planning horizon' := first..last;

###  EMPLOYMENT PARAMETERS  ###

param cs 'crew size' > 0 integer;

                        # Workers per crew

param sl 'shift length' > 0;

                        # Regular-time hours per shift

param rtr 'regular time rate' > 0;

                        # Wage per hour for regular-time labor

param otr 'overtime rate' > rtr;

                        # Wage per hour for overtime labor

param iw 'initial workforce' >= 0 integer;

                        # Crews employed at start of first period

param dpp 'days per period' {time} > 0;

                        # Regular working days in a production period

param ol 'overtime limit' {time} >= 0;

                        # Maximum crew-hours of overtime in a period

param cmin 'crew minimum' {time} >= 0;

                        # Lower limit on average employment in a period

param cmax 'crew maximum' {t in time} >= cmin[t];

                        # Upper limit on average employment in a period

param hc 'hiring cost' {time} >= 0;

                        # Penalty cost of hiring a crew

param lc 'layoff cost' {time} >= 0;

                        # Penalty cost of laying off a crew

###  DEMAND PARAMETERS  ###

param dem 'demand' {prd,first..last+1} >= 0;

                        # Requirements (in 1000s)
                        # to be met from current production and inventory

param pro 'promoted' {prd,first..last+1} logical;

                        # true if product will be the subject
                        # of a special promotion in the period

###  INVENTORY AND SHORTAGE PARAMETERS  ###

param rir 'regular inventory ratio' >= 0;

                        # Proportion of non-promoted demand
                        # that must be in inventory the previous period

param pir 'promotional inventory ratio' >= 0;

                        # Proportion of promoted demand
                        # that must be in inventory the previous period

param life 'inventory lifetime' > 0 integer;

                        # Upper limit on number of periods that
                        # any product may sit in inventory

param cri 'inventory cost ratio' {prd} > 0;

                        # Inventory cost per 1000 units is
                        # cri times nominal production cost

param crs 'shortage cost ratio' {prd} > 0;

                        # Shortage cost per 1000 units is
                        # crs times nominal production cost

param iinv 'initial inventory' {prd} >= 0;

                        # Inventory at start of first period; age unknown

param iil 'initial inventory left' {p in prd, t in time}
              := iinv[p] less sum {v in first..t} dem[p,v];

                        # Initial inventory still available for allocation
                        # at end of period t

param minv 'minimum inventory' {p in prd, t in time}
              := dem[p,t+1] * (if pro[p,t+1] then pir else rir);

                        # Lower limit on inventory at end of period t

###  VARIABLES  ###

var Crews{first-1..last} >= 0;

                        # Average number of crews employed in each period

var Hire{time} >= 0;    # Crews hired from previous to current period

var Layoff{time} >= 0;  # Crews laid off from previous to current period

var Rprd 'regular production' {prd,time} >= 0;

                        # Production using regular-time labor, in 1000s

var Oprd 'overtime production' {prd,time} >= 0;

                        # Production using overtime labor, in 1000s

var Inv 'inventory' {prd,time,1..life} >= 0;

                        # Inv[p,t,a] is the amount of product p that is
                        # a periods old -- produced in period (t+1)-a --
                        # and still in storage at the end of period t

var Short 'shortage' {prd,time} >= 0;

                        # Accumulated unsatisfied demand at the end of period t

###  OBJECTIVE  ###

minimize cost:

    sum {t in time} rtr * sl * dpp[t] * cs * Crews[t] +
    sum {t in time} hc[t] * Hire[t] +
    sum {t in time} lc[t] * Layoff[t] +
    sum {t in time, p in prd} otr * cs * pt[p] * Oprd[p,t] +
    sum {t in time, p in prd, a in 1..life} cri[p] * pc[p] * Inv[p,t,a] +
    sum {t in time, p in prd} crs[p] * pc[p] * Short[p,t];

                        # Full regular wages for all crews employed, plus
                        # penalties for hiring and layoffs, plus
                        # wages for any overtime worked, plus
                        # inventory and shortage costs

                        # (All other production costs are assumed
                        # to depend on initial inventory and on demands,
                        # and so are not included explicitly.)

###  CONSTRAINTS  ###

rlim 'regular-time limit' {t in time}:

    sum {p in prd} pt[p] * Rprd[p,t] <= sl * dpp[t] * Crews[t];

                        # Hours needed to accomplish all regular-time
                        # production in a period must not exceed
                        # hours available on all shifts

olim 'overtime limit' {t in time}:

    sum {p in prd} pt[p] * Oprd[p,t] <= ol[t];

                        # Hours needed to accomplish all overtime
                        # production in a period must not exceed
                        # the specified overtime limit

empl0 'initial crew level':  Crews[first-1] = iw;

                        # Use given initial workforce

empl 'crew levels' {t in time}:  Crews[t] = Crews[t-1] + Hire[t] - Layoff[t];

                        # Workforce changes by hiring or layoffs

emplbnd 'crew limits' {t in time}:  cmin[t] <= Crews[t] <= cmax[t];

                        # Workforce must remain within specified bounds

dreq1 'first demand requirement' {p in prd}:

    Rprd[p,first] + Oprd[p,first] + Short[p,first]
                             - Inv[p,first,1] = dem[p,first] less iinv[p];

dreq 'demand requirements' {p in prd, t in first+1..last}:

    Rprd[p,t] + Oprd[p,t] + Short[p,t] - Short[p,t-1]
                          + sum {a in 1..life} (Inv[p,t-1,a] - Inv[p,t,a])
                                                  = dem[p,t] less iil[p,t-1];

                        # Production plus increase in shortage plus
                        # decrease in inventory must equal demand

ireq 'inventory requirements' {p in prd, t in time}:

    sum {a in 1..life} Inv[p,t,a] + iil[p,t] >= minv[p,t];

                        # Inventory in storage at end of period t
                        # must meet specified minimum

izero 'impossible inventories' {p in prd, v in 1..life-1, a in v+1..life}:

    Inv[p,first+v-1,a] = 0;

                        # In the vth period (starting from first)
                        # no inventory may be more than v periods old
                        # (initial inventories are handled separately)

ilim1 'new-inventory limits' {p in prd, t in time}:

    Inv[p,t,1] <= Rprd[p,t] + Oprd[p,t];

                        # New inventory cannot exceed
                        # production in the most recent period

ilim 'inventory limits' {p in prd, t in first+1..last, a in 2..life}:

    Inv[p,t,a] <= Inv[p,t-1,a-1];

                        # Inventory left from period (t+1)-p
                        # can only decrease as time goes on

###  DATA  ###

data;

set prd := 18REG 24REG 24PRO ;

param first :=  1 ;
param last  := 13 ;
param life  :=  2 ;

param cs := 18 ;
param sl :=  8 ;
param iw :=  8 ;

param rtr := 16.00 ;
param otr := 43.85 ;
param rir :=  0.75 ;
param pir :=  0.80 ;

param :         pt       pc        cri       crs      iinv   :=

  18REG      1.194     2304.     0.015     1.100      82.0
  24REG      1.509     2920.     0.015     1.100     792.2
  24PRO      1.509     2910.     0.015     1.100       0.0   ;

param :     dpp        ol      cmin      cmax        hc        lc   :=

  1        19.5      96.0       0.0       8.0      7500      7500
  2        19.0      96.0       0.0       8.0      7500      7500
  3        20.0      96.0       0.0       8.0      7500      7500
  4        19.0      96.0       0.0       8.0      7500      7500
  5        19.5      96.0       0.0       8.0     15000     15000
  6        19.0      96.0       0.0       8.0     15000     15000
  7        19.0      96.0       0.0       8.0     15000     15000
  8        20.0      96.0       0.0       8.0     15000     15000
  9        19.0      96.0       0.0       8.0     15000     15000
 10        20.0      96.0       0.0       8.0     15000     15000
 11        20.0      96.0       0.0       8.0      7500      7500
 12        18.0      96.0       0.0       8.0      7500      7500
 13        18.0      96.0       0.0       8.0      7500      7500   ;

param dem (tr) :

          18REG     24REG     24PRO   :=

  1        63.8    1212.0       0.0
  2        76.0     306.2       0.0
  3        88.4     319.0       0.0
  4       913.8     208.4       0.0
  5       115.0     298.0       0.0
  6       133.8     328.2       0.0
  7        79.6     959.6       0.0
  8       111.0     257.6       0.0
  9       121.6     335.6       0.0
 10       470.0     118.0    1102.0
 11        78.4     284.8       0.0
 12        99.4     970.0       0.0
 13       140.4     343.8       0.0
 14        63.8    1212.0       0.0   ;

param pro (tr) :

          18REG     24REG     24PRO   :=

  1           0         1         0
  2           0         0         0
  3           0         0         0
  4           1         0         0
  5           0         0         0
  6           0         0         0
  7           0         1         0
  8           0         0         0
  9           0         0         0
 10           1         0         1
 11           0         0         0
 12           0         0         0
 13           0         1         0
 14           0         1         0   ;

end;