# Model Predictive Control for Flexible Job Shop Scheduling in Industry 4.0 +
## 3 Model Generation
### Generation of the Discrete Time Petri Net Model
\begin{array}{rcl}c_{\rm P}(M^{\prime},O)+(N-\tilde{k})\,c(x^{O,S},0)&>&c_{ \rm P}(M,O)+\big{(}N-k_{\rm P}(M,\tau)\big{)}\,c(x^{O,C},0)\\ N&>&\frac{c_{\rm P}(M,O)-c_{\rm P}(M^{\prime},O)+\tilde{k}\,c(x^{O,S},0)-k_{ \rm P}(M,\tau)c(x^{O,C},0)}{c(x^{O,S},0)-c(x^{O,C},0)}.\end{array}  \tag{15}\]

As the right hand sides of (14) and (15) only depend on system parameters that are assumed to be known, these inequalities can always be fulfilled with a large enough value of \(N\). In the cases where a final steady state is reached, all trajectories that lead to a steady state \(x^{C,1}\) with higher cost as \(x^{O,C}\), i.e., \(c(x^{C,1},0)>c(x^{O,C},0)\), clearly lead to higher cost over a large prediction horizon \(N\) and will not be the optimal input trajectory \(u^{*}(\cdot|k)\). In the fourth case, choosing a trajectory that does not lead to \(x^{O,C}\) only changes \(c_{\rm P}(M^{\prime},O)\). From Equation (15) it can be seen that an arbitrary, possibly even negative, production cost of the first production steps \(c_{\rm P}(M^{\prime},O)\) can still be compensated by increasing \(N\). _Part II:_

Suppose there is at least one other operation \(O^{\prime}\) that can be executed at \(x^{O,S}\), i.e., \(x^{O,S}\in\mathbb{X}_{O^{\prime},S}\), then there are two possibilities:

* \(O\) and \(O^{\prime}\) are executed at the same time, either because there is no input vector \(u\) starting \(O\) and \(O^{\prime}\) and satisfying the non-negativity constraint (3), or because only executing one of them leads to a better solution of the MPC problem (6), i.e., an input trajectory \(u^{*}(\cdot|k)\) that leads to lower cost over the prediction horizon \(N\). In the case A, we know that the system will enter another steady state \(x^{C,2}\) due to Property (P8). To proof the existence of the shortest sufficient prediction horizon, we have to assume that \(x^{C,2}\) is reached during prediction, which can be achieved by increasing \(N\). We neither have any information on the cost of the resulting steady state \(x^{C,2}\) after the completion of both operations, nor do we have information on the number of production steps and the production cost of both operations at the same time. As for the considerations in the cases in Part I, in which only the operation \(O\) can be started, the effects of the number of production steps and the production cost can be compensated by increasing \(N\). If the cost of the resulting steady state \(x^{C,2}\) is smaller than the cost of the initial state \(x^{O,S}\), i.e., \(c(x^{C,2},0)<c(x^{O,S},0)\), the same arguments as in Part I prove that leaving \(x^{O,S}\) immediately in order to reach \(x^{C,2}\) as soon as possible is the optimal choice and thus with \(u^{*}(0|k)\) either \(O\), or \(O^{\prime}\), or both are started. If \(O\) or both operations are started, the proof is completed. If another operation \(O^{\prime}\) is started with \(u^{*}(0|k)\in\mathbb{U}_{O^{\prime},S}\), it is not directly guaranteed that \(O\) will be started. However, due to Properties (P8) and (P9), the closed loop system will then eventually enter another steady state \(x^{O,S,2}\in\mathbb{X}_{O,S}\). In this state, due to the precondition of Theorem 1, there is another steady state \(x^{O,C,2}\in\mathbb{X}_{O,C}\), for which all the arguments in this proof apply. As there are only finitely many operations due to Assumption 1, this recursion can only occur finitely often and eventually the system will enter a steady state \(x^{O,S,3}\in\mathbb{X}_{O,S}\) in which due to the precondition of Theorem 1 a steady state \(x^{O,C,3}\in\mathbb{X}_{O,C}\) exists and the operation \(O\) is executed. This happens at latest if \(O\) is the only operation left and the arguments in Part I hold. Note that instead of \(O^{\prime}\) also multiple operations at the same time can be considered in this paragraph on the case A. In the case B, in which the operations \(O\) and \(O^{\prime}\) are executed sequentially, either \(O\) is executed first and, due to the same arguments as in Part I, will be executed immediately.