Lindo Systems

  ! Perishable product inventory management;
  ! Our product has a finite shelf life, after which it goes to waste.
    We must order product in batches or cases.  Not all demand need
    be satisfied, so that there may be lost sales;
  ! Keywords: Perishable inventory, Shelf life, Lot sizing, Lost sales;
  SETS:
   Period: EI, Waste, Order, Sales, Demand, Y;
  ENDSETS
  DATA:
     Life = 2; ! Shelf life = number periods in which product 
                          can be sold, before it is out-of-date;
     FCost = 200; ! Fixed cost of placing an order;
     SPrice = 75; ! Selling price per unit;
     PCost = 35;  ! Purchase cost per unit;
     InCase = 12; ! Case size or batch size for ordering, assume >= 1;
     Demand = 33, 21, 63, 32, 13, 17, 53, 15;
  ENDDATA
  ! Order(t) = number cases ordered and arriving at 
               beginning of period t,
        Y(t) = 1 if we place an order to arrive in period t,
      EI( t) = units in ending inventory in period t,
    Waste(t) = number units going to waste/perish in period t;

  ! Maximize revenues - ( cost/unit of purchase + fixed cost of purchases);
  Max = @SUM( Period(t): SPrice*Sales(t) - PCost*InCase*Order(t)
                                         - FCost*Y(t));

  ! For period 1, Initial inventory is 0;
    EI(1) + Waste(1) = InCase*Order(1) - Sales(1);
    Sales(1) <= Demand(1);
    Order(1) <= Y(1)* @SUM( Period(s) | s #LE# Life: Demand(s));

  ! Subsequent periods;
  @FOR( Period( t) | t #GT# 1:
     EI(t) + Waste(t) = EI(t-1) + InCase*Order(t) - Sales(t);
     Sales(t) <= Demand(t);
  ! (Useful) Ending inventory can be no greater than
      demand over its shelf life. Any more goes to waste;
     EI(t) <= @SUM( Period(s) | t #LE# s #AND# s #LT# t+Life: Demand(t));
   ! Where p = number periods of shelf life;
   ! Fixed cost forcing (this could be tighter);
    Order(t) <= Y(t)* @SUM( Period(s) | t #LE# s #AND# s #LT# t+Life: Demand(t));
      );

   @FOR( Period(t):
      @GIN( Order(t));
      @BIN( Y(t));
       );
       
       <br>