Opentopia Directory Encyclopedia Tools

Petri net

Encyclopedia : P : PE : PET : Petri net


A Petri net (also known as a place/transition net or P/T net) is one of several mathematical representations of discrete distributed systems. As a modeling language, it graphically depicts the structure of a distributed system as a directed bipartite graph with annotations. As such, a Petri net has place nodes, transition nodes, and directed arcs connecting places with transitions. Petri nets were invented in 1962 by Carl Adam Petri in his PhD thesis.

(a) Petri net Example
Enlarge
(a) Petri net Example

Basic Petri nets

A Petri net consists of places, transitions and directed arcs. Arcs run between places and transitions - not between places and places or transitions and transitions. The places from which an arc run to a transition are called the input places of the transition; the places to which arcs run from a transition are called the output places of the transition.

Places may contain any number of tokens. A distribution of tokens over the places of a net is called a marking. Transitions act on input tokens by a process known as firing. A transition is enabled if it can fire, i.e., there are tokens in every input place. When a transition fires, it consumes the tokens from its input places, performs some processing task, and places a specified number of tokens into each of its output places. It does this atomically, i.e. in one single non-preemptible step.

Execution of Petri nets is nondeterministic. This means two things:

  1. multiple transitions can be enabled at the same time, any one of which can fire
  2. none are required to fire—they fire at will, between time 0 and infinity, or not at all(!) i.e. it is totally possible that nothing fires at all.
Since firing is nondeterministic, Petri nets are well suited for modeling the concurrent behavior of distributed systems.

A Formal definition

A Petri net is a 6-tuple [(S,T,F,M_0,W,K)\!], where (see Desel and Juhás Desel, Jörg and Juhás, Gabriel "What Is a Petri Net? -- Informal Answers for the Informed Reader", Hartmut Ehrig et al. (Eds.): Unifying Petri Nets, LNCS 2128, pp. 1-25, 2001.)

A variety of other formal definitions exist. This definition is for a place-transition net. Most other definitions do not include arc weights or capacity restrictions.

Basic mathematical properties

The state of a Petri net can be represented as an M vector, where the 1st value of the vector is the amount of tokens in the 1st place of the net, the 2nd is amount of tokens in the 2nd place, and so on. Such a representation fully describes the state of a Petri net.

A state-transition list, [\vec \sigma = \langle M_ t_ M_ \ldots t_ M_ \rangle], which can be shortened to simply [\vec \sigma = \langle t_ \ldots t_ \rangle] is called a firing sequence if each and every transition satisfies the firing criteria (i.e. there are enough tokens in the input for every transition). In this case, the state-transition list of [\langle M_ M_ \ldots M_ \rangle] is called a trajectory, and [M_] is called reachable from [M_] through the firing sequence of [\vec \sigma]. Mathematically written: [M_ [ \vec \sigma > M_]. All firing sequences that can be reached from a net [N] and an initial marking [M_] are noted as [L(N,M_)].

The state-transition matrix [W^-] is [|T|] by [|S|] large, and represents the amount of tokens taken by each transition from each place. Similarly, [W^+] represents the amount of tokens given by each transition to each place. The sum of the two, [W=W^+ - W^-] can be used for calculating the above mentioned equation of [M_ [ \vec \sigma > M_] which can now be simply written as [M_0 - M_n = W^T \cdot \sigma], where [\sigma] is a vector of how many times each transition fired in the sequence. Note that just because the equation can be satisfied, does not mean that it can actually be carried out - for that there should be enough tokens for each transition to fire, i.e. the satisfiability of the equation is required but not sufficient to say that state [M_n] can be reached from state [M_0].

(b) Petri net Example
(b) Petri net Example
[W^=\begin * & t1 & t2 \\ p1 & 0  & 1 \\ p2 & 1 & 0 \\ p3 & 1& 0 \\ p4 & 0 & 1 \end ] [ W^=\begin * & t1 & t2 \\ p1 & 1  & 0 \\ p2 & 0 & 1 \\ p3 & 0 & 1 \\ p4 & 0 & 0 \end ] [W=\begin * & t1 & t2 \\ p1 & -1  & 1 \\ p2 & 1 & -1 \\ p3 & 1 & -1 \\ p4 & 0 & 1 \end] [M_=\begin 1 & 0 & 2 & 1 \end]
All states that can be reached from a net [N] with an initial marking [M_] are denoted as [R(N,M_)]. The reachability problem is then the following: is it true that [M_ \in R(N,M_)]? Where [M_] is, e.g. a wrong state such as an elevator moving while the door is open.

Reachability

Reachability graph of (a) Petri net Example. Note that the net is 2-bounded and thus it can only have a maximum of 9(3^2) states.
Reachability graph of (a) Petri net Example. Note that the net is 2-bounded and thus it can only have a maximum of 9([3^2]) states.

The reachability of the states can be represented with a reachability graph where a directed graph' points represent states (i.e. M), and arcs represent transitions between two such states. The graph is constructed as follows: the starting state ([M_0]) is taken, and all possible transitions are explored from this state, then the transitions from these states, and so on. The way the graph should be constructed is through breadth-first search, as the graph may be infinitely large, and so depth-first search would not find all possible states even if given infinite time. Note, that if the graph is inherently bounded, its reachability graph will always have a finite amount of states.

While reachability seems to a be a good tool to find erroneous states, such as an elevator moving while the door is open, for practical problems the constructed graph usually has far too many states to calculate. To alleviate this problem, the LTL logic is usually used in conjunction with the tableau method to prove that such states cannot be reached. LTL uses the semi-decision technique to find if indeed a state can be reached, by finding a set of necessary conditions for the state to be reached then proving that those conditions cannot be satisfied.

Liveness

A Petri net ([N,M_0])'s transition t is Note that these are increasingly stringent requirements such that if a transition is e.g. [L_3] live, is automatically [L_1] and [L_2] live as well. As an example, (b) Example Petri net is live with the given inital state, but with a different (e.g. totally empty) initial state, all of its transitions can be dead. On the other hand, (a) Example Petri net's transitions are all [L_3] live no matter what the initial state is - they are not [L_4] live, since when the state is (0,2) or (2,0), one of its transitons can not be fired, since the net is 2-bounded.

A Petri net is [L_k] live if and only if every transition within it is [L_k] live.

Boundedness

There are Petri nets where the places are bounded for a maximum number of tokens - in this case, boundedness is an inherent property. However, Petri nets can be defined without the boundedness as an inherent property - in these cases, boundedness is a possible property of the Petri net. A non-inherently bounded Petri net is k-bounded if in no reachable state can at any place contain more than k tokens. A Petri net is safe if it is 1-bounded. Naturally, boundedness in this case is dependent on the initial [M_] marking (i.e. we can put 10 tokens into each place initially, making it impossible that the net is 2-bounded). Also note that the inherently not bounded example (b) Petri net is not bounded as P4 can possess infinite amounts of tokens, if the firing sequence (T1,T2) is repeated infinitely. However, example (a) Petri net, which is inherently bounded to k=2 for all places, is shown at every possible state.

Example place-transformation. The grey place that was originally inherently 2-bounded has been transformed into two places: a grey original, and a counter place
Enlarge
Example place-transformation. The grey place that was originally inherently 2-bounded has been transformed into two places: a grey original, and a counter place

Boundedness of a certain place in an inherently bounded net can be mimiced in an non-inherently bounded net by doing a place-transformation, where a new place (called counter-place) is made, and all transitions that put x tokens to the original place take x tokens from the counter-place, and all transitions that take away x tokens from the original place put x tokens to the counter-place. The number of tokens in [M_] must now satisfy the equation place+counter-place=boundedness. Thus, doing a place-transformation for all places in a bounded net, and restricting the starting state [M_] to conform to the above noted equality, a bounded net can easily be transformed to a non-bounded net. Therefore any analysis that is used on inherently non-bounded nets can be used on bounded nets (but not the other way around).

In general, inherent boundedness and other (non-)inherent properties are problematic not because they are hard to explain, but because there is no consensus in the mathematical community about what exactly should the definition of the Petri net be. In this article, boundedness is defined as an inherent property. In this section it has been shown that this property is not needed, as it can be circumvented. There are many such properties (e.g. colours).

Extensions

There are many extensions to Petri nets. Some of them are completely backwards-compatible (e.g. colored Petri nets) with the original Petri net, some add properties that cannot be modelled in the original Petri net (e.g. timed Petri nets). If they can be modelled in the original Petri net, they are not real extensions, instead are convenient ways of showing the same thing, and can be transformed with mathematical formulas back to the original Petri net, without losing any meaning. Extensions that cannot be transformed are sometimes very powerful, but usually lack the amount of mathematical tools available to analyze normal Petri nets.

The term high-level Petri net is used for many Petri net formalisms that extend the basic P/T net formalism. This includes colored Petri nets, hierarchical Petri nets, and all other extensions sketched in this section.

A short list of possible extensions:

There are many more extensions to Petri nets, however, it is important to keep in mind, that as the complexity of the net increases in terms of extended properties, the harder it is to use standard tools to evaluate certain properties of the net. For this reason, it is a good idea to use the most simple net type possible for a given modelling task.

Petri net theory

The theoretical properties of Petri nets have been studied extensively. A main motivation for the use of Petri nets in concurrent systems modelling is the possibility to formally state and decide certain desirable system properties, such as liveness (e.g. the system can never lock up) and boundedness (e.g. loosely, system resources such as CPUs are bounded). Naturally, the same property in a different context might mean a different thing.

A marking of a Petri net is reachable if, starting in the initial marking, a sequence of transition firings exists that produces it. A Petri net is bounded if there is a maximum to the number of tokens in its reachable markings.

Boundedness is decidable by looking at covering, by constructing the Karp-Miller Tree. Reachability is known to be decidable, however in at least exponential time. All known general algorithms so far, however, employ non-primitive recursive space. Further details may be found in this survey [] and in Kurt Jensen Coloured Petri Nets, and in M. Ajmone Marsan et al. Modelling with Generalized Stochastic Petri Nets.

Main Petri net types

There are six main types of petri net:

  1. State Machine (SM) - here, every transition has one incoming arc, and one outgoing arc. This means, that there can not be concurrency, but there can be conflict (i.e. Where should the token from the place go? To one transition or the other?). Mathematically: [\forall t\in T: |t\bullet|=|\bullet t|=1]
  2. Marked Graph (MG) - here, every place has one incoming arc, and one outgoing arc. This means, that there can not be conflict, but there can be concurrency. Mathematically: [\forall p\in P: |p\bullet|=|\bullet p|=1]
  3. Free choice (FC) - here, an arc is either the only arc going from the place, or it is the only arc going to a transition. I.e. there can be both concurrency and conflict, but not at the same time. Mathematically: [\forall p\in P: (|p\bullet|\leq 1) \vee (\bullet (p\bullet)=\)]
  4. Extended free choice (EFC) - a Petri net that can be transformed into an FC.
  5. Asymmetric choice (AC) - concurrecy and conflict (in sum, confusion), but not asymmetrically.Mathematically: [\forall p_1,p_2\in P: (p_1\bullet \cap p_2\bullet\neq 0) \to [(p_1bulletsubseteq p_2bullet) vee (p_2bulletsubseteq p_1bullet)]]
  6. Petri Net (PN) - confusion is allowed (i.e. everything is allowed)

Subsequent models of concurrency

Subsequent to the invention of Petri nets other models of concurrency, which are based on message passing and feature compositionality (e.g. the Actor model and the various process calculi), have been introduced. Robin Milner and Carl Hewitt have argued that the lack of compositionality is a serious limitation of Petri nets because the deficiency limits modularity.

In addition, Hewitt has argued that Petri nets lack locality because input tokens of a transition disappear simultaneously, which limits the realism of the model. He acknowledged the counterargument that the proper use of Petri nets is to obey the single event restriction which is that every transition should model a single event. An example of such a transition would be one with two input places, one representing the month being September 2005, and the other representing the date being September 30, 2005. If the event being modeled were the passing of midnight on that day, obviously both tokens would disappear at the same time. However obeying the single event restriction drastically limits the applications of Petri nets.

Application areas

Programming tools

See the list of Petri net tools.

See also

References

External links

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: