mrp2.gms : Materials Requirement Planning (MRP) Formulations

Description

Materials Requirement Planning Model.


Reference

  • Voss, S, and Woodruff, D L, Introduction to Computational Optimization Models for Production Planning in a Supply Chain.

Small Model of Types : MIP lp


Category : GAMS Model library


Main file : mrp2.gms

$title Materials Requirement Planning (MRP) Formulations (MRP2,SEQ=207)

$onText
Materials Requirement Planning Model.


Voss, S, and Woodruff, D L, Introduction to Computational
Optimization Models for Production Planning in a Supply Chain.

Keywords: linear programming, mixed integer linear programming, production
          planning
$offText

Set
   PP 'SKU numbers'  / AJ8172, LQ8811, RN0098, NN1100, WN7342 /
   TT 'time buckets' / 1jan01*8jan01  /
   KK 'resources'    / HR-101, MT-402 /;

Alias (TT,TTp), (PP,PPp);

Table R(PP,PP) 'number of i to make one j'
           AJ8172 LQ8811 RN0098 NN1100 WN7342
   AJ8172
   LQ8811       2
   RN0098       1
   NN1100              1
   WN7342              1                     ;

Table demand(PP,TT) 'external demand for an item in a period'
           1jan01 2jan01 3jan01 4jan01 5jan01 6jan01 7jan01 8jan01
   AJ8172      20     30     10     20     30     20     30     40
   LQ8811
   RN0098
   NN1100
   WN7342                                                         ;

Parameter
   lev(PP)    'Level in the production tree'
   TD(PP)     'total demand extern plus implicit';

Scalar runlev 'level iteration' / 0 /;

* Root node get level 0, all other get -1
lev(PP)$(sum(PPp,R(PP,PPp))) = -1;
TD(PP)$(lev(PP)  = 0) = sum(TT,demand(PP,TT));

loop(PP$(lev(PP) = runlev),
   runlev = runlev + 1;
   lev(PPp)$R(PPp,PP) = runlev;
   TD(PPp)$R(PPp,PP)  = sum(TT,demand(PPp,TT)) + R(PPp,PP)*TD(PP);
);

Parameter
   LT(PP) 'lead time'
   I(PP)  'beginning inventory'
   LS(PP) 'lot size';

Table SKUdata(PP,*)
              LT     LS     I
   AJ8172      2    100    90
   LQ8811      3    400   300
   RN0098      4    100   100
   NN1100      1      1     0
   WN7342     12   1000   900;

LT(PP) = SKUdata(PP,'LT');
LS(PP) = SKUdata(PP,'LS');
I(PP)  = SKUdata(PP, 'I');

Table U(PP,KK) 'fraction of resource k needed by one i'
                HR-101       MT-402
   AJ8172   0.00208333  0.000104166
   LQ8811               0.000333333
   RN0098
   NN1100               0.000001000;

Parameter M(PP) 'big M for equation defprod';
M(PP) = max(TD(PP),LS(PP));

Binary   Variable d(PP,TT) 'production indicator'

Positive Variable x(PP,TT) 'number of SKUs to produce'

Variable obj;

Equation
   defobj         'objective function'
   defreq(PP,TT)  'material requirement'
   deflot(PP,TT)  'lot size'
   defprod(PP,TT) 'production indicator'
   defcap(TT,KK)  'capacity';

defobj..         obj =e= sum((PP,TT), (card(TT)-ord(TT)+1)*x(PP,TT));

defreq(PP,TT)..          sum(TTp$(ord(TTp)<=ord(TT)-LT(PP)), x(PP,TTp)) + I(PP)
                     =g= sum(TTp$(ord(TTp)<=ord(TT)), demand(PP,TTp)
                      +  sum(PPp, R(PP,PPp)*x(PPp,TTp)));

deflot(PP,TT)..  x(PP,TT) =g= d(PP,TT)*LS(PP);

defprod(PP,TT).. x(PP,TT) =l= d(PP,TT)*M(PP);

defcap(TT,KK)..  sum(PP, U(PP,KK)*x(PP,TT)) =l= 1;

Model mrp   / defobj, defreq, deflot, defprod         /;
Model mrp2  / defobj, defreq,                  defcap /;
Model mrp2l / defobj, defreq, deflot, defprod, defcap /;

option optCr = 0.0;

solve mrp   minimizing obj using mip;
solve mrp2  minimizing obj using lp;
solve mrp2l minimizing obj using mip;