# Cost Problems for Parametric Time Petri Nets

Didier Lime, Charlotte Seidner, Olivier Henri Roux

► To cite this version:

Didier Lime, Charlotte Seidner, Olivier Henri Roux. Cost Problems for Parametric Time Petri Nets. Fundamenta Informaticae, 2021, 10.3233/fi-2021-2083. hal-03561426

HAL Id: hal-03561426

https://hal.science/hal-03561426v1

Submitted on 21 Mar 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Cost Problems for Parametric Time Petri Nets*

**Didier Lime**†, **Olivier H. Roux**

École Centrale de Nantes

LS2N UMR CNRS 6004, Nantes, France

{Didier.Lime, Olivier-h.Roux}@ec-nantes.fr

**Charlotte Seidner**

Université de Nantes

LS2N UMR CNRS 6004, Nantes, France

Charlotte.Seidner@univ-nantes.fr

**Abstract.** We investigate the problem of parameter synthesis for time Petri nets with a cost variable that evolves both continuously with time, and discretely when firing transitions. More precisely, parameters are rational symbolic constants used for time constraints on the firing of transitions and we want to synthesise all their values such that some marking is reachable, with a cost that is either minimal or simply less than a given bound.

We first prove that the mere existence of values for the parameters such that the latter property holds is undecidable. We nonetheless provide symbolic semi-algorithms for the two synthesis problems and we prove them both sound and complete when they terminate. We also show how to modify them for the case when parameter values are integers. Finally, we prove that these modified versions terminate if parameters are bounded. While this is to be expected since there are now only a finite number of possible parameter values, our algorithms are symbolic and thus avoid an explicit enumeration of all those values. Furthermore, the results are symbolic constraints representing finite unions of convex polyhedra that are easily amenable to further analysis through linear programming.

We finally report on the implementation of the approach in Romeo, a software tool for the analysis of time Petri nets.

**Keywords:** Time Petri nets, reachability, parameters, cost, optimality.

<footnote>*This work has been partially funded by ANR project ProMiS number ANR-19-CE25-0015</footnote>

<footnote>†Address for correspondence: École Centrale de Nantes, LS2N UMR CNRS 6004, Nantes, France</footnote>
# 1. Introduction

So-called *priced or cost timed* models are suitable for representing real-time systems whose behaviour is constrained by some resource consuming (be it energy or CPU time, for instance) and for which we need to assess the total cost accumulated during their execution. Such models can even describe whether the evolution of the cost during the run is caused by staying in a given state (continuous cost) or by performing a given action (discrete cost). Thus, the task of finding if the model can reach some “good” states while keeping the overall cost under a given bound (or, further, finding the minimum cost) can prove of interest in many real-life applications, such as optimal scheduling or production line planning.

Timed models, however, require a thorough knowledge of the system for their analysis and are thus difficult to build in the early design stages, when the system is not fully identified. Even when all timing constraints are known, the whole design process must often be carried out afresh, whenever the environment changes. To obtain such valuable characteristics as flexibility and robustness, the designer may want to relax constraints on some specifications by allowing them a wider range of values. To this end, parametric reasoning is particularly relevant for timed models, since it allows designers to use parameters instead of definite timing values.

We therefore propose to tackle the definition and analysis of models that support both (linear) cost functions and timed parameters.

**Related work** Parametric timed automata (PTA) [1] extend timed automata [2] to overcome the limits of checking the correctness of the systems with respect to definite timing constraints. The reachability-emptiness problem, which tests whether there exists a parameter valuation such that the automaton has an accepting run, is fundamental to any verification process but is undecidable [1]. L/U automata [3] use each parameter either as a lower bound or as an upper bound on clocks. The reachability-emptiness problem is decidable for this model, but the state-space exploration, which would allow for explicit synthesis of all the suitable parameter valuations, still might not terminate [4]. To obtain decidability results, the approach described in [4] does not rely on syntactical restrictions on guards and invariants, but rather on restricting the parameter values to bounded integers. From a practical point of view, this subclass of PTA is not that restrictive, since the time constraints of timed automata are usually expressed as natural (or perhaps rational) numbers.

In [5], the authors have proved the decidability of the optimal-cost problem for Priced Timed Automata with non-negative costs. In [6, 7, 8], the computation of the optimal-cost to reach a goal location is based on a forward exploration of zones extended with linear cost functions. In [9], the authors have improved this approach, so as to ensure termination of the forward exploration algorithm, even when clocks are not bounded and costs are negative, provided that the automaton has no negative cost cycles. In [10], the considered model is a timed arc Petri net, under weak firing semantics, extended with rate costs associated with places and firing costs associated with transitions. The computation of the optimal-cost for reaching a goal marking is based on similar techniques to [5]. In [11], the authors have investigated the optimal-cost reachability problem for time Petri nets where each transition has a firing cost and each marking has a rate cost (represented as a linear rate cost function over markings). To compute the optimal-cost to reach a goal marking, the authors have revisited the state class graph method to include costs.
**Our contribution** We propose in Section 2 an extension of time Petri nets with costs (both discrete and continuous with time) and timing parameters, i.e., rational symbolic constants used in the constraints on the firing times of transitions.

Within this formalism, we define three problems dealing with parametric reachability with cost constraints. We prove in Section 3 that the existence of a parameter valuation to reach a given marking under a given bounded cost is undecidable. This proof adapts a 2-counter machine encoding first proposed in [12] for PTA. To our knowledge it is the first time a direct Petri net encoding is provided and the adaptation is not trivial. We give in Section 4 a symbolic semi-algorithm that computes all such parameter valuations when it terminates, and we prove its correctness. We also provide another symbolic semi-algorithm that computes all parameter valuations such that a given marking is reachable with a minimal cost (over all runs and all parameter valuations), with corresponding completeness and soundness proofs. We propose in Section 5 variants of these semi-algorithms that compute integer parameter valuations and prove in Section 6 their termination provided parameter valuations are a priori bounded and the cost of each run is uniformly lower-bounded for integer parameter valuations. This technique is symbolic and avoids the explicit enumeration of all possible parameter valuations. The basic underlying idea of using the integer hull operator was first investigated in [4] for PTA, but this is the first time that it is adapted and proved to work with state classes for time Petri nets, and the fact that it naturally also preserves costs for integer parameter valuations is new and very interesting. We finally describe in Section 7 the implementation of the approach in the tool Romeo by analysing a small scheduling case-study. This article is an extension of [13], with mainly the addition of the optimal synthesis problem, algorithm, and implementation in Romeo.

# 2. Parametric cost time Petri nets

## 2.1. Preliminaries

We denote the set of natural numbers (including 0) by $\mathbb{N}$, the set of integers by $\mathbb{Z}$, the set of rational numbers by $\mathbb{Q}$ and the set of real numbers by $\mathbb{R}$. We note $\mathbb{Q}_{\ge 0}$ (resp. $\mathbb{R}_{\ge 0}$) the set of non-negative rational (resp. real) numbers. For $n \in \mathbb{N}$, we let $[0, n]$ denote the set $\{i \in \mathbb{N} \mid i \le n\}$. For a finite set $X$, we denote its size by $|X|$.

Given a set $X$, we denote by $\mathcal{I}(X)$, the set of non empty real intervals that have their finite endpoints in $X$. For $I \in \mathcal{I}(X)$, $\bar{I}$ denotes its left end-point if $I$ is left-bounded and $-\infty$ otherwise. Similarly, $\bar{I}$ denotes the right end-point if $I$ is right-bounded and $\infty$ otherwise. We say that an interval $I$ is non-negative if $I \subseteq \mathbb{R}_{\ge 0}$. Moreover, for any non-empty non-negative interval $I$ and any $d \in \mathbb{R}_{\ge 0}$ such that $d \le d'$ for some $d' \in I$, we let $I \ominus d$ be the interval defined by $\{\theta - d \mid \theta \in I \wedge \theta - d \ge 0\}$. Note that this is again a non-empty non-negative interval.

Given sets $V$ and $X$, a $V$-valuation (or simply valuation when $V$ is clear from the context) of $X$ is a mapping from $X$ to $V$. We denote by $V^X$ the set of $V$-valuations of $X$. When $X$ is finite, given an arbitrary fixed order on $X$, we often equivalently consider $V$-valuations as vectors of $V^{|X|}$. Given a $V$-valuation $v$ of $X$ and $Y \subseteq X$, we denote by $v|_Y$ the projection of $v$ on $Y$, i.e., the valuation on $Y$ such that $\forall x \in Y, v|_Y(x) = v(x)$.
## 2.2. Time Petri nets with costs and parameters

### Definition 2.1. (Parametric Cost Time Petri Net (pcTPN))

A Parametric Cost Time Petri Net (pcTPN) is a tuple $\mathcal{N} = (P, T, \mathbb{P}, \bullet, \cdot, m_0, I_s, \text{cost}_t, \text{cost}_m)$ where:

* $P$ is a finite non-empty set of *places*,

* $T$ is a finite set of *transitions* such that $T \cap P = \emptyset$,

* $\mathbb{P}$ is a finite set of *parameters*,

* $\bullet: T \to \mathbb{N}^P$ is the backward incidence mapping,

* $\bullet: T \to \mathbb{N}^P$ is the forward incidence mapping,

* $m_0 \in \mathbb{N}^P$ is the initial marking,

* $I_s: T \to \mathcal{I}(\mathbb{N} \cup \mathbb{P})$ is the (parametric) *static firing interval function*,

* $\text{cost}_t: T \to \mathbb{Z}$ is the *discrete cost function*, and

* $\text{cost}_m: \mathbb{N}^P \to \mathbb{Z}$ is the *cost rate function*.

Given a parameterized object $x$ (be it a pcTPN, a function, an expression, etc.), and a $\mathbb{Q}$-valuation $v$ of parameters, we denote by $v(x)$ the corresponding non-parameterized object, in which each parameter $a$ has been replaced by the value $v(a)$.

A marking is an $\mathbb{N}$-valuation of $P$. For a marking $m \in \mathbb{N}^P$, $m(p)$ represents a number of tokens in place $p$. A transition $t \in T$ is said to be enabled by a given marking $m \in \mathbb{N}^P$ if for all places $p$, $m(p) \ge \bullet t(p)$. We also write $m \ge \bullet t$. We denote by $\text{en}(m)$ the set of transitions that are enabled by the marking $m$: $\text{en}(m) = \{t \in T | m \ge \bullet t\}$.

Firing an enabled transition $t$ from marking $m$ leads to a new marking $m' = m - \bullet t + t^\bullet$. A transition $t' \in T$ is said to be newly enabled by the firing of a transition $t$ from a given marking $m \in \mathbb{N}^P$ if it is enabled by the new marking but not by $m - \bullet t$ (or it is itself fired)<fnref n="1" />.

We denote by $\text{newen}(m, t)$ the set of transitions that are newly enabled by the firing of $t$ from the marking $m$: $\text{newen}(m, t) = \{t' \in \text{en}(m - \bullet t + t^\bullet) | t' \notin \text{en}(m - \bullet t) \text{ or } t = t'\}$

A state of the net $\mathcal{N}$ is a tuple $(m, I, c, v)$ in $\mathbb{N}^P \times \mathcal{I}(\mathbb{R}_{\ge 0})^T \times \mathbb{R} \times \mathbb{Q}_{\ge 0}^P$, where: $m$ is a marking of $\mathcal{N}$, $I$ is called the interval function and associates a *temporal interval* to each transition enabled by $m$. Value $c$ is the cost associated with that state and valuation $v$ assigns a rational value to each parameter for the state.

### Definition 2.2. (Semantics of a pcTPN)

The semantics of a pcTPN is a timed transition system $(Q, Q_0, \to)$ where:

* $Q \subseteq \mathbb{N}^P \times \mathcal{I}(\mathbb{R}_{\ge 0})^T \times \mathbb{R} \times \mathbb{Q}_{\ge 0}^P$

* $Q_0 = \{(m_0, I_0, 0, v) | v \in \mathbb{Q}_{\ge 0}^P, \forall t \in T, v(I_s(t)) \neq \emptyset\}$ where $\forall t \in \text{en}(m_0), I_0(t) = I_s(t)$

* $\to$ consists of two types of transitions:

<footnote n="1">¹With that definition we use the classical “intermediate semantics” of Berthomieu [14]. A study of alternative semantics can be found in [15].</footnote>
- discrete transitions: $(m, I, c, v) \xrightarrow{t \in T} (m', I', c', v)$ iff

$$ \begin{array}{l} * m \geq \bullet t, m' = m - \bullet t + t^{\bullet} \text{ and } I(t) = 0, \\ * \forall t' \in \mathbf{en}(m') \end{array} $$

$$ \bullet I'(t') = v(I_s(t')) \text{ if } t' \in \mathbf{newen}(m, t), $$

$$ \bullet I'(t') = I(t') \text{ otherwise} $$

$$ * c' = c + \mathbf{cost}_t(t) $$

- time transitions: $(m, I, c, v) \xrightarrow{d \in \mathbb{R}_{\ge 0}} (m, I \ominus d, c', v)$, iff $\forall t \in \mathbf{en}(m), \exists d' \in I(t) \text{ s.t. } d \le d'$ and $c' = c + \mathbf{cost}_m(m) * d$.

A run of a pcTPN $\mathcal{N}$ is a possibly infinite sequence $q_0a_0q_1a_1q_2a_2\cdots$ such that $q_0 \in Q_0$, for all $i > 0$, $q_i \in Q$, $a_i \in T \cup \mathbb{R}_{\ge 0}$ and $q_i \xrightarrow{a_i} q_{i+1}$. The set of runs of $\mathcal{N}$ is denoted by Runs($\mathcal{N}$). We note $(m, I, c, v) \xrightarrow{t@d} (m', I', c', v)$ for the sequence of elapsing $d \ge 0$ followed by the firing of the transition $t$. We denote by sequence($\rho$) the projection of the run $\rho$ over $T$: for a run $\rho = q_0 \xrightarrow{t_0@d_0} q_1 \xrightarrow{t_1@d_1} q_2 \xrightarrow{t_2@d_2} q_3 \xrightarrow{t_3@d_3} \cdots$, we have sequence($\rho$) = $t_0t_1t_2t_3\cdots$. We write $q \xrightarrow{t} q'$ if there exists $d \ge 0$ such that $q \xrightarrow{t@d} q'$.

For a finite run $\rho$ we denote by last($\rho$) the last state of $\rho$ and by lastm($\rho$) its marking. A state $(m, I, c, v)$ is said to be reachable if there exists a finite run $\rho$ of the net, with last($\rho$) = $(m, I, c, v)$. A marking $m$ is reachable for parameter valuation $v$, if there exists some $I$ and $c$ such that $(m, I, c, v)$ is reachable.

For $k \in \mathbb{N}$ and parameter valuation $v$, the (Cost) Time Petri net $v(\mathcal{N})$ is said to be $k$-bounded if for all reachable markings $m$, and all places $p, m(p) \le k$. We say that $v(\mathcal{N})$ is bounded if there exists $k$ such that it is $k$-bounded.

The cost cost($\rho$) of a finite run $\rho$, with last state $(m, I, c, v)$ is $c$.

Since we are interested in minimising the cost, the cost of a sequence of transitions $\sigma$ is defined as cost($\sigma$) = $\inf_{\rho \in \text{Runs}(\mathcal{N}), \text{sequence}(\rho)=\sigma}$ cost($\rho$).

For the sake of the clarity of the presentation, we consider only closed intervals (or right-open to infinity) so this infimum is actually a minimum.

<figure><img src="image_2.png" /><figcaption>Figure 1. A parametric cost time Petri net.</figcaption></figure>
**Example 2.3.** Consider the net in Figure 1. It has one parameter $a$, and the cost increases with time with a rate equal to twice the number of tokens in $p_0$ + once the number of tokens in $p_1$. It also increases by 2 when firing $t_0$ and does not change when firing $t_1$ (so we omit it in the figure). For parameter value $v(a) = 2$, the initial state is $(\{p_0, p_1\}, I(t_0) = [2, 2], I(t_1) = [2, 5], 0, 2)$. We write the marking as the set of marked places because the net is safe to make it simpler. Cost is initially 0.

Then a possible run is:

$$ (\{p_0, p_1\}, I(t_0) = [2, 2], I(t_1) = [2, 5], 0, 2) \xrightarrow{2} (\{p_0, p_1\}, I(t_0) = [0, 0], I(t_1) = [0, 3], 6, 2) \\ \xrightarrow{t_0} (\{p_0, p_1\}, I(t_0) = [2, 2], I(t_1) = [0, 3], 8, 2) \\ \xrightarrow{0.2} (\{p_0, p_1\}, I(t_0) = [1.8, 1.8], I(t_1) = [0, 2.8], 8.6, 2) \\ \xrightarrow{t_1} (\{p_0, p_2\}, I(t_0) = [1.8, 1.8], 8.6, 2) $$

## 2.3. Parametric cost problems

Given a set of target markings Goal, the problems we are interested in are:

1. the existential problem: Given a finite maximum cost value $c_{max}$, is there a parameter valuation $v$ such that some marking in Goal is reachable with a cost less than $c_{max}$ in $v(\mathcal{N})$?

2. the bounded synthesis problem: Given a finite maximum cost value $c_{max}$, compute all the parameter valuations $v$ such that some marking in Goal is reachable with a cost less than $c_{max}$ in $v(\mathcal{N})$.

3. the optimal synthesis problem: Compute the infimum of the cost of all runs that reach a marking in Goal, $\inf_{m \in \text{Goal}, v \in \mathbb{P}^Q, \rho \in \text{Runs}(\mathcal{N}), \text{lastm}(\rho) \in \text{Goal}} \text{cost}(\rho)$, and all the parameter valuations $v$ such that this infimum cost can be achieved in $v(\mathcal{N})$,

**Example 2.4.** For the net in Figure 1, there is no parameter valuations allowing to reach $p_2 = 1$ with a cost less or equal to 5, because we need to wait at least 2 time units (t.u.) before firing $t_1$ with a cost rate of 3. For a bound equal to 8, it will be $1 \le a$ so that $t_0$ fires at most once before $t_1$.

The minimum cost to reach $p_2 = 1$ is 6 and this can be achieved iff $2 \le a$, so that $t_0$ is not forced to fire before $t_1$.

We prove in Section 3 that the existential problem is undecidable.

## 3. Undecidability results

The existential parametric time bounded reachability problem for bounded parametric time Petri nets asks whether a given target marking is reachable for some valuation of the parameter(s) within $c_{max}$ time units. This is a special case of the existential cost bounded reachability problem defined in Section 2, with no discrete cost and a uniform cost rate of 1. Proposition 3.2 therefore implies the undecidability of that more general problem.

As in [1], our proof is based on a blocking variant of classical two counter machines. We first prove the undecidability of the halting problem for this variant in Lemma 3.1, since this has to the best of our knowledge never been done formally.
**Lemma 3.1.** Consider a non-deterministic counter machine with two non-negative counters $C_1$ and $C_2$, control states $\{s_1, \dots, s_n\}$, and, for $i, j \in \{1, \dots, n\}$, and $x \in \{1, 2\}$, instructions of the form:

1. in state $s_i$, increment counter $C_x$, and go to state $s_j$;

2. in state $s_i$, if $C_x > 0$ decrement $C_x$ and go to state $s_j$ else block;

3. in state $s_i$, if $C_x = 0$ then go to state $s_j$ else block.

Assume the machine halts when reaching $s_n$. Then the halting problem for such a machine, i.e., knowing whether the machine will eventually halt or not, is undecidable.

<figure><img src="image_3.png" /><figcaption>Figure 2. Increment gadget (left) and initial gadget (right)</figcaption></figure>

**Proof:**

Consider a classical deterministic Minsky machine [16], instead of our decrement and zero test it has instructions of the form: "in state $s_i$, if $C_x > 0$ decrement $C_x$ and go to state $s_j$ else go to $s_k$".

We can simulate such an instruction by a non-deterministic choice between instructions: "in state $s_i$, if $C_x > 0$ decrement $C_x$ and go to state $s_j$ else block" and "in state $s_i$, if $C_x = 0$ then go to state $s_k$ else block".

It is clear that the resulting machine has exactly one non-blocking path, corresponding to the path of the classical deterministic Minsky machine. Since the halting problem is undecidable for the latter, it is therefore undecidable for our blocking machines. $\square$

**Proposition 3.2.** Existential parametric time bounded reachability is undecidable for bounded parametric time Petri nets.
**Proof:**

Given a bounded parametric time Petri net $\mathcal{N}$, we want to decide whether there exists some parameter valuation $v$ such that some given marking can be reached within $c_{\max}$ time units in $v(\mathcal{N})$. The idea of this proof was first sketched in [12] for parametric timed automata. We encode the halting problem for two-counter machines, which is undecidable [16], into the existential problem for parametric time Petri nets.

We consider the 2-counter machine variant described in Lemma 3.1. The machine starts in state $s_0$ and halts when it reaches a particular state $s_{halt}$.

Given such a machine $\mathcal{M}$, we now provide an encoding as a parametric time Petri net $\mathcal{N}_\mathcal{M}$: each state $s_i$ of the machine is encoded as place, which we also call $s_i$. The encoding of the 2-counter machine $\mathcal{M}$ is as follows: it uses two rational-valued parameter $a$ and $b$, and three gadgets shown in Figure 2.a modelling three clocks $x, y, z$. Provided all intervals are closed, which is the case in this proof, for a state $(m, I, c, v)$, the duration for which an enabled transition $t$ has been continuously enabled, which we call *enabling time* of $t$, is $v(I_s(t) - I(t))$. For the gadget modelling clock $x$, the value of clock $x$ is equal to: i) the enabling time of transition $t_{x=b}$ when $P_{x \le b}$ is marked; ii) $b$ when $P_{x=b}$ is marked; iii) the sum of $b$ and the enabling time of transition $t_{x=a+b}$ when $P_{x \ge b}$ is marked (note that this value is lower than $a+b$); iv) $a+b$ when $P_{x=a+b}$ is marked; v) an unknown (and irrelevant) value in all other cases. The gadget encoding the increment instruction of $C_y$ is given in Figure 2.a. Clocks $x$ and $y$ store the value of each counter $C_x$ and $C_y$ as follows $x = b - aC_x$ and $y = b - aC_y$ when $z = 0$. The zero-test gadget is given in Figure 3. The system is studied over 2 time units, one of which is spent in the initialisation gadget.

**Initialisation** We use the gadget in Figure 2.b to initialise $a$ and $b$ such that $0 < a \le 1$ and $0 < b \le 1$. We explain how this works for $a$, the case of $b$ is similar. First, if $a = 0$ then $t_a$ must be fired at date 0 and the token produced in $P_a$ will be consumed by transition $\varepsilon_a$ before transition start has a chance to fire. Now, if we do not want the token produced in $P_1$ at date 1 to be consumed for sure by transition $\varepsilon_1$, transition $t_a$ must fire at date 1 at the latest, and therefore $a$ must be less than or equal to 1. Finally, when $0 < a \le 1$, a sufficient number of iterations of transition loop$_a$ allows a token to be produced in $P_a$ exactly at date 1: it is for instance always possible to choose some duration $d \le a$, spent before each iteration of loop$_a$ and a number of iterations $n$ such that $nd = 1 - a$. All in all, transition start can thus be fired if and only if $0 < a \le 1$ and $0 < b \le 1$.

**Increment** We start from some encoding configuration: $x = b - aC_x$, $y = b - aC_y$ and $z = 0$ in a marking such that places $P_{z=0}$ and $s_i$ are marked. After the firing of transition start, there is an interleaving of transitions $R(x)$ and $R(y)$ that go through the gadget. Suppose that $1 < C_x < C_y$ (the other cases are similar). It follows that for $x$ and $y$, places $P_{x \le b}$ and $P_{y \le b}$ are marked. Then the next transition to fire is $t_{x=b}$ and when it fires we have $x = b, y = b - aC_y + aC_x$ and $z = a \cdot C_x$. Then $R(x)$ fires, which corresponds to resetting $x$ to 0: the token is back in $P_{x \le b}$ and transition $t_{x=b}$ has been enabled for 0 t.u. Then $t_{y=b}$ fires (because $aC_y \le b$), and then we have $x = aC_y - aC_x, y = b$, and $z = aC_y$. Then $t_{y=a+b}$ fires, and we have $x = aC_y - aC_x + a, y = a+b$ and $z = aC_y + a$. Then $R(y)$ fires, which corresponds to resetting $y$ to 0. Then $t_{z=b}$ fires and we have $x = b - aC_x, y = b - aC_y - a$ and $z = b$. Finally, done fires which resets $z$ and we have $x = b - aC_x, y = b - a(C_y+1)$ and $z = 0$ as
expected. Note that if $a(C_y+1) > b$, then $t_{z=b}$ must fire before $t_{y=a+b}$ and then $\epsilon_{z_b}$ fires immediately and *done* can never be fired. Therefore, $v(\mathcal{N}_M)$ will block for all the parameter valuations $v$ that do not correctly encode the machine.

**Decrement** By replacing the arc from $P_{z=b}$ to *done* by an arc from $P_{z=a+b}$ to *done*, the only difference with the previous reasoning is that the time to fire *done* is increased by $a$. Then, when $C_x > 0$, we obtain $z = 0$, $x = b+a-aC_x = b-a(C_x-1)$ and $y = b-aC_y$ corresponding to the decrement of $C_x$.

When $C_x = 0$, we must begin with $R(x)$, then the sequence is $t_{y=b}, t_{y=a+b}, R(y), t_{z=b}$ as before and we obtain $x = b, y = b - aCy - a, z = b$. Now, since $x = b$ but $P_{x \le b}$ is still marked, and since $a > 0$, $t_{x=b}$ must fire next, i.e., before $t_{z=a+b}$. And then for the same reasons, $\epsilon_{x_b}$ must fire and consume the token in $ok_x$ which means that *done* can never fire and the machine is blocked.

We can obtain symmetrically (by swapping $x$ and $y$) the increment of $C_x$ and the decrement of $C_y$.

**Zero-test of $x$** We start again from some encoding configuration: $x = b - aC_x, y = b - aC_y$ and $z = 0$ in a marking such that places $P_{z=0}$ and $s_i$ are marked. After the firing of transition *start*, there is an interleaving of transitions $R(x)$ and $R(y)$ that go through the gadget. Suppose that $0 < C_x < C_y$ (the cases where $C_x > 0$ and $C_x \ge C_y$ are similar). As before $P_{x \le b}$ and $P_{y \le b}$ are marked. Then the next transition to fire is $t_{x=b}$ and when it fires we have $x = b, y = b - aC_y + aC_x$ and $z = a \cdot C_x$. Then $R(x)$ fires and $x$ is reset to 0. Then $t_{y=b}$ fires, and we have $x = aC_y - aC_x, y = b$, and $z = aC_y$. Then $R(y)$ fires and $y$ is reset to 0. Then $t_{z=b}$ fires and we have $x = b - aC_x, y = b - aC_y$ and $z = b$. But then place $P_{x \le b}$ is marked and not place $P_{x=b}$ so transition *zero* cannot fire. Also $x < b$ because $C_x > 0$ so transition $t_{x=b}$ cannot fire immediately. So the only firable transition is *notzero*, and firing it blocks the machine.

Suppose now that $C_x = 0$ and $C_y > 0$ (the case where both are 0 is similar). Then $P_{x=b}$ and $P_{y \le b}$ are marked. We then fire $R(x)$ so $x$ becomes 0. Then we fire $t_{y=b}, R(y)$, and $t_{z=b}$ as before, giving $x = b, y = b - aC_y$ and $z = b$. But now $t_{x=b}$ is firable, so we fire it and get $P_{x=b}$ marked so *zero* can now fire which resets $z$ and we finally have $x = b, y = b - aC_y$ and $z = 0$ as expected.

**Proving the equivalence** Both the increment gadget and the zero-test gadget require $b$ time units, and the decrement gadget requires $(a+b)$ time units. Since the system executes over 1 time unit, for any value of $a > 0$ and $b > 0$, the number of operations that the machine can perform is finite. We consider two cases:

1. Either the machine halts. Then both counters $C_x$ and $C_y$ are bounded. Let $c$ be their maximum value over the whole execution and let $m$ be the number of steps of the finite halting execution of the machine. If $c = 0$ then the machine is a sequence of $m$ zero-tests taking $m \cdot b$ time units and the parametric Petri net $\mathcal{N}_M$ can go within 1 time unit to a marking $m_{halt}$ if $0 < a \le 1$ and $0 < b \le \frac{1}{m}$. If $c > 0$, since an instruction requires at most $a+b$ time units, if $a+b \le \frac{1}{m}$ and if $0 < a \le \frac{b}{c}$ then there exists a run that correctly simulates the machine, and eventually reaches $m_{halt}$ within 1 time unit.

This set of valuations is non-empty: for example if $c = 0$, then we can choose $a = b = \frac{1}{m}$ and if $c > 0$, then, since $m \ge c$, we can choose $a = \frac{b}{m}$ and $b = \frac{1}{1+m}$ hence $a = \frac{1}{m(1+m)}$.
2. Or the machine does not halt. A step requires at least $b$ time units then for any value $v$ of the parameters, after a maximum number of steps (at most $\frac{1}{b}$), one whole time unit will elapse without $v(\mathcal{N}_M)$ reaching $m_{halt}$. $\square$

<figure><img src="image_4.png" /><figcaption>Figure 3. Encoding 0-test over bounded-time: when in state $s_i$, if $C_x = 0$ then go to $s_j$</figcaption></figure>

# 4. Symbolic semi-algorithms for parameter synthesis

## 4.1. State classes

We now introduce the notion of state classes for pcTPNs. It was originally introduced for time Petri nets in [17, 14], and extended for timing parameters in [18], and for costs in [11]. We show that those two extensions seamlessly blend together.

For an arbitrary sequence of transitions $\sigma = t_1 \dots t_n \in T^*$, let $C_\sigma$ be the set of all states that can be reached by the sequence $\sigma$ from any initial state $q_0 : C_\sigma = \{q \in Q | q_0 \xrightarrow{t_1} q_1 \dots \xrightarrow{t_n} q\}$. All the states of $C_\sigma$ share the same marking and can therefore be written as a pair $(m, D)$ where $m$ is the common marking and, if we note $\text{en}(m) = \{t_1, \dots, t_n\}$, then $D$ is the set of points $(\theta_1, \dots, \theta_n, c, v)$ such that $(m, I, c, v) \in C_\sigma$ and for all $t_i \in \text{en}(m)$, $\theta_i \in I(t_i)$. For short, we will often write $(\vec{\theta}, c, v)$ for such a point, with $\vec{\theta} = (\theta_1, \dots, \theta_n)$ and a small abuse of notation. We denote by $\Theta$ the set of $\theta_i$ variables, of which we have one per transition of the net: for the sake of simplicity, we will usually use the same index to denote for instance that $\theta_i$ corresponds to transition $t_i$.

$C_\sigma$ is called a *state class* and $D$ is its *firing domain*.

Lemma 4.1 equivalently characterises state classes, as a straightforward reformulation of the definition:

**Lemma 4.1.** For all classes $C_\sigma = (m, D)$, $(\vec{\theta}, c, v) \in D$ if and only if there exists a run $\rho$ in $v(\mathcal{N})$, and $I : \text{en}(m) \to \mathcal{I}(\mathbb{Q}_{\ge 0})$, such that $\text{sequence}(\rho) = \sigma$, $(m, I, c) = \text{last}(\rho)$, and $\vec{\theta} \in I$.
From Lemma 4.1, we can then deduce a characterisation of the “next” class, obtained by firing a
firable transition from some other class. This is expressed by Lemma 4.2.

**Lemma 4.2.** Let $C_{\sigma} = (m, D)$ and $C_{\sigma, t_f} = (m', D')$, we have:

$$ (\vec{\theta}', c', v) \in D' \text{ iff } \exists (\vec{\theta}, c, v) \in D \text{ s.t. } \left\{ \begin{array}{l} \forall t_i \in \text{en}(m), \theta_i - \theta_f \ge 0 \\ \forall t_i \in \text{en}(m - \bullet t_f), \theta'_i = \theta_i - \theta_f \\ \forall t_i \in \text{newen}(m, t_f), \theta'_i \in v(I_s)(t_i) \\ c' = c + \text{cost}_m(m) * \theta_f + \text{cost}_t(t_f) \end{array} \right. $$

**Proof:**

Consider $(\vec{\theta}', c', v) \in D'$. Then by Lemma 4.1, there exists a run $\rho'$ in $v(\mathcal{N})$, and $I' : \text{en}(m) \to \mathcal{I}(\mathbb{Q}_{\ge 0})$, such that sequence($\rho'$) = $\sigma.t_f$, $(m', I', c') = \text{last}(\rho')$, and $\vec{\theta}' \in I'$. Consider the prefix $\rho$ of $\rho'$ such that sequence($\rho$) = $\sigma$. The last state of $\rho$ can be written $(m, I, c, v)$ for some $I$ and $c$. We know that $t_f$ is fired from $(m, I, c, v)$ so there exists some delay $d$ such that $I(t_f) \le d$ and for all other transitions $t_i$ enabled by $m, \overline{I(t_i)} \ge d$. Furthermore, $c = c' - \text{cost}_m(m) * d - \text{cost}_t(t_f)$. It follows that there exists a point $\vec{\theta} \in I$ with the desired properties.

The other direction is similar.

Note that according to Lemma 4.2, $D'$ is not empty if and only if there exists $(\vec{\theta}, c, v)$ in $D$ such that for all $t_i \in \text{en}(m)$, $\theta_i \ge \theta_f$. In that case we say that $t_f$ is *firable* from $(m, D)$ and note $t_f \in$ *firable*($(m, D)$).

From Lemma 4.2, it follows that $C_{\sigma, t_f}$ can be computed from $C_{\sigma}$ using Algorithm 1. Note that it is formally the same algorithm as in [11].

Given a class $C$ and a transition $t$ *firable* from $C$, we note $\text{Next}(C, t)$ the result of applying Algorithm 1 to $C$ and $t$.

<caption>**Algorithm 1 Successor (m', D') of (m, D) by firing t_f**</caption>

1: $m' \leftarrow m - \bullet t_f + t_f^$
2: $D' \leftarrow D \wedge \bigwedge_{i \neq f, t_i \in \text{en}(m)} \theta_f \le \theta_i$
3: for all $t_i \in \text{en}(m - \bullet t_f), i \neq f$, add variable $\theta_i'$ to $D'$, constrained by $\theta_i = \theta_i' + \theta_f$
4: add variable $c'$ to $D'$, constrained by $c' = c + \theta_f * \text{cost}_m(m) + \text{cost}_t(t_f)$
5: eliminate (by projection) variables $c, \theta_i$ for all $i$ from $D'$
6: for all $t_j \in \text{newen}(m, t_f)$, add variable $\theta_j'$ to $D'$, constrained by $\theta_j' \in I_s(t_j)$

Let $C_0 = (m_0, D_0)$ be the initial class. Domain $D_0$ is defined by the constraints $\forall t_i \in \text{en}(m_0), \theta_i \in I_s(t_i), \forall t \in T, I_s(t) \neq \emptyset$, and $c = 0$. This gives a convex polyhedron of $\mathbb{R}^{\text{en}(m_0)|+|P|+1}$; since all the operations on domains in Algorithm 1 are polyhedral, all the domains of state classes are also convex polyhedra. Note that only enabled transitions are constrained in the domain of a state class.

Naturally, we define the *cost* of state class $C_{\sigma}$ as $\text{cost}(C_{\sigma}) = \text{cost}(\sigma)$.
**Example 4.3.** For the net in Figure 1, the initial state class is defined by $m_0 = \{p_0, p_1\}$ and $D_0 = \{\theta_0 = a, 2 \le \theta_1 \le 5, c = 0, a \ge 0\}$. Firing $t_0$ from $C_0$, we get $C_1 = (m_1, D_1)$ with $m_1 = m_0$, and $D_1 = \{t_0 = a, 0 \le t_1, 2 - a \le t_1 \le 5 - a, c = 2 + 3a, a \le 5\}$. More generally, after firing $n$ times $t_0$ consecutively, we get $C_n = (m_0, D_n)$ with $D_n = \{t_0 = a, 0 \le t_1, 2 - na \le t_1 \le 5 - na, c = n(2 + 3a), na \le 5\}$. Finally, when firing $t_1$ from $C_n$, with $n > 0$, we get $C'_n = (\{p_0, p_2\}, D'_n)$ with $D'_n = \{0 \le t_0 \le a, (n+1)a - 5 \le t_0 \le (n+1)a - 2, c = n(2+3a) + 3(a-t_0), \frac{2}{n+1} \le a \le \frac{5}{n}\}$. When firing $t_1$ from $C_0$, we get $C'_0 = (\{p_0, p_2\}, D'_0)$ with $D'_0 = \{0 \le t_0 \le a, a - 5 \le t_0 \le a - 2, c = 3(a-t_0), 2 \le a\}$.

In the next two subsections we present parameter synthesis algorithms based on the state classes with parameters and cost we have just defined.

## 4.2. Bounded-cost synthesis semi-algorithm

**Algorithm 2** Symbolic semi-algorithm computing all parameter valuations such that some markings are reachable with a bounded cost.

1: **PolyRes** ← $\emptyset$
2: **PASSED** ← $\emptyset$
3: **WAITING** ← $\{(m_0, D_0)\}$
4: **while** **WAITING** $\neq \emptyset$ **do**
5: &nbsp;&nbsp;&nbsp;&nbsp;select $C_\sigma = (m, D)$ from **WAITING**
6: &nbsp;&nbsp;&nbsp;&nbsp;**if** $m \in \text{Goal then**}
7: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**PolyRes** ← **PolyRes** $\cup (D \cap (c \le c_{\max}))_{\mathbb{P}}$
8: &nbsp;&nbsp;&nbsp;&nbsp;**end if**
9: &nbsp;&nbsp;&nbsp;&nbsp;**if** for all $C' \in \text{PASSED}, C_\sigma \not\le C'$ **then**
10: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add $C_\sigma$ to **PASSED**
11: &nbsp;&nbsp;&nbsp;&nbsp;for all $t \in \text{firable}(C_\sigma)$, add $C_{\sigma,t}$ to **WAITING**
12: &nbsp;&nbsp;&nbsp;&nbsp;**end if**
13: **end while**
14: **return** **PolyRes**

We start with the problem of finding parameter valuations for which we can reach some given markings, with a cost that is less or equal to a given constant $c_{\max}$. In Algorithm 2, we explore the symbolic state-space in a classical manner. Whenever a goal marking is encountered we collect the parameter valuations that allowed that marking to be reached with a cost less or equal to $c_{\max}$.

The **PASSED** list records the visited symbolic states. Instead of checking new symbolic states for membership, we test a weaker relation denoted by $\ll$: does there exist a visited state allowing more behaviors with a cheaper cost?

For any state class $C = (m, D)$ and any point $(\vec{\theta}, v) \in D_{\mid\Theta \cup \mathbb{P}}$, the optimal cost of $(\vec{\theta}, v)$ in $D$ is defined by $\text{cost}_D(\vec{\theta}, v) = \inf_{(\vec{\theta}, c, v) \in D} c$.
**Definition 4.4.** Let $C = (m, D)$ and $C' = (m', D')$ be two parametric cost state classes. We say that $C$ is subsumed by $C'$, which we denote by $C \preceq C'$ iff $m = m'$, $D_{|\Theta \cup \mathbb{P}} \subseteq D'_{|\Theta \cup \mathbb{P}}$, and for all $(\vec{\theta}, v) \in D_{|\Theta \cup \mathbb{P}}$, $\mathbf{cost}_{D'}(\vec{\theta}, v) \le \mathbf{cost}_D(\vec{\theta}, v)$.

The following result is a fairly direct consequence of Definition 4.4:

**Lemma 4.5.** Let $C_{\sigma_1}$ and $C_{\sigma_2}$ be two state classes such that $C_{\sigma_1} \preceq C_{\sigma_2}$.

If a transition sequence $\sigma$ is firable from $C_{\sigma_1}$, it is also firable from $C_{\sigma_2}$ and $\mathbf{cost}(C_{\sigma_1.\sigma}) \ge \mathbf{cost}(C_{\sigma_2.\sigma})$.

**Proof:**

Let $C_{\sigma_1} = (m_1, D_1)$ and $C_{\sigma_2} = (m_2, D_2)$. From Definition 4.4, for any point $(\vec{\theta}, c_1, v) \in D_1$, there exists a point $(\vec{\theta}, c_2, v) \in D_2$ such that $c_2 \le c_1$. This implies that: (i) $\mathbf{cost}(C_{\sigma_1}) \ge \mathbf{cost}(C_{\sigma_2})$; (ii) if transition $t$ is firable from $C_{\sigma_1}$, then it is firable from $C_{\sigma_2}$ and $\mathrm{Next}(C_{\sigma_1}, t) \preceq \mathrm{Next}(C_{\sigma_2}, t)$. And the result follows by a straightforward induction. $\square$

While $\preceq$ can be checked using standard linear algebra techniques, we can also reduce it to standard inclusion on polyhedra by removing the upper bounds on cost (an operation called cost relaxation) [11].

**Example 4.6.** Using the classes given in Example 4.3, we see that for all $n$, for all $m \le n$, we have $C_n \preceq C_m$ because $D_{n|\Theta \cup \mathbb{P}} \not\subseteq D_{m|\Theta \cup \mathbb{P}}$. This means Algorithm 2 will not terminate, whatever the value of the cost bound.

Nonetheless, for a cost bound of 5, we see that from $D'_0$ we obtain an empty set of parameters meeting the bound which is empty, as expected, because $t_0 \le a - 2$ so $c = 3(a - t_0)$ is at least 6. And for a bound greater of equal to 6 we get $a \ge 2$. With a bound of 8, we need to explore $C'_1$ to find that $a$ can actually be greater or equal to 1, and so on.

Lemma 4.7 states a technical invariant of the while loop.

**Lemma 4.7.** The following invariant holds after each iteration of the while loop in Algorithm 2: for all $C_{\sigma} = (m, D) \in \text{PASSED}$,

1. for all prefixes $\sigma'$ of $\sigma$, $C_{\sigma'} \in \text{PASSED}$;

2. if $m \in \text{Goal}$ then $(D \cap (c \le c_{\max}))_{|\mathbb{P}} \subseteq \text{PolyRes}$;

3. if $t$ is firable from $C_{\sigma}$:

• either $C_{\sigma,t} \in \text{WAITING}$,

• or there exists $C' \in \text{PASSED}$ such that $C_{\sigma,t} \preceq C'$.

**Proof:**

We prove this lemma by induction. Before the while loop starts, PASSED is empty so the invariant is true. Let us now assume that the invariant holds for all iterations up to the $n$-th one, with $n \ge 0$,
and that `WAITING ≠ ∅`. Let $C_σ \in WAITING$ be the selected class at line 5; to check whether the invariant still holds at the end of the $(n + 1)$-th iteration, we only have to test the case where $C_σ$ is added to `PASSED` (which means that the condition at line 9 is true). We can then check each part of the invariant:

1. $C_σ$ was picked from `WAITING` (line 5); except for the initial class (for which $σ$ is empty, and therefore has no prefix), it means that, in a previous iteration, there was a sequence $σ'$ and a transition $t \in \text{firable}(C_{σ'})$ such that $σ = σ' \cdot t$ (line 11) and $C_{σ'} \in \text{PASSED}$ (line 10). Since we add at most one state class to `PASSED` at each iteration, $C_{σ'}$ was added in a previous iteration and we can apply to it the induction hypothesis, which allows us to prove the first part of the invariant;

2. lines 6 and 7 obviously imply the second part of the invariant;

3. if $C_σ \in \text{PASSED}$, then the condition of the if on line 9 is true and then for any transition $t$ that is firable from $C_σ$, $C_{σ,t}$ is added to `WAITING` (line 11) so the third part of the invariant holds for $C_σ$. Nevertheless, $C_σ$ itself is no longer in `WAITING`, and it is (except for the initial state class) the successor of some state class in `PASSED`. But then we have only two possibilities: either $C_σ$ has been added to `PASSED` in line 10 if the condition on line 9 was true, and certainly $C_σ \preceq C_σ'$, or there exists $C' \in \text{PASSED}$ such that $C_σ \preceq C'$ if that condition was false. Therefore the third part of the invariant holds.

Both the basis case and the induction step are true: the result follows by induction. □

We can now prove the correctness of semi-algorithm, and its completeness when it terminates.

**Proposition 4.8.** After any iteration of the while loop in Algorithm 2:

1. if $v \in \text{PolyRes}$, then there exists a run $\rho$ in $v(\mathcal{N})$ such that $\text{cost}(\rho) \le c_{\max}$ and $\text{lastm}(\rho) \in \text{Goal}$.

2. if `WAITING = ∅` then, for all parameter valuations $v$ such that there exists a run $\rho$ in $v(\mathcal{N})$ such that $\text{cost}(\rho) \le c_{\max}$ and $\text{lastm}(\rho) \in \text{Goal}$, we have $v \in \text{PolyRes}$.

**Proof:**

1. By induction on the while loop: initially, `PolyRes` is empty so the result holds trivially. Suppose it holds after some iteration $n$, and consider iteration $n + 1$. Let $v \in \text{PolyRes}$ after iteration $n + 1$. If $v$ was already in `PolyRes` after iteration $n$ then we can apply the induction hypothesis. Otherwise it means that if $C_σ = (m, D)$ is the class examined at iteration $n + 1$, then $m \in \text{Goal}$ and $v \in (D \cap (c \le c_{\max}))_{\mathbb{P}}$. This means that there exists some point $(\vec{\theta}, c, v) \in D$ with $c \le c_{\max}$. By Lemma 4.1, this means that there exists a run $\rho$ such that $(m, I, c, v) = \text{last}(\rho)$, for some $I$ such that $\vec{\theta} \in I$, and therefore $\text{lastm}(\rho) \in \text{Goal}$ and $\text{cost}(\rho) \le c_{\max}$.

2. Let $v$ be a parameter valuation such that there exists a run $\rho$ in $v(\mathcal{N})$ such that $\text{cost}(\rho) \le c_{\max}$ and $\text{lastm}(\rho) \in \text{Goal}$. Let $\sigma = \text{sequence}(\rho)$. We proceed by induction on the length $n$ of
the biggest suffix $\sigma_2$ of $\sigma$ such that, either $\sigma_2$ is empty or, if we note $\sigma = \sigma_1\sigma_2$, with the first element of $\sigma_2$ being transition $t$, then $C_{\sigma_1 t} \notin \text{PASSED}$.

If $n = 0$, then $C_{\sigma} = (m, D) \in \text{PASSED}$. By Lemma 4.1, $v \in D|_{\mathbb{P}}$ and $m \in \text{Goal}$. From the latter, with Lemma 4.7, we have $(D \cap (c \le c_{\max}))|_{\mathbb{P}} \subseteq \text{PolyRes}$ and therefore $v \in \text{PolyRes}$ because $v \in (D \cap (c \le c_{\max}))|_{\mathbb{P}}$.

Consider now $n > 0$ and assume the property holds for $n - 1$. Since $n > 0$, then there exists a transition $t$ and a sequence $\sigma_3$ such that $\sigma_2 = t.\sigma_3$. By definition of $\sigma_2$, we have $C_{\sigma_1} \in \text{PASSED}$ but $C_{\sigma_1.t} \notin \text{PASSED}$. By Lemma 4.7, since $\text{WAITING} = \emptyset$, there must exists some class $C_{\sigma'} \in \text{PASSED}$ such that $C_{\sigma_1.t} \preceq C_{\sigma'}$. From Lemma 4.5, sequence $\sigma_3$ is also firable from $C_{\sigma'}$ and $C_{\sigma'.\sigma_3} = (m, D')$, with $\text{cost}(C_{\sigma'}) \le \text{cost}(C_{\sigma}) \le c_{\max}$. By Lemma 4.1, there exists thus a run $\rho'$ in $v(\mathcal{N})$, with $\text{sequence}(\rho') = \sigma'.\sigma_3$, $\text{lastm}(\rho') \in \text{Goal}$ and $\text{cost}(\rho') \le c_{\max}$. Also, from Lemma 4.7 (item 1), we know that for all prefixes of $\sigma'$, the corresponding state class is in $\text{PASSED}$, so the biggest suffix of $\sigma'.\sigma_3$ as defined above in the induction hypothesis has length less or equal to $n - 1$, and the induction hypothesis applies to $\rho'$, which allows to conclude.

□

In particular, if the algorithm terminates, then the waiting list is empty and **PolyRes** is exactly the solution to the synthesis problem.

### 4.3. Infimum-cost synthesis semi-algorithm

We now address the optimal cost synthesis problem, that is compute the infimum cost over all runs (and thus over all parameter valuations) and all parameter valuations for which this optimal cost can be achieved.

Algorithm 3 explores the state-space in the same way as Algorithm 2. The difference lies in how it collects “good” parameter valuations: the idea is to always store the parameter valuations for which the minimal possible cost in the class is realisable.

**Example 4.9.** As we have seen previously, the minimum cost for $C'_0$ is 6 with $a \ge 2$ and this is actually optimal because for all $n > 0$, the minimum cost for $C'_n$ will be $n(2 + 3a) + 3(a - t_0)$ with $t_0 \le (n + 1)a - 2$, i.e., $a - t_0 \ge 2 - na$ and $c \ge 2n + 3na + 6 - 3na = 2n + 6 > 6$.

As before we first prove a simple technical invariant on the while loop.

**Lemma 4.10.** The following invariant holds after each iteration of the while loop in Algorithm 3: for all $C_{\sigma} = (m, D) \in \text{PASSED}$,

1. for all prefixes $\sigma'$ of $\sigma$, $C_{\sigma'} \in \text{PASSED}$;

2. if $t$ is firable from $C_{\sigma}$:

* either $C_{\sigma.t} \in \text{WAITING}$,

* or there exists $C' \in \text{PASSED}$ such that $C_{\sigma.t} \preceq C'$.
**Algorithm 3** Symbolic semi-algorithm computing all parameter valuations such that some markings are reachable with the infimum cost.

1: **COST** ← ∞
2: **PolyRes** ← ∅
3: **PASSED** ← ∅
4: **WAITING** ← {(m₀, D₀)}
5: **while** **WAITING** ≠ ∅ **do**
6: &nbsp;&nbsp;&nbsp;&nbsp;select C<sub>σ</sub> = (m, D) from **WAITING**
7: &nbsp;&nbsp;&nbsp;&nbsp;**if** m ∈ **Goal** **then**
8: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**if** cost(C<sub>σ</sub>) < **COST** **then**
9: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**COST** ← cost(C<sub>σ</sub>)
10: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**PolyRes** ← (D ∩ (c = **COST**))<sub>|P</sub>
11: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**else if** cost(C<sub>σ</sub>) = **COST** **then**
12: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**PolyRes** ← **PolyRes** ∪ (D ∩ (c = **COST**))<sub>|P</sub>
13: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**end if**
14: &nbsp;&nbsp;&nbsp;&nbsp;**end if**
15: &nbsp;&nbsp;&nbsp;&nbsp;**if** for all C' ∈ **PASSED**, C<sub>σ</sub> ≁ C' **then**
16: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add C<sub>σ</sub> to **PASSED**
17: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for all t ∈ **firable**(C<sub>σ</sub>), add C<sub>σ,t</sub> to **WAITING**
18: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**end if**
19: &nbsp;&nbsp;&nbsp;&nbsp;**end while**
20: **return** (COST, **PolyRes**)

3. $cost(C_{\sigma}) \geq COST$;

4. if $m \in \mathbf{Goal}$ and $cost(C_{\sigma}) = \mathbf{COST}$ then $(D \cap (c = \mathbf{cost}(C_{\sigma})))_{|P} \subseteq \mathbf{PolyRes}$;

**Proof:**

The proof works by induction exactly as the one of Lemma 4.7. The specific last two items are a direct consequence of the updates in lines 7 to 14 and of the induction hypothesis. □

We can now prove correctness and completeness (the latter provided the semi-algorithm terminates).

**Proposition 4.11.** After any iteration of the while loop in Algorithm 3:

1. if $v \in \mathbf{PolyRes}$, then there exists a run $\rho$ in $v(\mathcal{N})$ such that $cost(\rho) = \mathbf{COST}$ and $\mathrm{lastm}(\rho) \in \mathbf{Goal}$.

2. if $\mathbf{WAITING} = \emptyset$ then if some marking in **Goal** is reachable for some parameter valuation then $\mathbf{COST} = \min_{\rho \in \mathrm{Runs}(\mathcal{N}), \mathrm{lastm}(\rho) \in \mathbf{Goal}} \mathbf{cost}(\rho)$ otherwise $\mathbf{COST} = +\infty$.

3. if $\mathbf{WAITING} = \emptyset$ then for all parameter valuations $v$ such that there exists a run $\rho$ in $v(\mathcal{N})$ such that $\mathbf{cost}(\rho) = \mathbf{COST}$ and $\mathrm{lastm}(\rho) \in \mathbf{Goal}$, we have $v \in \mathbf{PolyRes}$;
**Proof:**

1. This works as in the proof for Proposition 4.8, replacing $c \le c_{\max}$ by $c = \text{COST}$.

2. If no marking in **Goal** is reachable then clearly, from its initialisation, $\text{COST} = +\infty$ when the algorithm terminates with $\text{WAITING} = \emptyset$.

If some marking in **Goal** is reachable for some parameter valuation $v$, let $\rho$ be one of the runs reaching **Goal** with the smallest cost and let $\sigma = \text{sequence}(\rho)$. First remark that $\text{cost}(C_\sigma) = \text{cost}(\rho)$ because $\rho$ realises the minimum cost of all runs reaching **Goal**, and therefore in particular of all runs firing transition sequence $\sigma$.

We prove that $\text{COST} = \text{cost}(\rho)$. We proceed again by induction on the length $n$ of the biggest suffix $\sigma_2$ of $\sigma$ such that, either $\sigma_2$ is empty or, if we note $\sigma = \sigma_1\sigma_2$, with the first element of $\sigma_2$ being transition $t$, then $C_{\sigma_1 t} \notin \text{PASSED}$.

If $n = 0$, then $C_\sigma = (m, D) \in \text{PASSED}$. Then, by Lemma 4.10, $\text{COST} \le \text{cost}(C_\sigma)$, which implies $\text{COST} < +\infty$. It is therefore clear that there is some $\sigma' = (m', D') \in \text{PASSED}$ such that $\text{COST} = \text{cost}(C_{\sigma'})$. If $\text{COST} < \text{cost}(C_\sigma)$, then by Lemma 4.1 there exists a run $\rho'$ reaching **Goal** with $\text{cost}(\rho') < \text{cost}(\rho)$, which is not possible since $\rho$ realises the minimum cost. Therefore $\text{COST} = \text{cost}(C_\sigma) = \text{cost}(\rho)$.

Consider now $n > 0$ and assume the property holds for $n - 1$. Since $n > 0$, then there exists a transition $t$ and a sequence $\sigma_3$ such that $\sigma_2 = t.\sigma_3$. By definition of $\sigma_2$, we have $C_{\sigma_1} \in \text{PASSED}$ but $C_{\sigma_1,t} \notin \text{PASSED}$. By Lemma 4.7, since $\text{WAITING} = \emptyset$, there must exists some class $C_{\sigma'}$ such that $C_{\sigma_1,t} \prec C_{\sigma'}$. From Lemma 4.5, sequence $\sigma_3$ is also firable from $C_{\sigma'}$ and $C_{\sigma'.\sigma_3} = (m, D')$, with $\text{cost}(C_{\sigma'.\sigma_3}) \le \text{cost}(C_\sigma) = \text{cost}(\rho)$. By Lemma 4.1, there exists thus a run $\rho'$, with $\text{sequence}(\rho') = \sigma'.\sigma_3$, $\text{lastm}(\rho') \in \text{Goal}$ and $\text{cost}(\rho') \le \text{cost}(\rho)$. Since $\rho$ realises the minimum of the cost for runs reaching **Goal**, this means that $\text{cost}(\rho') = \text{cost}(\rho)$. From Lemma 4.10 (item 1), we know that for all prefixes of $\sigma'$, the corresponding state class is in $\text{PASSED}$, so the biggest suffix of $\sigma'.\sigma_3$ as defined above in the induction hypothesis has length less or equal to $n - 1$, and the induction hypothesis applies to $\rho'$, which allows to conclude.

3. Let $v$ be a parameter valuation such that there exists a run $\rho$ in $v(\mathcal{N})$ such that $\text{cost}(\rho) = \text{COST}$ and $\text{lastm}(\rho) \in \text{Goal}$. Let $\sigma = \text{sequence}(\rho)$. We proceed by induction on the length $n$ of the biggest suffix $\sigma_2$ of $\sigma$ such that, either $\sigma_2$ is empty or, if we note $\sigma = \sigma_1\sigma_2$, with the first element of $\sigma_2$ being transition $t$, then $C_{\sigma_1 t} \notin \text{PASSED}$.

If $n = 0$, then $C_\sigma = (m, D) \in \text{PASSED}$. By Lemma 4.1, $v \in D|_{\mathbb{P}}$ and $m \in \text{Goal}$. From the latter, with Lemma 4.10, we have $(D \cap (c = \text{COST}))|_{\mathbb{P}} \subseteq \text{PolyRes}$ and therefore $v \in \text{PolyRes}$ because $v \in (D \cap (c = \text{COST}))|_{\mathbb{P}}$.

Consider now $n > 0$ and assume the property holds for $n - 1$. Since $n > 0$, then there exists a transition $t$ and a sequence $\sigma_3$ such that $\sigma_2 = t.\sigma_3$. By definition of $\sigma_2$, we have $C_{\sigma_1} \in \text{PASSED}$ but $C_{\sigma_1,t} \notin \text{PASSED}$. By Lemma 4.7, since $\text{WAITING} = \emptyset$, there must exists some class $C_{\sigma'} \in \text{PASSED}$ such that $C_{\sigma_1,t} \prec C_{\sigma'}$. From Lemma 4.5, sequence $\sigma_3$ is also firable from $C_{\sigma'}$ and $C_{\sigma'.\sigma_3} = (m, D')$, with $\text{cost}(C_{\sigma'.\sigma_3}) \le \text{cost}(C_\sigma) = \text{COST}$. By Lemma 4.1, there exists thus a run $\rho'$ in $v(\mathcal{N})$, with $\text{sequence}(\rho') = \sigma'.\sigma_3$, $\text{lastm}(\rho') \in \text{Goal}$ and $\text{cost}(\rho') \le \text{COST}$.
Since WAITING = $\emptyset$, we can use item 2 above and therefore, since Goal is reachable, COST is finite and is the minimum cost of runs reaching Goal (and in particular for those with parameter valuation $v$). So $\text{cost}(\rho') = \text{COST}$. Furthermore, from Lemma 4.10 (item 1), we know that for all prefixes of $\sigma'$, the corresponding state class is in PASSED, so the biggest suffix of $\sigma' \cdot \sigma_3$ as defined above in the induction hypothesis has length less or equal to $n-1$, and the induction hypothesis applies to $\rho'$, which allows to conclude. □

# 5. Restricting to integer parameters

Obviously, in general, (semi-)Algorithm 2 will not terminate, since the emptiness problem for the set it computes is undecidable. Semi-algorithm 3 will not terminate either for similar reasons.

To ensure termination, we can however follow the methodology of [4]: we require that parameters are bounded integers and, instead of just enumerating the possible parameter values, we propose a modification of the symbolic state computation to compute these integer parameters symbolically. For this we rely on the notion of integer hull.

We call integer valuation a $\mathbb{Z}$-valuation. Note that a $\mathbb{Z}$-valuation is also an $\mathbb{R}$-valuation, and given a set $D$ of $\mathbb{R}$-valuations, we denote by $\text{Ints}(D)$ the set of integer valuations in $D$.

The convex hull of a set $D$ of valuations, denoted by $\text{Conv}(D)$, is the intersection of all the convex sets of valuations that contain $D$.

The integer hull of a set $D$ of valuations, denoted by $\text{IH}(D)$, is defined as the convex hull of the integer valuations in $D$: $\text{IH}(D) = \text{Conv}(\text{Ints}(D))$.

For a state class $C = (m, D)$, we write $\text{IH}(C)$ for $(m, \text{IH}(D))$.

Before we see how our result can be adapted for the restriction to integer parameter valuations, and from there how we can enforce termination of the symbolic computations when parameters are assumed to be bounded, we need some results on the structure of the polyhedra representing firing domains of cost TPNs.

By the Minkowski-Weyl theorem (see e.g. [19]), every convex polyhedron can be either described as a set of linear inequalities, as seen above, or by a set of *generators*. More precisely, for the latter: if $d$ is the dimension of polyhedron $\mathcal{P}$, there exists $v_1, \dots, v_p, r_1, \dots, r_s \in \mathbb{R}^d$, such that for all points $x \in \mathcal{P}$, there exists $\lambda_1, \dots, \lambda_p \in \mathbb{R}$, $\mu_1, \dots, \mu_s \in \mathbb{R}_{\ge 0}$ such that $\sum_i \lambda_i = 1$ and $x = \sum_i \lambda_i v_i + \sum_i \mu_i r_i$. The $v_i$'s are called the *vertices* of $\mathcal{P}$ and the $r_i$'s are the *extremal rays* of $\mathcal{P}$. The latter correspond to the directions in which the polyhedron is infinite. In our case, they correspond to transitions with a (right-)infinite static interval, and possibly the cost.

A classical property of vertices, which can also be used as a definition, is as follows: $\vec{v}$ is a vertex of $\mathcal{P}$ iff for all non-null vectors $\vec{x} \in \mathbb{R}^d$, either $\vec{v} + \vec{x} \notin \mathcal{P}$ or $\vec{v} - \vec{x} \notin \mathcal{P}$ (or both), + and - being understood component-wise.

**Proposition 5.1.** Let $\mathcal{N}$ be a (non-parametric) cost TPN and let $C = (m, D)$ be one of its state classes, then $D$ has integer vertices.
**Proof:**

We have proved in [11] that the domain $D$ of a state class of a cost TPNs, with removed upper bounds on cost (so-called relaxed classes), can be partitioned into a union of simpler polyhedra $\bigcup_{i=1}^n D_i$ that have the following key properties: (1) by projecting the cost out we obtain a convex polyhedron $D_{i|\Theta}$ with integer vertices (actually a *zone*, as in [20, 14]), and (2) these simpler polyhedra all have exactly one constraint on the cost variable, i.e., of the form $c \ge \ell(\vec{\theta})$, with integer coefficients. Note that the same result can be obtained, with the same technique, if we consider non-relaxed state classes, except that, we also have an upper bound on cost that is always greater or equal to the lower bound. We prove in Lemma 5.2 that each of these simpler polyhedra also has integer vertices. Since $D$ and each of the $D_i$'s are convex and since $D = \bigcup_i D_i$, $D$ is equal to the convex hull of the vertices of the $D_i$'s and therefore $D$ also has integer vertices. $\square$

**Lemma 5.2.** Let $D$ be a convex polyhedron on variables $\theta_1, \dots, \theta_n, c$ such that the projection of $D$ on the $\theta$ variables has integer vertices, and there are two constraints on $c$ of the form $c \ge \ell(\theta_1, \dots, \theta_n)$ and $c \le \ell'(\theta_1, \dots, \theta_n)$, with $\ell$ and $\ell'$ linear terms with integer coefficients, such that $\ell(\theta_1, \dots, \theta_n) \le \ell'(\theta_1, \dots, \theta_n)$, for all values of the $\theta_i$'s.

Then, the vertices of $D$ are the points $(\theta_1, \dots, \theta_n, \ell(\theta_1, \dots, \theta_n))$ and $(\theta_1, \dots, \theta_n, \ell'(\theta_1, \dots, \theta_n))$ such that $(\theta_1, \dots, \theta_n)$ is a vertex of $D_{i|\Theta}$, and they are integer points.

**Proof:**

Recall here that we consider all constraints in $D$ to be non-strict so all polyhedra are topologically closed. The reasoning extends with no difficulty to non-necessarily-closed polyhedra by considering so-called *closure points* in addition to vertices [21].

Consider a non-vertex point $\vec{\theta}$ in $D_{i|\Theta}$ and let $(\vec{\theta}, c)$ be a point of $D$. Then using the form of the unique cost constraint, we have $c \ge \ell(\vec{\theta})$. Now since $\vec{\theta}$ is not a vertex, there exists a vector $\vec{x}$ such that both $\vec{\theta} + \vec{x}$ and $\vec{\theta} - \vec{x}$ belong to $D_{i|\Theta}$. Then, for sure, $(\vec{\theta} + \vec{x}, \ell(\vec{\theta} + \vec{x})) \in D$ and $(\vec{\theta} - \vec{x}, \ell(\vec{\theta} - \vec{x})) \in D$. And since $\ell$ is linear, $(\vec{\theta} + \vec{x}, \ell(\vec{\theta}) + \ell(\vec{x})) \in D$, i.e., $(\vec{\theta}, \ell(\vec{\theta})) + (\vec{x}, \ell(\vec{x})) \in D$. And similarly, $(\vec{\theta}, \ell(\vec{\theta})) - (\vec{x}, \ell(\vec{x})) \in D$. Using again the form of the unique cost constraint, and the fact that $c \ge \ell(\vec{\theta})$, we finally have $(\vec{\theta}, c) + (\vec{x}, \ell(\vec{x})) \in D$ and $(\vec{\theta}, c) - (\vec{x}, \ell(\vec{x})) \in D$, that is, $(\vec{\theta}, c)$ is not a vertex of $D$.

By contraposition, any vertex of $D$ extends a vertex of $D_{i|\Theta}$, and using a last time the form of the cost constraint, any vertex of $D$, is of the form $(\vec{\theta}, \ell(\vec{\theta}))$, with $\vec{\theta}$ a vertex of $D_{i|\Theta}$: suppose $(\vec{\theta}, c)$ is a vertex of $D$, with $c > \ell(\vec{\theta})$, then for $\vec{x}$ defined with $c - \ell(\vec{\theta})$ on the cost variable, and 0 on all other dimensions, we clearly have both $(\vec{\theta}, c) + \vec{x}$ and $(\vec{\theta}, c) - \vec{x}$ in $D$, which is a contradiction.

We conclude by remarking that, since $D_{i|\Theta}$ has integer vertices, all the coordinates of $\vec{\theta}$ are integers, and since $\ell$ has integer coefficients then $\ell(\vec{\theta})$ is an integer.

We can deal with the upper bound defined by $\ell'$ in exactly the same way. $\square$

From Proposition 5.1, we can prove the following lemma that will be very useful in the subsequent proofs.

**Lemma 5.3.** Let $(m, D)$ be a state class of a pcTPN and let $(\vec{\theta}, c, v)$ be a point in $D$. If $v$ is an integer valuation, then $(\vec{\theta}, c, v) \in \text{IH}(D)$.
**Proof:**

Since $(\vec{\theta}, c, v) \in D$ then $(\vec{\theta}, c) \in v(D)$. By Proposition 5.1, $v(D)$ being the firing domain of a state class in a (non-parametric) cost TPN, it has integer vertices, and therefore $v(D) = \text{IH}(v(D))$. Point $(\vec{\theta}, c)$ is therefore a convex combination of integer points in $v(D)$. Clearly, for all integer points $(\vec{\theta}', c')$ in $v(D)$, we have that $(\vec{\theta}', c', v)$ is an integer point of $D$. Since $D$ is convex, this implies that $(\vec{\theta}, c, v) \in \text{IH}(D)$. $\square$

When we restrict ourselves to integer parameter but continue to work symbolically, we need to adjust the definitions of the firability of a transition from a class and of the cost of a class.

First, a transition $t_f$ is firable for integer parameter valuations from a class $(m, D)$, call this $\mathbb{N}^P$-firable, if there exists an integer parameter valuation $v$ and a point $(\vec{\theta}, c, v)$ in $D$ such that for all transitions $t_i \in \text{en}(m)$, $\theta_i \ge \theta_f$.

**Lemma 5.4.** Let $C = (m, D)$ be a state class. Transition $t_f \in \text{en}(m)$ is $\mathbb{N}^P$-firable from $C$ if and only if it is firable (not necessarily $\mathbb{N}^P$-firable) from $(m, \text{IH}(D))$.

**Proof:**

$\Leftarrow$: trivial because $\text{IH}(D) \subseteq D$.

$\Rightarrow$: since $t_f$ is $\mathbb{N}^P$-firable from $C$, there exists an integer parameter valuation $v$, and $(\vec{\theta}, c, v) \in D$ such that for all transitions $t_i \in \text{en}(m)$, $\theta_i \ge \theta_f$. And the result follows from Lemma 5.3 because $v$ is an integer valuation. $\square$

Second, the cost of a class $C = (m, D)$, for integer parameters, is $\text{cost}_{\mathbb{N}}(C) = \inf_{(\vec{\theta}, c, v) \in D, v \in \mathbb{N}^P} c$. Lemma 5.5 is a direct consequence of Lemma 5.3:

**Lemma 5.5.** Let $(m, D)$ be a state class. We have: $\text{cost}_{\mathbb{N}}((m, D)) = \text{cost}((m, \text{IH}(D)))$.

**Lemma 5.6.** If $v$ is an integer parameter valuation, then for all classes $C_\sigma = (m, D)$, $(\vec{\theta}, c, v) \in \text{IH}(D)$ if and only if there exists a run $\rho$ in $v(\mathcal{N})$, and $I: \text{en}(m) \to \mathcal{I}(\mathbb{Q}_{\ge 0})$, such that sequence($\rho$) = $\sigma$, $(m, I, c) = \text{last}(\rho)$, and $\vec{\theta} \in I$.

**Proof:**

$\Rightarrow$: if $(\vec{\theta}, c, v) \in \text{IH}(D)$ then it is also in $D$ and the result follows from Lemma 4.1.

$\Leftarrow$: by Lemma 4.1, we know that there exists some $(\vec{\theta}, c, v) \in D$, and since $v$ is an integer valuation, by Lemma 5.3, $(\vec{\theta}, c, v) \in \text{IH}(D)$. $\square$

**Lemma 5.7.** Let $C_{\sigma_1}$ and $C_{\sigma_2}$ be two state classes such that $\text{IH}(C_{\sigma_1}) \prec \text{IH}(C_{\sigma_2})$.

If a transition sequence $\sigma$ is $\mathbb{N}^P$-firable from $C_{\sigma_1}$ it is also $\mathbb{N}^P$-firable from $C_{\sigma_2}$ and $\text{cost}_{\mathbb{N}}(C_{\sigma_1, \sigma}) \ge \text{cost}_{\mathbb{N}}(C_{\sigma_2, \sigma})$.

**Proof:**

Let $C_{\sigma_1} = (m_1, D_1)$ and $C_{\sigma_2} = (m_2, D_2)$. From Definition 4.4, for any point $(\vec{\theta}, c_1, v) \in \text{IH}(D_1)$, there exists a point $(\vec{\theta}, c_2, v) \in \text{IH}(D_2)$ such that $c_2 \le c_1$. With Lemma 5.4 and Lemma 5.5, this implies that: (i) $\text{cost}_{\mathbb{N}}(C_{\sigma_1}) \ge \text{cost}_{\mathbb{N}}(C_{\sigma_2})$; (ii) if transition $t$ is $\mathbb{N}^P$-firable from $C_{\sigma_1}$, then it is $\mathbb{N}^P$-firable from $C_{\sigma_2}$ and $\text{Next}(C_{\sigma_1}, t) \prec \text{Next}(C_{\sigma_2}, t)$. And, as before, the result follows by a straightforward induction. $\square$
**Algorithm 4** Restriction of (semi-)Algorithm 2 to integer parameter valuations.

1: **PolyRes** ← ∅

2: **PASSED** ← ∅

3: **WAITING** ← {(m₀, D₀)}

4: **while** **WAITING** ≠ ∅ **do**

5: select C<sub>σ</sub> = (m, D) from **WAITING**

6: **if** m ∈ **Goal** **then**

7: PolyRes ← PolyRes ∪ (IH(D) ∩ (c ≤ c<sub>max</sub>))|<sub>P</sub>

8: **end if**

9: **if** for all C' ∈ **PASSED**, IH(C<sub>σ</sub>) ≁ IH(C') **then**

10: add C<sub>σ</sub> to **PASSED**

11: for all t ∈ firable(IH(C<sub>σ</sub>)), add C<sub>σ,t</sub> to **WAITING**

12: **end if**

13: **end while**

14: **return** PolyRes

**Example 5.8.** Let us compute the integer hulls of some of the state classes of the net in Figure 1. D₀ and D₁ already have integer vertices, but starting from *n* > 1, we have in C*n* that *a* ≤ 5/n, and so D₂ does not have integer vertices. The integer hull of D₂ is {t₀ = *a*, 0 ≤ t₁, 2-*a* ≤ t₁ ≤ 5−*a*, *c* = 2(2+3*a*), 0 ≤ *a* ≤ 2}. For *n* ∈ {3, 4, 5}, we have IH(D*n* ) = {t₀ = *a*, 0 ≤ t₁, 2 − 2*a* ≤ t₁ ≤ 5 − *na*, *c* = *n*(2 + 3*a*), 0 ≤ *a* ≤ 1}. And finally, for *n* ≥ 6, IH(D*n* ) = {t₀ = 0, 2 ≤ t₁ ≤ 5, *c* = 2*n*, *a* = 0}. So C₇ ≪ C₆ because D₇ = D₆ and, for the costs, 14 ≥ 12. Note that we actually already had C₂ ≪ C₁ because D₂ ⊂ D₁ and on D₂, i.e., here for all *a* ≤ 2, we have 2(2 + 3*a*) ≥ 2 + 3*a*.

Using Lemma 5.6 instead of Lemma 4.1, and Lemma 5.7 instead of Lemma 4.5 in the proof of Proposition 4.8, we get the following proposition, stating the completeness and soundness of Algorithm 4.

**Proposition 5.9.** After any iteration of the while loop in Algorithm 4:

1. if $v \in \text{PolyRes}$ and $v$ is an integer parameter valuation then there exists a run $\rho$ in $v(\mathcal{N})$ such that $\text{cost}(\rho) \le c_{\max}$ and $\text{lastm}(\rho) \in \text{Goal}$.

2. if `WAITING = ∅` then for all integer parameter valuations `v` such that there exists a run `ρ` in `v(N)` such that `cost(ρ) ≤ cmax` and `lastm(ρ) ∈ Goal`, we have `v ∈ PolyRes`.

Similarly, we can prove the completeness and soundness of Algorithm 5:

**Proposition 5.10.** After any iteration of the while loop in Algorithm 5:

1. if $v \in \text{PolyRes}$ and $v$ is an integer valuation, then there exists a run $\rho$ in $v(\mathcal{N})$ such that $\text{cost}(\rho) = \text{COST}$ and $\text{lastm}(\rho) \in \text{Goal}$.

2. if `WAITING = ∅` then if some marking in **Goal** is reachable for some integer parameter valuation then `COST = min<sub>ρ∈Runs(N),lastm(ρ)∈Goal</sub> cost(ρ)` otherwise `COST = +∞`.
<caption>**Algorithm 5** Restriction of (semi-)Algorithm 3 to integer parameter valuations.</caption>

1: COST ← ∞
2: PolyRes ← ∅
3: PASSED ← ∅
4: WAITING ← {(m₀, D₀)}
5: **while** WAITING ≠ ∅ **do**
6: select C<sub>σ</sub> = (m, D) from WAITING
7: **if** m ∈ Goal **then**
8: **if** cost(IH(C<sub>σ</sub>)) < COST **then**
9: COST ← cost(IH(C<sub>σ</sub>))
10: PolyRes ← (IH(D) ∩ (c = COST))<sub>IP</sub>
11: **else if** cost(IH(C<sub>σ</sub>)) = COST **then**
12: PolyRes ← PolyRes ∪ (IH(D) ∩ (c = COST))<sub>IP</sub>
13: **end if**
14: **end if**
15: **if** for all C' ∈ PASSED, IH(C<sub>σ</sub>) ≁ IH(C') **then**
16: add C<sub>σ</sub> to PASSED
17: for all t ∈ firable(IH(C<sub>σ</sub>)), add C<sub>σ,t</sub> to WAITING
18: **end if**
19: **end while**
20: **return** (COST, PolyRes)

3. if `WAITING = ∅` then for all integer parameter valuations `v` such that there exists a run `ρ` in `v(N)` such that `cost(ρ) = COST` and `lastm(ρ) ∈ Goal`, we have `v ∈ PolyRes`;

In Algorithms 4 and 5, we compute state classes as usual then handle them via their integer hulls. We can actually simply integrate integer hulls at the end of Algorithm 1 and use Algorithm 2 with this updated successor computation as proved by Lemma 5.11.

**Lemma 5.11.** Let (m, D) be a state class of a pcTPN $\mathcal{N}$, and t a transition firable from C. Let (m', D') = Next((m, D), t) and (m'', D'') = Next((m, IH(D)), t). Then m'' = m' and IH(D'') = IH(D').

**Proof:**

The equality of markings is trivial so we focus on firing domains.

By definition of the integer hull, we have IH(D) ⊆ D. Since the computation of the next class domain is non-decreasing with respect to inclusion, we then have D'' ⊆ D'. Taking the integer hull is also non-decreasing wrt. inclusion, so IH(D'') ⊆ IH(D').

Consider now an integer point $(\vec{\theta}', c', v)$ in $D'$. Then $(\vec{\theta}', c') \in v(D')$. Consider state class computations in the (non-parametric) cost TPN $v(\mathcal{N})$: there exists some point $(\vec{\theta}, c)$ in $v(D)$ such that $(m', \vec{\theta}', c') \in \text{Next}((m, \{(\vec{\theta}, c)\}), t)$. Since $(\vec{\theta}, c, v)$ thus belongs to $D$ and since $v$ is an integer param-
elter valuation, by Lemma 5.3, we have that $(\vec{\theta}, c, v) \in \text{IH}(D)$. Thus $(\vec{\theta}', c', v) \in D''$ and since it is an integer point, it is in $\text{IH}(D'')$. $\square$

# 6. Termination of Algorithms 4 and 5

We now consider that parameter valuations are bounded by some value $M_1 \in \mathbb{N}$ (and that they still have integer values). We also assume that, for all integer parameter valuations, there exists $M_2 \in \mathbb{Z}$ such that for all runs $\rho$ in $v(\mathcal{N})$, $\text{cost}(\rho) \ge M_2$: this allows us, as in [11, 9], to keep Algorithms 4 and 5 simple by doing away with negative cost loop-checking. Finally, we assume the net itself is bounded: there exists $M_3 \in \mathbb{N}$ such that for all reachable markings $m$, for all places $p, m(p) \le M_3$.

To prove the termination of Algorithm 4 and 5 under these assumptions, we consider $\succcurlyeq$ the symmetric relation to $\prec$, such that $x \succcurlyeq y$ iff $y \prec x$. We prove that it is a well quasi-order (wqo), i.e., that for every infinite sequence of state classes, there exist $C$ and $C'$ in the sequence, with $C$ strictly preceding $C'$ such that $C \succcurlyeq C'$. This implies that the exploration of children in Algorithm 4 and 5 will always eventually stop.

**Proposition 6.1.** Let $\mathcal{N}$ be a bounded pcTPN, with bounded integer parameters and such that the cost of all runs is uniformly lower-bounded for all integer parameter valuations.

Relation $\succcurlyeq$ is well-quasiorder on the set of state classes of $\mathcal{N}$.

**Proof:**

Consider an infinite sequence $C_0, C_1, C_2, \dots$ of state classes. Let $C_i = (m_i, D_i)$.

From [11], we know that $\succcurlyeq$ is a wqo for the state classes of bounded (non parametric) cost TPNs. So for each integer parameter valuation $v$, and using a classical property of wqo we can extract a subsequence of $v(C_0), v(C_1), \dots$ that is completely ordered by $\succcurlyeq$. And since, we have a finite number of such parameter valuations, we can extract an infinite subsequence $C_{i_0}, C_{i_1}, \dots$ such that for all integer parameter valuations $v, v(C_{i_0}) \succcurlyeq v(C_{i_1}) \succcurlyeq \dots$.

Let us consider two of those: $C_{i_r}$ and $C_{i_s}$, with $r < s$.

Since $\text{IH}(D_{i_s})$ has integer vertices, and for any integer parameter valuation, $v(C_{i_r}) \succcurlyeq v(C_{i_s})$, which implies that $v(D_{i_s}) \subseteq v(D_{i_r})$, then all the vertices of $D_{i_s}$ are also in $D_{i_r}$. Now assume that some extremal ray $\vec{r}$ of $D_{i_s}$ is not in $D_{i_r}$. Then starting from some vertex $\vec{x}$ of $D_{i_r}$, there must be some $\lambda \le 0$ such that $\vec{x} + \lambda\vec{r} \notin D_{i_s}$ and the same holds for any $\lambda' \ge \lambda$ (by convexity). But since $r$ has rational coordinates for some value of $\lambda'$, $\lambda'r$ is an integer vector and so is $\vec{x} + \lambda'r$, which contradicts the fact that $v(D_{i_s}) \subseteq v(D_{i_r})$, for all integer parameter valuations $v$, and in particular $(\vec{x} + \lambda'r)_{\mathbb{P}}$. We can therefore conclude that $D_{i_r} \subseteq D_{i_s}$ and we now proceed to proving that $D_{i_s}$ is also “cheaper” than $D_{i_r}$.

We use another property of the vertices of convex polyhedra: vertices of a convex polyhedron of dimension $n$ defined by $m$ inequalities $\sum_{k=1}^n a_{kl}x_k \le b_l$, for $j \in [1..m]$ are solutions of a system of $n$ linearly independent equations $\sum_{k=1}^n a_{kl}x_k = b_l$, with $l$ in a subset of size $n$ of $[1..m]$.

Now consider the polyhedron $D$ obtained from $\text{IH}(D_{i_r})$, with its cost variable $c$, by adding one variable $c'$ constrained by the cost inequalities of $\text{IH}(D_{i_s})$. Clearly, since $c$ and $c'$ are not constrained together, the vertices of $D$ are those of $\text{IH}(D_{i_r})$, extended with the corresponding minimal and maximal values of $c'$, and symmetrically those of $\text{IH}(D_{i_s})$, extended with the corresponding minimal and
maximal values of $c'$. Since the inequalities constraining $c$ and $c'$ have integer coefficients, and $\mathrm{IH}(D_{i_s})$ and $\mathrm{IH}(D_{i_r})$ have integer vertices, $D$ also has integer vertices.

For the $i$-th lower-bound inequality on $c$, and the $j$-th lower-bound inequality on $c'$, we define $E_{ij}$ as $D$ in which we transform both constraints into equalities. Clearly, from the property above, this does not add any new vertex, but it may remove some. Second, by construction, we have $\bigcup_{ij} E_{ij} = \{(\vec{\theta}, \min_{(\vec{\theta},c,v) \in \mathrm{IH}(D_{i_r})} c, \min_{(\vec{\theta},c,v) \in \mathrm{IH}(D_{i_s})} c) | \vec{\theta} \in \mathrm{IH}(D_r)\}_{\Theta}$. If we minimize $c-c'$ over $E_i$, we know from the theory of linear programming that the minimum is obtained at a vertex of $E_{ij}$, and therefore, in particular, for an integer valuation $v$ of the parameters, and an integer vector $\vec{\theta}$ of $D_{i_r}$. Since we have $v(C_{i_r}) \ge v(C_{i_s})$, we then know that for these values of the theta variables and parameters, $c \le c'$. This means that this holds for the whole of $E_{ij}$, and finally that $C_{i_r} \ge C_{i_s}$. $\square$

# 7. Case study

We now consider a scheduling problem where some tasks include *runnables*, a key concept of the AUTomotive Open System Architecture (AUTOSAR), the open standard for designing the architecture of vehicle software [22]. Runnables represent the functional view of the system and are executed by the runtime of the software component [23]. For their execution they are mapped to tasks and a given runnable can be split across different tasks to introduce parallelism, for instance. In industrial practice, runnables that interact a lot are mapped to the same task, in particular when they perform functions with the same period.

In this example, we consider 3 non-preemptive, periodic tasks T1, T2 and T3, on which have already been mapped some runnables that interact together; we add another independent runnable whose code must be split between tasks T1 and T2:

* the period of task T1 is 100 time units; T1 includes a “fixed part”, independent from the new runnable and whose execution lasts 22 t.u.;

* the period of T2 is 200 t.u.; T2 also has a fixed part lasting 28 t.u.;

* the period of T3 is 400 t.u.; its execution lasts 11 t.u.;

* the period of the runnable is 200 t.u.; its execution lasts 76 t.u.; parameter $a$ denotes the duration of the section that is executed in T1².

The processing unit consists of 2 cores C0 and C1; T3 can only execute on C0 whereas both T1 and T2 can execute on either core. When both cores are idle, the cost is null; when only one core is busy, the cost is equal to 2/t.u.; when both cores are busy, the cost is equal to 3/t.u. Any optimised strategy to divide the runnable over T1 and T2 and to allocate these tasks to C0 or C1 must therefore favour the cases where both cores are in the same state.

<footnote n="2">²Every 200 t.u., since T1 is executed twice as often as T2, T1 is running during $(22 + a) * 2 = 44 + 2a$ t.u. whereas T2 is running during $28 + (76 - 2a) = 104 - 2a$ t.u.</footnote>
<figure><img src="image_5.png" /><figcaption>Figure 4. Offline non preemptive scheduling problem</figcaption></figure>

Figure 4 presents the model for this problem<fnref n="3" />. The associated cost function is: $2 * (C0 ≠ C1) + 3 * C0 * C1 + 1000 * (W1 * (R1C0 + R1C1) + W2 * (R2C0 + R2C1) + W3 * R3C0)$, where the name of a place (e.g. $R1C0$) represents its marking<fnref n="4" />.

We limit the study of the system to the first 400 t.u., at the end of which T1 has been executed 4 times, T2 twice and T3 once. This will be the marking to reach.

We start by computing the optimal cost with the corresponding parameter values. This is done with Romeo using formula `mincost(four==4 and two==2 and one==1)`. We obtain minimum cost 466 and $a \in [13, 17]$.

We can run a consistency check with the following bounded cost reachability property: `EF four==4 and two==2 and one==1 and cost≤466`. As expected this holds iff $a \in [13, 17]$.

We then try to relax the constraint on the cost a bit and for instance we find that property `EF four==4 and two==2 and one==1 and cost≤470` holds iff $a \in [12, 18]$. Similarly, the cost can be made less or equal to 500 iff $a \in [4, 26]$.

Back to the optimal case, we set $a$ to 17; Romeo provides the following timed trace, in which the notation `T1@t1` means that transition T1 is fired at date t1: `T1C0@61, T2C1@69, T1@100, end1_C0@100, T1C0@100, end1_C0@139, end2_C1@139, T1@200, T2@200, T2C0@261, T1C1@261, T1@300, end1_C1@300, T1C1@303, end2_C0@331, T3C0@331, end3_C0@342, end1_C1@342`

From this trace, we obtain the Gantt chart in Figure 5 (above). Setting $a$ to 13 yields another timed trace, resulting in the Gantt chart in Figure 5 (below). In both cases, we can see that both cores are busy during 148 t.u. (and for 11 t.u., only one is idle), which confirms our analysis on the optimised strategy above.

<footnote n="3">³To ensure a correct access to the cores, we could have added one place for each core and some arcs on each task to capture and release them but the resulting net would have been quite unreadable. Instead, we chose to add 2 integer variables C0 and C1 (both initialised to 0); a variable equal to 0 (resp. 1) obviously means the corresponding core is idle (resp. busy).</footnote>

<footnote n="4">⁴The last term ensures that such cases where an instance of a task is activated while a previous one is running are heavily penalised.</footnote>
<figure><img src="image_6.png" /><figcaption>Figure 5. Gantt charts for *a* = 17 (above) and *a* = 13 (below)</figcaption></figure>

## 8. Conclusion

We have proposed a new Petri net-based formalism with parametric timing and cost features, thus merging two classical lines of work. For this formalism, we define an existential problem and two synthesis problems for parametric reachability with cost constraints. We prove that the existential problem is undecidable but we nonetheless give and prove symbolic semi-algorithms for the synthesis problems. We finally propose variants of those synthesis semi-algorithms suitable for integer parameter valuations and prove their termination when those parameter valuations are bounded a priori, and with some other classical assumptions. These symbolic algorithms avoid the explicit enumeration of all possible parameter valuations. They are implemented in our tool Romeo and we have demonstrated their use on a case-study addressing a scheduling problem, and inspired by the AUTOSAR standard.

Further work includes computing the optimal cost as a function of parameters and investigating the case of costs (discrete and rates) as parameters.

## References

[1] Alur R, Henzinger TA, Vardi MY. Parametric Real-time Reasoning. In: ACM Symposium on Theory of Computing. 1993 pp. 592–601. doi:10.1145/167088.167242.

[2] Alur R, Dill D. A Theory of Timed Automata. *Theoretical Computer Science*, 1994. **126**(2):183–235. doi:10.1016/0304-3975(94)90010-8.

[3] Hune T, Romijn J, Stoelinga M, Vaandrager F. Linear Parametric Model Checking of Timed Automata. *Journal of Logic and Algebraic Programming*, 2002. **52-53**:183–220.

[4] Jovanović A, Lime D, Roux OH. Integer Parameter Synthesis for Real-Time Systems. *IEEE Transactions on Software Engineering (TSE)*, 2015. **41**(5):445–461. doi:10.1109/TSE.2014.2357445.

[5] Alur R, Torre SL, Pappas GJ. Optimal paths in weighted timed automata. *Theoretical Computer Science*, 2004. **318**(3):297–322. doi:10.1016/j.tcs.2003.10.038.

[6] Behrmann G, Fehnker A, Hune T, Larsen K, Pettersson P, Romijn J, Vaandrager F. Minimum-Cost Reachability for Priced Timed Automata. In: HSCC 2001 Rome, Italy. Springer. ISBN 978-3-540-45351-2, 2001 pp. 147–161. doi:10.1007/3-540-45351-2_15.
[7] Behrmann G, Larsen KG, Rasmussen JI. Optimal Scheduling Using Priced Timed Automata. *SIGMET-RICS Perform. Eval. Rev.*, 2005. 32(4):34–40. doi:10.1145/1059816.1059823.

[8] Larsen K, Behrmann G, Brinksma E, Fehnker A, Hune T, Pettersson P, Romijn J. As Cheap as Possible: Efficient Cost-Optimal Reachability for Priced Timed Automata. In: CAV’01, volume 2102 of LNCS. 2001 pp. 493–505. doi:10.1007/3-540-44585-4_47.

[9] Bouyer P, Colange M, Markey N. Symbolic Optimal Reachability in Weighted Timed Automata. In: CAV’16, volume 9779 of LNCS. Toronto, Canada, 2016 pp. 513–530. doi:10.1007/978-0-387-35608-2_40.

[10] Abdulla PA, Mayr R. Priced Timed Petri Nets. *Logical Methods in Computer Science*, 2013. 9(4). doi:10.2168/LMCS-9(4:10)2013.

[11] Boucheneb H, Lime D, Parquier B, Roux OH, Seidner C. Optimal Reachability in Cost Time Petri Nets. In: FORMATS’17, Berlin, Germany, LNCS. 2017 pp. 58–73. doi:10.1007/978-3-319-65765-3_4.

[12] Jovanović A. Parametric Verification of Timed Systems. Ph.D. thesis, École Centrale Nantes, Nantes, France, 2013.

[13] Lime D, Roux OH, Seidner C. Parameter Synthesis for Bounded Cost Reachability in Time Petri Nets. In: Donatelli S, Haar S (eds.), 40th International Conference on Application and Theory of Petri Nets and Concurrency (Petri Nets 2019), volume 11522 of Lecture Notes in Computer Science. Springer, Aachen, Germany, 2019 pp. 406–425. doi:10.1007/978-3-030-21571-2_22.

[14] Berthomieu B, Diaz M. Modeling and Verification of Time Dependent Systems Using Time Petri Nets. *IEEE trans. on soft. eng.*, 1991. 17(3):259–273.

[15] Bérard B, Cassez F, Haddad S, Lime D, Roux OH. Comparison of Different Semantics for Time Petri Nets. In: Peled DA, Tsay YK (eds.), 3rd International Symposium on Automated Technology for Verification and Analysis (ATVA 2005), volume 3707 of Lecture Notes in Computer Science. Springer-Verlag, Taipei, Taiwan, 2005 pp. 293–307. doi:10.1007/11562948_23.

[16] Minsky M. Computation: Finite and Infinite Machines. Prentice Hall, 1967.

[17] Berthomieu B, Menasche M. An Enumerative Approach For Analyzing Time Petri Nets. In: IFIP. Elsevier Science Publishers, 1983 pp. 41–46. ID: 10736503.

[18] Traonouez LM, Lime D, Roux OH. Parametric Model-Checking of Stopwatch Petri Nets. *Journal of Universal Computer Science*, 2009. 15(17):3273–3304. doi:10.3217/jucs-015-17-3273.

[19] Schrijver A. Theory of linear and integer programming. John Wiley & Sons, Inc., New York, NY, USA, 1986. ISBN:0-471-90854-1.

[20] Larsen KG, Pettersson P, Yi W. Model-Checking for Real-Time Systems. In: Fundamentals of Computation Theory, volume 965 of LNCS. 1995 pp. 62–88. doi:10.1007/3-540-60249-6_41.

[21] Bagnara R, Hill P, Zaffanella E. Not Necessarily Closed Polyhedra and the Double Description Method. *Formal Aspects of Computing*, 2005. 17:222–257. doi:10.1007/s00165-005-0061-1.

[22] AUTOSAR. Specification of RTE Software. Technical Report 4.4.0, 2018.

[23] Naumann N. AUTOSAR Runtime Environment and Virtual Function Bus. Technical report, Hasso-Plattner-Institut, 2009.