📄 dist.mod
字号:
# DIST, a product distribution model## References:# Robert Fourer, David M. Gay and Brian W. Kernighan, "A Modeling Language# for Mathematical Programming." Management Science 36 (1990) 519-554.### SHIPPING SETS AND PARAMETERS ###set whse 'warehouses'; # Locations from which demand is satisfiedset dctr 'distribution centers' within whse; # Locations from which product may be shippedparam sc 'shipping cost' {dctr,whse} >= 0; # Shipping costs, to whse from dctr, in $ / 100 lbparam huge 'largest shipping cost' > 0; # Largest cost allowed for a usable shipping routeparam msr 'minimum size restriction' {dctr,whse} logical; # True indicates a minimum-size restriction on # direct shipments using this dctr --> whse routeparam dsr 'direct shipment requirement' {dctr} >= 0; # Minimum total demand, in pallets, needed to # allow shipment on routes subject to the # minimum size restriction### PLANT SETS AND PARAMETERS ###set fact 'factories' within dctr; # Locations where product is manufacturedparam rtmin 'regular-time total minimum' >= 0; # Lower limit on (average) total regular-time # crews employed at all factoriesparam rtmax 'regular-time total maximum' >= rtmin; # Upper limit on (average) total regular-time # crews employed at all factoriesparam otmin 'overtime total minimum' >= 0; # Lower limit on total overtime hours at all factoriesparam otmax 'overtime total maximum' >= otmin; # Upper limit on total overtime hours at all factoriesparam rmin 'regular-time minimums' {fact} >= 0; # Lower limits on (average) regular-time crewsparam rmax 'regular-time maximums' {f in fact} >= rmin[f]; # Upper limits on (average) regular-time crewsparam omin 'overtime minimums' {fact} >= 0; # Lower limits on overtime hoursparam omax 'overtime maximums' {f in fact} >= omin[f]; # Upper limits on overtime hoursparam hd 'hours per day' {fact} >= 0; # Regular-time hours per working dayparam dp 'days in period' {fact} > 0; # Working days in the current planning period### PRODUCT SETS AND PARAMETERS ###set prd 'products'; # Elements of the product groupparam wt 'weight' {prd} > 0; # Weight in 100 lb / 1000 casesparam cpp 'cases per pallet' {prd} > 0; # Cases of product per shipping palletparam tc 'transshipment cost' {prd} >= 0; # Transshipment cost in $ / 1000 casesparam pt 'production time' {prd,fact} >= 0; # Crew-hours to produce 1000 casesparam rpc 'regular-time production cost' {prd,fact} >= 0; # Cost of production on regular time, # in $ / 1000 casesparam opc 'overtime production cost' {prd,fact} >= 0; # Cost of production on overtime, in $ / 1000 cases### DEMAND SETS AND PARAMETERS ###param dt 'total demand' {prd} >= 0; # Total demands for products, in 1000sparam ds 'demand shares' {prd,whse} >= 0.0, <= 1.0; # Historical demand data, from which each # warehouse's share of total demand is deducedparam dstot {p in prd} := sum {w in whse} ds[p,w]; # Total of demand shares; should be 1, but often isn'tparam dem 'demand' {p in prd, w in whse} := dt[p] * ds[p,w] / dstot[p]; # Projected demands to be satisfied, in 1000sset rt 'shipping routes available' := {d in dctr, w in whse: d <> w and sc[d,w] < huge and (w in dctr or sum {p in prd} dem[p,w] > 0) and not (msr[d,w] and sum {p in prd} 1000*dem[p,w]/cpp[p] < dsr[d]) }; # List of ordered pairs that represent routes # on which shipments are allowed### VARIABLES ###var Rprd 'regular-time production' {prd,fact} >= 0; # Regular-time production of each product # at each factory, in 1000s of casesvar Oprd 'overtime production' {prd,fact} >= 0; # Overtime production of each product # at each factory, in 1000s of casesvar Ship 'shipments' {prd,rt} >= 0; # Shipments of each product on each allowed route, # in 1000s of casesvar Trans 'transshipments' {prd,dctr} >= 0; # Transshipments of each product at each # distribution center, in 1000s of cases### OBJECTIVE ###minimize cost: sum {p in prd, f in fact} rpc[p,f] * Rprd[p,f] + sum {p in prd, f in fact} opc[p,f] * Oprd[p,f] + sum {p in prd, (d,w) in rt} sc[d,w] * wt[p] * Ship[p,d,w] + sum {p in prd, d in dctr} tc[p] * Trans[p,d]; # Total cost: regular production, overtime # production, shipping, and transshipment### CONSTRAINTS ###rtlim 'regular-time total limits': rtmin <= sum {p in prd, f in fact} (pt[p,f] * Rprd[p,f]) / (dp[f] * hd[f]) <= rtmax; # Total crews must lie between limitsotlim 'overtime total limits': otmin <= sum {p in prd, f in fact} pt[p,f] * Oprd[p,f] <= otmax; # Total overtime must lie between limitsrlim 'regular-time limits' {f in fact}: rmin[f] <= sum {p in prd} (pt[p,f] * Rprd[p,f]) / (dp[f] * hd[f]) <= rmax[f]; # Crews at each factory must lie between limitsolim 'overtime limits' {f in fact}: omin[f] <= sum {p in prd} pt[p,f] * Oprd[p,f] <= omax[f]; # Overtime at each factory must lie between limitsnoRprd 'no regular production' {p in prd, f in fact: rpc[p,f] = 0}: Rprd[p,f] = 0;noOprd 'no overtime production' {p in prd, f in fact: opc[p,f] = 0}: Oprd[p,f] = 0; # Do not produce where specified cost is zerobal 'material balance' {p in prd, w in whse}: sum {(v,w) in rt} Ship [p,v,w] + (if w in fact then Rprd[p,w] + Oprd[p,w]) = dem[p,w] + (if w in dctr then sum {(w,v) in rt} Ship[p,w,v]); # Demand is satisfied by shipment into warehouse # plus production (if it is a factory) # minus shipment out (if it is a distn. center)trdef 'transshipment definition' {p in prd, d in dctr}: Trans[p,d] >= sum {(d,w) in rt} Ship [p,d,w] - (if d in fact then Rprd[p,d] + Oprd[p,d]); # Transshipment at a distribution center is # shipments out less production (if any)### DATA -- 3 PRODUCTS ###data;set prd := 18REG 24REG 24PRO ;set whse := w01 w02 w03 w04 w05 w06 w08 w09 w12 w14 w15 w17 w18 w19 w20 w21 w24 w25 w26 w27 w28 w29 w30 w31 w32 w33 w34 w35 w36 w37 w38 w39 w40 w41 w42 w43 w44 w45 w46 w47 w48 w49 w50 w51 w53 w54 w55 w56 w57 w59 w60 w61 w62 w63 w64 w65 w66 w68 w69 w71 w72 w73 w74 w75 w76 w77 w78 w79 w80 w81 w82 w83 w84 w85 w86 w87 w89 w90 w91 w92 w93 w94 w95 w96 w98 x22 x23 ;set dctr := w01 w02 w03 w04 w05 w62 w76 w96 ;set fact := w01 w05 w96 ;param huge := 99. ;param rtmin := 0.0 ;param rtmax := 8.0 ;param otmin := 0.0 ;param otmax := 96.0 ;param rmin := w01 0.00 w05 0.00 w96 0.00 ;param rmax := w01 3.00 w05 2.00 w96 3.00 ;param omin := w01 0.0 w05 0.0 w96 0.0 ;param omax := w01 48.0 w05 0.0 w96 48.0 ;param hd := w01 8.0 w05 8.0 w96 8.0 ;param dp := w01 19.0 w05 19.0 w96 19.0 ;param wt := 18REG 47.3 24REG 63.0 24PRO 63.0 ;param tc := 18REG 40.00 24REG 45.00 24PRO 45.00 ;param dt := 18REG 376.0 24REG 172.4 24PRO 316.3 ;param cpp := 18REG 102. 24REG 91. 24PRO 91. ;param dsr := w01 96. w02 96. w03 96. w04 96. w05 96. w62 96. w76 96. w96 96. ;param pt (tr) : 18REG 24REG 24PRO :=w01 1.194 1.429 1.429w05 1.194 1.509 1.509w96 0.000 1.600 1.600 ;param rpc (tr) :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -