# Integration of Production Planning and Scheduling Based on RTN Representation under Uncertainties
## 2 Mathematical Model
### Planning Layer Model
#### 2.1.1 Deterministic Model  
1. Objective function:  
\[max\!\!\sum_{i\in G_{\eta}}\sum_{k\in K}[Price_{i}\cdot D(i,k)-\alpha\cdot Price _{i}\cdot Td(i,k)-\beta\cdot Flu(i,k)-\theta\cdot Inv(i,k)]. \tag{1}\]  
The maximum of profit is taken as the objective function of the production planning layer model, where the first part represents the product profit, the second part represents the punishment cost caused by the backlog order quantity of the products, the third part represents the cost paid due to the impact of the productivity fluctuation in the production processes, and the fourth part represents the cost paid when the inventory quantity exceeds the safe limit of inventory. 2. Material balance constraints:  
\[S(i,k)=S(i,k-1)+P(i,k)-D(i,k)-\sum_{j\in N_{i}}c_{ij}\cdot P(j,k);i\in G_{all} \,k>1\,k\in K. \tag{2}\]  
\[S(i,k)=S_{i}^{ini}+P(i,k)-D(i,k)-\sum_{j\in N_{i}}c_{ij}\cdot P(j,k)\ ;i\in G_{all}\,k=1\,k\in K. \tag{3}\]  
Constraints (2) and (3) respectively represent the material balance in the subsequent period and the initial period. The inventory \(s(i,k)\) of the material status \(i\) at the end of the planning period \(k\) is equal to the inventory at the end of the previous period \(s(i,k-1)\) plus the output of current period \(p(i,k)\), and finally minus the delivery of current period \(D(i,k)\) and the corresponding consumption \(\sum\limits_{j\in N_{i}}c_{ij}\cdot P(j,k)\), which is consumed by downstream production. Among them, \(N_{i}\) is the downstream material set of material state \(i\); \(c_{ij}\) is the conversion coefficient between material state \(i\) and material state \(j\). 3. Demand constraints:  
\[Td(i,k)=Td(i,k-1)+Ord_{ik}-D(i,k);i\in G_{p},k>1,k\in K. \tag{4}\]  
\[D(i,k)\leq Ord_{ik}+Td(i,k-1)+td_{i,k};i\in G_{p},k>1,k\in K. \tag{5}\]  
Constraint (4) represents that the backlog order quantity \(Td(i,k)\) of product \(i\) in the period \(k\) is equal to the backlog order quantity in the previous period \(Td(i,k-1)\) plus the order quantity in the current period \(Ord_{ik}\), minus the final delivery \(D(i,k)\). In Constraint (5), \(td_{i,k}\) is a parameter in the model and, as a backlog order quantity generated by the scheduling layer, feedback to the next planning period, where, the delivery quantity \(D(i,k)\) should be less than or equal to the sum of the order quantity of this period and backlog order quantity of the previous period, as well as the backlog order quantity from the scheduling layer in the previous period. 4. Production Capacity and Productivity Fluctuation Constraints:  
\[P_{i}^{\min}\leq P(i,k)\leq P_{i}^{\max}\ ;i\in G_{ip}\,k\in K. \tag{6}\]  
\[P(i,k)-Flu(i,k)\leq P(i,k-1)\leq P(i,k)+Flu(i,k);i\in G_{ip}\,k>1,\ k\in K. \tag{7}\]  
Constraint (6) represents the production capacity constraint of materials. Material status \(i\) produced in the period \(k\) should be between maximum production capacity \(P_{i}^{\max}\) and the minimum production capacity \(P_{i}^{\min}\). In order to avoid excessive fluctuation of productivity in the adjacent periods, auxiliary variable \(Flu(i,k)\) is introduced into Constraint (7) and corresponding penalty weight \(\beta\) is introduced into the objective function, so as to reduce the loss caused by productivity fluctuation as much as possible. 5. Inventory constraints:  
\[S_{i}^{\min}\leq S(i,k)\leq S_{i}^{\max}\ ;i\in G_{ip}\,k\in K. \tag{8}\]  
\[S_{i}^{LI}-Inv(i,k)\leq S(i,k)\leq S_{i}^{ll}+Inv(i,k);i\in G_{ip},k\in K. \tag{9}\]  
Constraint (8) represents the inventory of material status \(i\) at the end of the period \(k\). \(S(i,k)\) should be between the inventory upper limit \(S_{i}^{\max}\) and the inventory lower limit \(S_{i}^{\min}\). In order to avoid the situation that the inventory storage level is too high or too low, auxiliary variable \(Inv(i,k)\) is introduced into Constraint (9), and penalty weight \(\theta\) is introduced into the corresponding objective function.