# Model Predictive Control for Flexible Job Shop Scheduling in Industry 4.0 +
## 3 Model Generation
### Generation of the Discrete Time Petri Net Model
Or operation \(O^{\prime}\) is executed first, which can only occur if the execution of \(O^{\prime}\) yields more benefit over the prediction horizon \(N\) as the execution of \(O\). As argued in Part I, this can only be in combination with a steady state \(x^{O^{\prime},C}\in\mathbb{X}_{O^{\prime},C}\) with \(c(x^{O^{\prime},C},0)<c(x^{O,S},0)\). Therefore, the arguments used in Part I prove that operation \(O^{\prime}\) is executed immediately through an input vector \(u^{*}(0|k)\in\mathbb{U}_{O^{\prime},S}\). Due to the Properties (P8) and (P9), the closed loop system will then eventually enter another steady state \(x^{O,S,2}\in\mathbb{X}_{O,S}\) for which due to the precondition of Theorem 1, there is a steady state \(x^{O,C,2}\in\mathbb{X}_{O,C}\) satisfying condition (8), for which all the arguments in this proof apply. As argued in the case A, this recursion can only occur finitely often due to Assumption 1, which proves the ultimate completion of the operation \(O\). Theorem 1 shows that a cost decrease between starting states and completion states drives the production process. Through the arguments to prove Theorem 1, it can be seen that such a cost decrease combined with a long enough prediction horizon \(N\) incentivizes an immediate start of operations. Therefore, it implicitly leads to a minimization of the production time, or at least to a short production time under consideration of the given cost function. With Theorem 1, a rigorous condition is provided to examine whether a large enough prediction horizon can lead to the guaranteed completion of the investigated operation. The proof of Theorem 1 illustrates, however, that a cheap initial state combined with cheap production processes and expensive final states can lead to the situation in which the optimal predicted trajectory stays in the initial state for some time before the production process is planned to be initiated. As only the optimal first input \(u^{*}(0|k)=0\) is applied, under those circumstances no production is started at all. ### Mpc Formulation with Terminal Cost

Theorem 1 is based on extending the prediction horizon \(N\) such that staying at a final steady state \(x^{O,C}\) with low cost \(c(x^{O,C},0)\) for a long amount of time will incentivize the immediate start of an operation. Due to Property (P8), this leads to the completion of the investigated operation. This insight can be used to formulate a more efficient MPC problem with terminal cost that has similar properties:

\[\underset{u(\cdot|k)}{\text{minimize}} \sum_{k=0}^{N-1}c\big{(}x\big{(}\bar{k}|k\big{)},u\big{(}\bar{k}| k\big{)}\big{)}+V_{f}(x(N|k)) \tag{16a}\] \[\text{subset to} x\big{(}\bar{k}+1|k\big{)}=Ax\big{(}\bar{k}|k\big{)}+Bu\big{(} \bar{k}|k\big{)}\] (16b) \[0\leq x\big{(}\bar{k}|k\big{)}-B^{-}u\big{(}\bar{k}|k\big{)}\] (16c) \[u\big{(}\bar{k}|k\big{)}\in\mathbb{N}^{m}\] (16d) \[x(0|k)=x(k). \tag{16e}\]In this formulation, the terminal cost \(V_{f}:\mathbb{N}^{n}\to\mathbb{R}\) is introduced with respect to the previous formulation of the MPC problem (6). It can be used in order to capture the cost of resting in a final steady state for an extended amount of time. By assigning

\[V_{f}(x)=\sum_{k=0}^{N^{+}}c\left(A^{k}x,0\right), \tag{17}\]

the cost of assigning the input \(u(\bar{k}|k)=0\) for \(k=N,\dots,\ N+N^{+}\) to the system is evaluated through \(V_{f}(x(N|k))\). This strategy to enlarge the prediction horizon by finite amount \(N^{+}\) over which the control input is kept constant is a well-known strategy in MPC literature [59]. It is known that capturing the cost over this extended period of time in a terminal cost can be used to prove stability of the closed loop system. Due to Property (P8), for a sufficiently long extended prediction horizon \(N^{+}\) the system converges to a steady state and stays there as long as the input \(u(\bar{k}|k)=0\) is applied. With this insight, we can formulate the following corollary. **Corollary 1** (Completion of an operation with the MPC with terminal cost).