# Reducing Nervousness in Master Production Planning:
## 3 Proposed PDS
### The Optimization Problem  
The mathematical model that produces the master production plan considers minimizing the production cost subject to the quantity to be produced at a given time. This formulation extends the formulation presented in the literature for lot-sizing problems by including production costs, inventory, setup, and backorder costs [20; 51]. Our specific model uses the following variables, all of which depend on the period '\(t\)' and product '\(i\)': production quantity \((x_{i})\), inventory level \((s_{i})\), backlog quantity \((r_{i})\), and setup \((y_{i})\)Additionally, we provide the model with the following initial parameters: demand (\(d_{it}\)), production cost (\(p_{it}\)), inventory holding cost (\(h_{it}\)), backorder cost (\(b_{it}\)), setup cost (\(q_{it}\)), and system capacity (\(C_{t}\)). We define all these parameters for specific periods '\(t\)' and product '\(i\)'. Let the following decision variables be defined as follows:  
\(x_{it}=Quantity\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(s_{it}=Quantity\)\(of\)\(in\)\(period\)\(t\).  
\(r_{it}=Backlog\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(y_{it}=Setup\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\) (\(y_{it}=1\)\(\leftrightarrow\)\(x_{it}>0,\forall i,\forall t\)).  
The model requires the following input:  
\(d_{it}=Demand\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(p_{it}=Production\)\(cost\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(h_{it}=Inventory\)\(cost\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(b_{it}=Backorder\)\(cost\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(q_{it}=Setup\)\(cost\)\(of\)\(product\)\(i\)\(in\)\(period\)\(t\).  
\(C_{t}=Capacity\)\(in\)\(period\)\(t\).  
The mathematical formulation is in Equations (1)-(5).  
\[minf^{k}=\sum_{i=1}^{n}\sum_{t=k}^{t^{\prime}}(p_{it}x_{it}+h_{it}s_{it}+b_{ it}r_{it}+q_{it}y_{it}) \tag{1}\]  
subject to:  
\[x_{it}\leq My_{it},i\in[1,\ldots,n],t\in\left[k,\ldots,t^{\prime}\right] \tag{2}\]  
\[\sum_{i}^{n}x_{it}\leq C_{t},t\in\left[k,\ldots,t^{\prime}\right] \tag{3}\]  
\[s_{i0}^{0}=s_{ini}^{0},r_{i0}^{0}=r_{ini}^{0},i\in[1,\ldots,n] \tag{4}\]  
\[s_{i(t-1)}-r_{i(t-1)}+x_{it}=d_{it}+s_{it}-r_{it},i\in[1,\ldots,n],t\in\left[ k,\ldots,t^{\prime}\right] \tag{5}\]  
Equations (1)-(5) enable us to compute the production schedule that minimizes costs for each cycle. Specifically, Equation (1) addresses the total cost of the current planning (considering individual costs and production quantities). Meanwhile, Equations (2)-(5) provide us with information related to production and its development, starting from the establishment of the initial parameters (\(s_{int}^{0}\) and \(r_{ini}^{0}\)) up to the production dynamics (capacity evolution in each period and production balance per cycle and period).  
In greater detail, we have the following: the objective function of model \(f^{k}\) in Equation (1) corresponds to the minimization of the production cost in the intervals of time horizon sliding \([k,\ldots,t^{\prime}]\). In this way, \(k\) and \(t^{\prime}=k+n-1\) are the first and last periods of the mobile planning horizon of length \(n\) in each cycle \(k\). Constraint (2) relates production and the corresponding setup, where setup \(=1\) when there is production and 0 otherwise. Constraint (3) restricts production according to the capacity. Constraints (4) and (5) set the initial inventory conditions, backorders, and the balance between the two. The problem covers each cycle \(k\) concerning schedules of precedent cycles. In this problem, the objective function (1) minimizes the value between the production quantity of product \(i\) in period \(t\) in cycle \(k\) (\(Q_{it}^{k}\)) related to the cycle \(k-1\).