## 3 Mathematical Formulation of the Problem
### Production, Inventory, and Delivery Costs Formulation  
Our goal is to simultaneously establish the optimum rates of production, the optimal delivery quantities, and the optimal maintenance plan corresponding to the quality control chart's optimal parameters, which minimizes the total average cost. The total expected cost includes the production cost, the inventory cost, the delay penalties, the quality cost, and the maintenance cost. * Production Cost The production cost at period \(k\): \[PC=C_{p}\times\sum_{k=1}^{H}u(k)\cdot\Delta t\] (9)
* Holding cost at the manufacturing store (\(S\)) Similarly, as in the case of shortages/delay, some products hold costs for the main stock, hence the need to carefully plan the inventory management system optimally in order to minimize the total cost. The inventory level balance equation characterizes the progress of the principal inventory for periods \((k=1,\ 2\ldots,\ H)\), which is defined by:  
\[S(k)=S(k-1)+u(k)\cdot\Delta t-\sum_{i=1}^{L}Q_{i}(k)\ \text{with}\ k=\{0,\ 1 \ldots,\ H\} \tag{10}\]  
\(Z_{S}(k)\) is the area created by the evolution of the inventory level at period \(k,\ (k=1,\ 2,\ldots,\ H)\):  
\[Z_{S}(k)=\max(S(k-1),0)\cdot\Delta t+\frac{1}{2}\cdot u(k)\cdot\Delta t^{2} \tag{11}\]  
Consequently, the holding cost is expressed by:  
\[HC_{S}=\sum_{k=1}^{H}C_{h}\times Z_{S}(k) \tag{12}\]  
where \(c_{h}\) = the unit cost of holding inventory. * Holding cost at the retailer's warehouses (\(w_{i}\)) The parts amount entering each warehouse, \(w_{i}\), at period \(k\) is the amount left, \(S\), at period \(\left(k-\frac{\tau_{i}}{\Delta t}\right)\cdot\frac{\tau_{i}}{\Delta t}\). The latter indicates the number of periods that the transferred products take between \(S\) and \(W_{i}\). Hence, the inventory level of each warehouse, \(w_{i}\), at period \(k\) is defined by: \[w_{i}(k)=w_{i}(k-1)+Q_{i}\Big{(}k-\frac{\tau_{i}}{\Delta t}\Big{)}-d_{i}(k), \ \text{with}\ k=\{0,1,\ldots,H\}\ \text{and}\ \tau\geq 1\] (13) \[Z_{S}(k)\] is the zone created by the evolution of inventory level at period \(k(k=1,\ldots H)\). The level of inventory of each \(w_{i}\) at period \(k\) equals the inventory level of \(w_{i}\) at period \(k-1\), plus the number of products at \(w_{i}\) (i.e., \(Q_{i}(k-\frac{\tau_{i}}{\Delta t})\)) minus the demand at period \(k\), i.e., \(d_{i}(k)\). The created zone is given as follows: \[Z_{w,i}(k)=\max(w_{i}(k-1),0)\cdot\Delta t+\frac{1}{2}\cdot Q_{i}\Big{(}k- \frac{\tau_{i}}{\Delta t}\Big{)}\cdot\Delta t^{2},\ \text{with}\ k=\{0,\ 1,\ldots,\ H\}\ \text{and}\ \tau\geq 1\] (14)For all warehouses, the expression of the cost inventory is given by:  
\[HC_{W}=\sum_{k=1}^{H}\sum_{i=1}^{L}C_{h}\times Z_{wi}(k) \tag{15}\]  
Consequently,  
* Total inventory holding cost \((HC)\)  
Consisting of the inventory holding cost at the manufacturing store (\(S\)), and all the costs of inventories from the multi-warehouses (\(w_{i}\), \([I=1,\ldots L]\)), expressed as follows:  
\[HC=C_{h}\times\sum_{k=1}^{H}\left( \begin{array}{c}\max(S(k-1),0)\cdot\Delta t +\frac{1}{2}\cdot u(k)\cdot\Delta t^{2}\\ +\sum\limits_{i=1}^{L}\max(w_{i}(k-1),0)\cdot\Delta t+\frac{1}{2}\cdot Q_{i} \big{(}k-\frac{\tau_{i}}{\Delta t}\big{)}\cdot\Delta t^{2}\end{array} \right) \tag{16}\]  
* Delivery cost  
The delivery cost to all warehouses at period \(k\) is:  
\[DC(Q(k))=C_{l}\times C_{\text{O}}\times\sum_{i=1}^{L}\left(\frac{Q_{i}(k)}{Q_ {v}}\right) \tag{17}\]  
* Delay penalties  
It is necessary to produce the right quantity of products as there are delay penalties. Whether a situation of delay followed at the end of period \(k\) causes a shortage recovered at the following period \((k+1)\) is shown in Figure 4.  
The penalties are defined according to the duration needed, \(dw(. )\), to produce the lost quantity at the end of each period. They are given by:  
\[PC=C_{d}\times\left(\sum_{k=1}^{H}\left(\sum_{i=1}^{L}dw_{i}\right)\right) \tag{18}\]  
\[dw_{i}=\frac{|\min(w_{i}(k),0)|}{Q(k+1-\frac{\tau_{i}}{\Delta t})} \tag{19}\]  
Figure 4: Shortage of inventory level.