Lindo Systems

! The Holt-Modigliani-Muth-Simon-Hanssmann-Hess      (HanssmannHess.lng)
 production planning model.
  Given a fluctuating demand forecast for each period in a planning horizon,
 what combination of: carrying inventory, backlogging, using overtime, and
 changing workforce level from period to period
 is the best way of meeting this demand? ;
! Keywords: Holt-Modigliani, Hanssmann-Hess, Production planning,
   Workforce scheduling;
sets:
  period: w, p, invp, invn, chgup, chgdn, ovt, dem;
endsets
data:
  cr = 80;  ! Cost of regular time;
  ch = 60;  ! Cost of hiring;
  cf = 40;  ! Cost of firing/layoffs;
  co = 120; ! Cost of overtime;
  ci = 130; ! cost of inventory;
  cs = 150; ! cost of shortage;
   k = 2;   ! workforce needed/unit production;
  w0 = 100; ! initial workforce level;
  inv0 = 50;! initial inventory;
! Demand forecast over planning horizon;
  dem = 90  95 110 120 150 115
       120 120 115 100  95  90; 
enddata
! Parameters:
    dem(t) = demand in period t,
    k = workforce level required per unit production,
  Variables
    w(t) = workforce level in period t,
    invp(t) = positive inventory in period t,
    invn(t) = negative inventory(backlog) in t,
    chgup(t) = change up of workforce in t,
    chgdn(t) = change down of workforce in t,
    ovt(t) = overtime in period t
;
! minimize sum of the various cost types;
   min = crtot + chtot + cftot + cotot + citot + cstot;
! Total regular time cost;
   crtot = cr*@sum( period( t): w(t));
! Total hiring cost;
   chtot = ch*@sum( period( t): chgup(t));
! Total firing cost;
   cftot = cf*@sum( period( t): chgdn(t));
! Total overtime cost;
   cotot = co*@sum( period( t): ovt(t));
! Total cost of positive inventory;
   citot = ci*@sum( period( t): invp(t));
! Total cost of backlogging;
   cstot = cs*@sum( period( t): invn(t));

! First period is special;
!  Inventory balance equation;
  inv0 + p(1) = invp(1) - invn(1) + dem(1);
!  Workforce change;
  chgup(1) - chgdn(1) = w(1) - w0;
! Overtime to cover excess of production
   beyond regular time;
  ovt(1) >= k*p(1) - w(1);

!  For subsequent periods;
  @for( period(t) | t #gt# 1:
!   Inventory balance;
    invp(t-1) - invn(t-1) + p(t) = invp(t) - invn(t) + dem(t);
!   Workforce change;
    chgup(t) - chgdn(t) = w(t) - w(t-1);
! Overtime;
    ovt(t) >= k*p(t) - w(t);
      );
!  At the end of the planning horizon, you may wish to put
  some constraints on ending inventory level and workforce level;