# Model Predictive Control for Flexible Job Shop Scheduling in Industry 4.0 +
## 3 Model Generation
### Generation of the Discrete Time Petri Net Model
_a shortest sufficient prediction horizon_ \(N_{O}\) _for the operation_ \(O=(\tau,I)\)_, then there exists a shortest sufficient prediction horizon_ \(N_{I}=\max_{\tau\in\mathcal{T}_{I}}N_{O}\) _with the property that for every_ \(N\geq N_{I}\) _the job_ \(J\) _will eventually be completed when applying the MPC (_6_) in closed loop (_7_) from any initial state_ \(x^{0}\in\mathbb{X}_{I,S}\coloneqq\bigcup_{\tau\in\mathcal{T}_{I}}\mathbb{X}_{O,S}\)_._
2. _a shortest sufficient extended prediction horizon_ \(N_{O}^{+}\) _for the operation_ \(O=(\tau,I)\)_, then there exists a shortest sufficient extended prediction horizon_ \(N_{I}^{+}=\max_{\tau\in\mathcal{T}_{I}}N_{O}^{+}\) _with the property that for every_ \(N\in\mathbb{N}_{>0}\) _and every_ \(N^{+}\geq N_{I}^{+}\) _the job_ \(J\) _will eventually be completed when applying the MPC (_16_) with the terminal cost (_17_) in closed loop (_7_) from any initial state_ \(x^{0}\in\mathbb{X}_{I,S}\coloneqq\bigcup_{\tau\in\mathcal{T}_{I}}\mathbb{X}_{O,S}\)_._

**Corollary 3** (Completion of the production problem [18]). : _Given a Petri Net of a flexible manufacturing system in its state space form (3), (4) generated with the Algorithms 1 and 2 that fulfills the Assumptions 1 and 2. If for every job \(J\in\mathcal{J}\) there exists_

1. _a shortest sufficient prediction horizon_ \(N_{J}\)_, then there exists a shortest sufficient prediction horizon_ \(N_{\min}=\max_{J\in\mathcal{J}}N_{I}\) _with the property that for every_ \(N\geq N_{\min}\) _the given production problem will eventually be completed when applying the MPC (_16_) with the terminal cost (_17_) in closed loop (_7_) from any initial state_ \(x^{0}\in\mathbb{X}_{S}\coloneqq\bigcap_{J\in\mathcal{J}}\mathbb{X}_{I,S}\)_._
2. _a shortest sufficient extended prediction horizon_ \(N_{I}^{+}\)_, then there exists a shortest sufficient extended prediction horizon_ \(N_{\min}^{+}=\max_{J\in\mathcal{J}}N_{I}^{+}\) _with the property that for every_ \(N\in\mathbb{N}_{>0}\) _and every_ \(N^{+}\geq N_{\min}^{+}\) _the given production problem will eventually be completed when applying the MPC (_16_) with the terminal cost (_17_) in closed loop (_7_) from any initial state_ \(x^{0}\in\mathbb{X}_{S}\coloneqq\bigcap_{J\in\mathcal{J}}\mathbb{X}_{I,S}\)_._

The proofs for the cases (a) of the Corollaries 2 and 3 can be found in [18] and those for case (b) follow directly. With the results provided in this section, we show the applicability of MPC to the scheduling of a JMPMSF. It is guaranteed that the MPC always yields a feasible solution and conditions are provided which allow to parametrize the MPC in a way that ensures the completion of the scheduling problem. The modular structure of the PN model for the JMPMSF is exploited by first determining the shortest sufficient prediction horizons \(N_{O}/N_{O}^{+}\) for every operation of a job in order to guarantee their completion. From them, the shortest sufficient prediction horizons \(N_{J}/N_{I}^{+}\) for every job of the production problem are determined, which can finally be used to compute the shortest sufficient prediction horizon \(N_{\min}/N_{\min}^{+}\) that guarantees the completion of the production problem. In the next Section we show with two numerical examples how the MPC scheme (16) with the terminal cost (17) can be applied. ## 5 Numerical Examples

In order to illustrate the applicability of the MPC scheme presented in Section 4, we simulate one small- and one medium-sized scheduling problem from literature. From the set of problems used by [PERSON] et al. [37] for evaluating their methods we select \"sops1.json\" and \"mops1.json\", which can be found at [[https://willtl.github.io/ops](https://willtl.github.io/ops)]([https://willtl.github.io/ops](https://willtl.github.io/ops)) (accessed on 20 August 2021). As we do not consider all effects that are handled by [PERSON] et al. [37], we omit some particularities and only simulate the scheduling problems in the form described in Section 2.