# A Theoretical Foundation for Context-Aware Cyber-Physical Production Systems
## 5 Approach to Deadline Awareness Problem and Future States Awareness Problem
### An Optimization Approach to Determining a Control Policy for CPPS
Nominal Optimization Problem (NOP) based on the Joint Spatial-Temporal Network  
\[\min_{f}\sum_{j\in J}\sum_{r\in\mathbf{R}}\sum_{t\in\prod a(v,w)\in A_{j\tau}} \lambda(a(v,w))f(a(v,w)) \tag{1}\]  
\[\sum_{j\in J}\sum_{a(v,w)\in A_{j\tau}}f(a(v,w))\leq C_{r\tau}\forall\tau\in \mathbf{R}\,\forall\tau\in\prod=\{1,2,...,\Pi\} \tag{2}\]  
\[\sum_{w\in V(v)}f(a(v,w))=0\,\forall v\in V\backslash\{s\}\backslash\{e_{j} \forall j\in\mathbf{J}\} \tag{3}\]  
\[\sum_{w\in V_{j}(s)}f(a(s,w))=D_{j}\ \forall j\in\mathbf{J} \tag{4}\]  
\[\sum_{w\in V_{j}(e_{j})}f(a(w,e_{j}))=D_{j}\ \forall j\in\mathbf{J} \tag{5}\]  
\[f(a(v,w))\in Z\ \forall a(v,w)\in A, \tag{6}\]  
where \(Z\) is the set of nonnegative integers. A solution of NOP can be used to define the control actions to bring \(G_{c}\) from \(m_{0}\) to \(m_{f}\) without visiting undesirable states. Whether the deadline can be met depends on the solution found for NOP. Theorem 1 states a condition for ensuring the liveness of \(G_{c}(m_{0},u)\). In the proof of this theorem, we first define the control actions based on a solution of NOP. We then prove that the control actions will bring \(G_{c}\) from \(m_{0}\) to \(m_{f}\) without visiting undesirable states. **Theorem 1**. : _There exists a solution to the Nominal Optimization Problem if and only if there exists a control policy under which \(G_{c}(m_{0},u)\) is live and can reach \(m_{f}\) under \(u\)._  
Proof. : **Proof of \"only if part\":**  
We prove by constructing a control policy under which \(G_{c}(m_{0},u)\) is live given the precondition that there exists a solution \(f\) to NOP. To construct a control policy under which \(G_{c}(m_{0},u)\) is live, we first define the control actions for the given solution \(f\) based on the following definitions of control actions. The set of arcs in STN \(STN_{j}(V_{j},A_{j})\) can be divided into three subsets, \(W_{j}\), the set of arcs corresponding to waiting states, \(B_{j}\), the set of arcs corresponding to busy (processing) states. There is a transition \(t\in T_{j}\) corresponding to an arc \(a\in B_{j}\). Suppose the time horizon is divided into \(\Pi\) period. Let \(\{1,2,...,\Pi\}\) denote the set of time period. A control action for time period \(\tau\in\{1,2,...,\Pi\}\) is denoted by \(c_{\tau}\) and \(c_{\tau}(t)\) denotes the control action to be applied to transition \(t\in T_{j}\) in period \(\tau\in\{1,2,...,\Pi\}\). For each arc \(a\in B_{j}\), \(j\in J\), starting with period \(\tau\in\{1,2,...,\Pi\}\), let \(t_{a}\) be the transition associated with arc \(a\). We define the control action \(c_{\tau}(t_{a})=f(a)\), which will be applied to fire transition \(t\in T_{j}\) corresponding to an arc \(a\in B_{j}\) in period \(\tau\) for \(f(a)\) times. These control actions \(c_{\tau}\), \(\tau\in\{1,2,...,\Pi\}\), define a control policy \(u\) associated with the solution \(f\). Based on the above definitions, we show that the control actions \(c_{\tau}\), \(\tau\in\{1,2,...,\Pi\}\) defined above can be executed. That is, for each \(t\in T_{j}\), \(t\) can be fired \(c_{\tau}(t_{a})=f(a)\) times in period \(\tau\). We prove by showing that under the marking \(m_{\tau}\) reached after applying the control actions \(c_{1}\), \(c_{2}\), \(c_{3}\),..., \(c_{\tau}\), there exists a control policy \(u^{\prime}\) under which \(G_{c}(m_{\tau},u^{\prime})\) is live. For \(\tau=1\), we prove that the control action applied to all relevant transitions in period 1 can be executed. Note that the number of type-\(r\) resources required to fire transitions in type-\(j\) subnet in period 1 is \(\sum\limits_{a\in A_{j\eta 1}}c_{1}(t_{a})=\sum\limits_{a\in A_{j\eta 1}}f(a)\). The total number of type-\(r\) resources required to fire transitions in type-\(j\) subnet in period 1 is \(\sum\limits_{j\in I}\sum\limits_{a\in A_{j\eta 1}}c_{1}(t_{a})\), which is equal to \(\sum\limits_{j\in I}\sum\limits_{a\in A_{j\eta 1}}f(a)\). The total number of type-\(r\) resources required to fire transitions in type-\(j\) subnet in period 1 is \(C_{r1}\).