# Optimizing Inventory Replenishment for Seasonal Demand with Discrete Delivery Times
## 3 Methodology
* Model formulation
* Notations:
* OF: Objective Function;
* \(T\): total number of weeks in the planning horizon;
* \(S\): Ordering cost;
* \(H\): yearly inventory holding cost by a stock keeping unit;
* \(I_{ij}\): cycle inventory holding cost during weeks from i to j;
* \(E_{w}\): initial inventory holding costs for the weeks from 1 to w, if the demand of these weeks is covered by initial inventory (before the first replenishment). It is set to zero if a replenishment occurs during these weeks;
* \(d_{w}\): average expected demand for the week w;
* \(D_{ij}\): demand during weeks from i to j;
* \(sd_{w}\) expected standard deviation of the demand for the week w;
* \(\sigma_{ij}\) expected standard deviation of the demand for the weeks from i to j;
* \(V\): maximum possible lot size as indicated by the supplier;
* \(P_{i}\): inventory size at the beginning of the week i (the end of week i-1);
* \(P_{0}\): The initial available inventory size at the end of the current week. ;
* \(M\): a very large number;
* C: inventory holding costs of the initial inventory at the first period before the first replenishment;
* TC: total costs;
* \(L_{w}\): the standard deviation of the demand of the weeks covered by one lot and ending with the week w. Its meaning is different for the initial period indicating the residual inventory divided by \(z\);
* \(O\): total number of orders (decision variable);
* \(Q_{ij}\): lot size (delivered quantity) to cover the demand from the week \(i\) to week \(j\), taking into account the adjustments of the safety stock based on demand variability (decision variable);
* \(SS_{ij}\): safety stock for the weeks from \(i\) to \(j\) (decision variable);\[\bullet\quad x_{ij}=\left\{\begin{array}{c}1,\ if\ demand\ from\ week\ i\ to\ week\ j\ is\ covered\ by\ one\ replenishment\\ 0,\ otherwise\\ \bullet\quad y_{w}=\left\{ \begin{array}{c}1,\ if\ demand\ from\ week\ 1\ to\ week\ w\ is\ covered\ by\ the\ initial\ inventory\\ 0,\ otherwise\\ \bullet\quad K_{w}=\left\{\begin{array}{c}1,\ if\ the\ first\ delivery\ occurs\ at\ week\ w+1\\ 0,\ otherwise\\ \end{array}\right.\end{array} \right.\]  
Model  
\[\min OF=SO+\sum_{i=1}^{T}\sum_{j=i}^{T}I_{ij}x_{ij}+C+H\sum_{i=1}^{T}\sum_{j=i} ^{T}\frac{(j-i)+1}{52}SS_{ij}+M\sum_{w=1}^{T}y_{w} \tag{1}\]  
Subject To:  
\[O=\sum_{i=1}^{T}\sum_{j=i}^{T}x_{ij} \tag{2}\]  
\[O\geq 1 \tag{3}\]  
\[I_{ij}=0.5\frac{(j-i)+1}{52}H\sum_{w=i}^{j}d_{w}\ \forall i=1\ to\ T\ and\ \forall j=i\ to\ T \tag{4}\]  
\[\sum_{i=1}^{b}x_{ib}\leq\sum_{j=b+1}^{T}x_{(b+1)j}\ \forall b=1,\ldots,T-1 \tag{5}\]  
\[D_{1w}+z\sigma_{1w}-P_{0}\leq M\sum_{i=1}^{w}\sum_{j=i}^{T}x_{ij}\ \forall w=1\ to\ T \tag{6}\]  
\[D_{1w}+z\sigma_{1w}-P_{0}\leq My_{w}\ \forall w=1\ to\ T \tag{7}\]  
\[\sum_{i=1}^{w}\sum_{j=i}^{T}x_{ij}\leq My_{w}\ \forall w=1\ to\ T \tag{8}\]  
\[Y_{w}+y_{w}=1\ \forall w=1\ to\ T \tag{9}\]  
\[E_{w}=0.5\frac{w}{52}H\sum_{i=1}^{w}d_{i}Y_{w}+\frac{w}{52}H\Bigg{(}P_{0}- \sum_{i=1}^{w}d_{i}\Bigg{)}Y_{w} \tag{10}\]  
\[O=\sum_{i=1}^{T}\sum_{j=i}^{T}x_{ij} \tag{2}\]0  
\[O=\sum_{i=1}^{T}\sum_{j=i}^{T}x_{ij} \tag{2}\]1  
\[O=\sum_{i=1}^{T}\sum_{j=i}^{T}x_{ij} \tag{2}\]2  
\[O=\sum_{i=1}^{T}\sum_{j=i}^{T}x_{ij} \tag{2}\]3  
Week 1 is the next week, and week zero is the current week. The objective function in Equation (1) contains the total costs of ordering costs plus inventory holding costs. Inventory holding costs include those at the first period before the first delivery (C) and also the inventory holding costs for safety stock. \(C\) contains both the average cycle inventory and safety stock inventory of the first period. The last term containing \(y_{w}\) is added to the objective function to enforce the model to set \(y_{w}\) to be zero for the first period. This is because Equation (7) only guarantees a value of 1 for \(y_{w}\) if the demand of a certain week is covered using a new delivery. Equation (2) is to define the optimal number of orders. Equation (3) is to prohibit the _OF_ to be zero.