## 3 Regulation Control for IPN
The mapping \(\mathbf{\Pi}\) is computed by a linear integer programming problem (LIPP) that minimizes the number of firings between the plant markings (described by Parikh vectors \(\vec{\sigma_{k}}\)), subject to \(\tilde{\boldsymbol{\varphi}}=\mathbf{\Omega}\boldsymbol{\varphi}\mathbf{\Pi}\), \(\mathbf{\Pi}\tilde{\mathbf{M}}_{0}=\mathbf{M}_{0}\), \(\mathbf{\Pi}\mathbf{C}\vec{\sigma_{k}}=\mathbf{C}\vec{\sigma_{k}}\) for all \(\vec{\epsilon_{k}}\in\Upsilon\), and the entries of \(\mathbf{\Pi}\) and vectors \(\vec{\sigma_{k}}\) are non-negative integers. 2. For each specification transition \(\vec{I}_{k}\), such that \(\tilde{\mathbf{M}}_{k}[\vec{I}_{k}>\tilde{\mathbf{M}}_{k+1}\), for some reachable \(\tilde{\mathbf{M}}_{k}\), a fireable controllable Plant sequence \(\sigma_{k}\) is computed, such that \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k}[\sigma_{k}>\mathbf{\Pi}\tilde{\mathbf{M}}_{ k+1}\). Thus, if \(\vec{I}_{k}\) is fired in the Specification, reaching \(\tilde{\mathbf{M}}_{k+1}\), then the Controller must induce the firing of \(\sigma_{k}\) to reach \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k+1}\), so the output error becomes null. This is performed by the \(A^{*}\) Algorithm 1, which computes a sequence with the minimum length that drives the Plant from \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k}\) to \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k+1}\). In the algorithm, the starting node is the empty sequence \(\sigma_{\varepsilon}\); next, for each new node \(\sigma\), the cost function is defined as \(f(\sigma)=|\sigma|+|\vec{\sigma}-\vec{\sigma}_{k}||_{1}\) (where \(||\bullet||_{1}\) denotes the 1-norm), and the reached marking \(\mathbf{M}_{\text{{reached}}}(\sigma)\) is computed (i.e., \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k}[\sigma>\mathbf{M}_{\text{{reached}}}( \sigma))\). Some conditions are included to ensure controllability (lines 7-10 and 12). 3. Finally, an \(IPN\) controller \(\hat{Q}\) is built, which enforces the previously computed Plant sequences \(\sigma_{k}\), through the indication of Plant input symbols, when the corresponding specification transitions \(\vec{I}_{k}\) have been fired. ```
1 Input:\(IPN\) Plant structure \(Q\), starting marking \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k}\), ending marking \(\mathbf{\Pi}\tilde{\mathbf{M}}_{k+1}\),
2 Parikh vector \(\vec{\sigma}_{k}\). 3 Output: Controllable sequence \(\sigma_{k}\). 4 Initialize \(Open=\{\sigma_{\varepsilon}\}\) and \(Closed=\emptyset\). Set \(\mathbf{M}_{\text{{reached}}}(\sigma_{\varepsilon})=\mathbf{\Pi}\tilde{ \mathbf{M}}_{k}\). Set \(f(\sigma_{\varepsilon})=||\vec{\sigma}_{k}||_{1}\). 5 while\(Open\
eq\emptyset\)do
6 Find the sequence \(\sigma\in Open\) with the lowest cost \(f(\sigma)\)
7 Compute the set of transitions that are marking-enabled at \(\mathbf{M}_{\text{{reached}}}(\sigma)\) as \(T_{\mathbf{M}}=\{t_{j}\in T|\forall p_{j}\in\mathbf{\tau}\,t_{j}\}\), \(\mathbf{M}_{\text{{reached}}}(\sigma)[i]\geq I(p_{i},t_{j})\}\)
8 if\(\exists t_{i}\), \(t_{j}\in T_{\mathbf{M}}\), such that \(\lambda_{I}(t_{i})=\lambda_{I}(t_{j})=\emptyset\)then
9 Update \(T_{\mathbf{M}}=\emptyset\)
10 if\(\exists t_{i}\in T_{\mathbf{M}}\), such that \(\lambda_{I}(t_{i})=\emptyset\)then
11 Update \(T_{\mathbf{M}}=\{t_{i}\}\)
12 for each \(t\in T_{\mathbf{M}}\)do
13 if\(\
exists\vec{\sigma}^{\prime}\in T_{\mathbf{M}}\), such that \(\lambda_{I}(t^{\prime})\subseteq\lambda_{I}(t)\)then
14 Define \(\sigma^{\prime}=\sigma t\)
15 Define \(\mathbf{M}_{\text{{reached}}}(\sigma^{\prime})=\mathbf{M}_{\text{{reached}}}( \sigma)+\mathbf{C}\vec{\epsilon}\)
16 Define \(f(\sigma^{\prime})=|\sigma^{\prime}|+||\vec{\sigma}^{\prime}-\vec{\sigma}_{k}||_ {1}\)
17 if\(\mathbf{M}_{\text{{reached}}}(\sigma^{\prime})=\mathbf{\Pi}\tilde{\mathbf{M}}_{ k+1}\)then
18 Define \(\sigma_{k}=\sigma^{\prime}\)
19 Stop the algorithm. 20 if\(\sigma^{\prime}\
otin Closed\cup Open\)then
21 Set \(Open=Open\cup\{\sigma^{\prime}\}\)
22
23 Update \(Closed=Closed\cup\{\sigma\}\), \(Open=Open\setminus\{\sigma\}\)
```  
**Algorithm 1**Computation of a controllable sequence \(\sigma_{k}\).