Thursday, June 3, 2010

Inventory

A standard formulation to deal with inventory in GAMS can look like:

set t /t1*t5/;

positive variables
  inv(t)
'inventory at end of period t'
  production(t) 
  sell(t)
;

parameter init_inv(t) 'initial inventory' /t1 100/;
* Note: for any t > t1 init_inv(t)=0

equation
   inv_bal(t)
'inventory balance';

inv_bal(t).. inv(t) =e= inv(t-1) + production(t) - sell(t) + init_inv(t);

Note: GAMS will automatically discard inv(t-1) for the first time period t=t1 (or putting it differently it will set inv(t-1) =0 in that case).

In a project I have to deal with aging of inventory. This looks like a production/inventory model I did for a large cheese manufacturer that had a similar structure: having the cheese stored for a period causes it to age and actually becoming a different (more expensive) product.

The inventory balance equation becomes a little bit more complicated in that case. In its simplest form it can be something like:

set
  t
/t1*t10/
  a
'age classes' /a1*a3/
  a1(a)
'first age class' /a1/
;

positive variables
  inv(t,a)
'inventory at end of period t'
  production(t)
  sell(t,a)
;

parameter init_inv(t,a) 'initial inventory' /
  
t1.a1 100
  
t1.a2 160
  
t1.a3 150
/;
* Note: for any t > t1 init_inv(t,a)=0

equation
   inv_bal(t,a)
'inventory balance';

inv_bal(t,a)..
   inv(t,a) =e= inv(t-1,a-1)
                + production(t)$a1(a)
                - sell(t,a)
                + init_inv(t,a);

Unsold items are in inv(t,’a3’).