redes de petri s4pr

26
Discrete Event Dyn Syst DOI 10.1007/s10626-012-0132-4 An algorithm to compute the minimal siphons in S 4 PR nets Elia Esther Cano · Carlos A. Rovetto · José-Manuel Colom Received: 11 March 2011 / Accepted: 26 January 2012 © Springer Science+Business Media, LLC 2012 Abstract Minimal siphons in the class of S 4 PR nets have become a conceptual and practical central tool for the study of the resource allocation related aspects in discrete event dynamic systems as, for example, the existence of deadlocks. Therefore the availability of efficient algorithms to compute the minimal siphons is essential. In this paper we try to take advantage of the particular properties of the siphons in S 4 PR to obtain an efficient algorithm. These properties allow us to express minimal siphons as the union of pruned minimal siphons containing only one resource. The pruning operation is built from the binary pruning relation defined on the set of minimal siphons containing only one resource. This pruning relation is represented by means of a directed graph. The computation of the minimal siphons is based on the maximal strongly connected components of this graph. The algorithm is highly economic in memory in all intermediate steps when compared to the classical algorithms. Keywords Petri-nets · Structural analysis · Siphons · Graph theory · Strongly connected component E. E. Cano (B ) · C. A. Rovetto Computer Systems Engineering Department, Technological University of Panama, Panama City, Panama e-mail: [email protected] C. A. Rovetto e-mail: [email protected] J.-M. Colom Aragón Institute of Research Engineering (I3A), University of Zaragoza, Zaragoza, Spain e-mail: [email protected]

Upload: carlos-panameno

Post on 17-Dec-2015

257 views

Category:

Documents


7 download

DESCRIPTION

Redes de Petri

TRANSCRIPT

  • Discrete Event Dyn SystDOI 10.1007/s10626-012-0132-4

    An algorithm to compute the minimal siphonsin S4 PR nets

    Elia Esther Cano Carlos A. Rovetto Jos-Manuel Colom

    Received: 11 March 2011 / Accepted: 26 January 2012 Springer Science+Business Media, LLC 2012

    Abstract Minimal siphons in the class of S4 PR nets have become a conceptualand practical central tool for the study of the resource allocation related aspectsin discrete event dynamic systems as, for example, the existence of deadlocks.Therefore the availability of efficient algorithms to compute the minimal siphonsis essential. In this paper we try to take advantage of the particular properties ofthe siphons in S4 PR to obtain an efficient algorithm. These properties allow us toexpress minimal siphons as the union of pruned minimal siphons containing only oneresource. The pruning operation is built from the binary pruning relation definedon the set of minimal siphons containing only one resource. This pruning relation isrepresented by means of a directed graph. The computation of the minimal siphons isbased on the maximal strongly connected components of this graph. The algorithm ishighly economic in memory in all intermediate steps when compared to the classicalalgorithms.

    Keywords Petri-nets Structural analysis Siphons Graph theory Strongly connected component

    E. E. Cano (B) C. A. RovettoComputer Systems Engineering Department, Technological University of Panama,Panama City, Panamae-mail: [email protected]

    C. A. Rovettoe-mail: [email protected]

    J.-M. ColomAragn Institute of Research Engineering (I3A), University of Zaragoza, Zaragoza, Spaine-mail: [email protected]

  • Discrete Event Dyn Syst

    1 Introduction

    The analysis of resource allocation related aspects is a precondition for the designand control of many Discrete Event Dynamic Systems. Examples of this kind ofsystems, where the Resource Allocation Systems (RAS) view is a phase of thedesign, can be found in the context of Flexible Manufacturing Systems, SoftwareEngineering applications, Workflow Systems, Logistic Systems, etc.

    The RAS analysis of a system requires an abstraction process in order to retainonly those aspects relevant to the representation of the resource allocation. Theformulation of this abstraction of this application-driven problem in terms of Petrinets has been a successful approach in many fields (Reveliotis 2005; Ezpeletaet al. 1995; Li and Zhou 2009; Lopez-Grao and Colom 2010; Wang et al. 2009b),leading to several subclasses of Petri Net models, with a specific structure-basedcharacterization. The subclass of S3 PR nets is probably the most widely studied in theliterature even today. In this subclass, the liveness property has been characterizedin terms of some siphons of the net (Reveliotis 2005; Ezpeleta et al. 1995). Alsothe synthesis of live S3 PR models (named liveness enforcing by some authors) isbased on techniques that, in many cases, require to know the bad siphons of the net(Reveliotis 2003; Tricas et al. 2005). Therefore, the availability of efficient algorithmsfor the computation of all minimal siphons or other sets of siphons is indispensablein the frameworks working with this kind of Petri Net models.

    Many algorithms, for the computation of minimal siphons, have been proposed inthe past years (Chao 2009; Li et al. 2008; Xing et al. 2011); all specifically designedfor the class S3 PR. This means that they profit from the particular structure of S3 PRto obtain good performance in the computation of the set of minimal siphons.

    S4 PR is a more general class that strictly contains the class S3 PR (Tricas 2003;Colom 2003). In a similar way to the S3 PR class, in the case of S4 PR nets, the livenessproperty has also been characterized in terms of some siphons of the net (Reveliotis2005; Tricas 2003); and the synthesis of live S4 PR models is strongly related, inmany cases, to the bad siphons of the net (Reveliotis 2003; Tricas et al. 2005).Therefore, efficient algorithms are also needed for calculating minimal siphons ofS4 PR nets. But in this case there are not specific algorithms exploiting the structuralcharacteristics of S4 PR nets as in the case of S3 PR nets. Moreover, the algorithmsfor the S3 PR class cannot be applied to the class S4 PR because of the strict structuralconstraints imposed to S3 PR nets. For example, an active process in a S3 PR netuses only one resource in each reachable state. This constraint does not appear inS4 PR. To point out the important differences between S3 PR and S4 PR, observe, forexample, that the number of resource-transition circuits (MPCs) for S4 PR nets (Xinget al. 2011) can be a combinatorial number with respect to the number of resourcesmaking non acceptable the performance of the algorithm if we try (assuming that thisis possible) to adapt the S3 PR algorithm (Xing et al. 2011) to S4 PR nets. Additionally,as we will see, there exist S4 PR nets without resource-transition circuits (see Fig. 9).Therefore, algorithms (as that presented in Xing et al. 2011) to compute siphons inS4 PR based on this concept are non viable.

    Therefore, for S4 PR, the algorithms that can be applied for the computation ofminimal siphons are those applied to general Petri Nets (Barkaoui and Lemaire1989; Chu and Xie 1997; Ezpeleta et al. 1993; Lautenbach 1987; Li and Zhou 2008;Wang et al. 2009a) All these algorithms work operating with the places and the

  • Discrete Event Dyn Syst

    transitions of the net. Many of these algorithms are related to the problem of thecomputation of the extremal directions of a positive convex cone and they are basedon variants of the FourierMotzkin elimination method for solving systems of linearinequalities (Williams 1986). In these methods the basic idea is to eliminate variablesfrom the system of inequalities by adding to them all the inequalities resulting frompositive linear combinations of pairs of inequalities, and removing those used tocompute the new inequalities. The method proceeds by eliminating all the variablesand memorizing, for each final inequality, the coefficients of the positive linearcombination of rows which generated it. These coefficients determine which placesbelong to a siphon. The computational difficulty of the method lies in the largenumber of inequalities added in the process of eliminating variables. Many of themare redundant and can be discarded. The different variants published (Colom andSilva 1991) seek the common goal of breaking the growth of the new inequalities byeliminating the redundant ones by means of sophisticated heuristics. In any case, theresulting reported algorithms are prohibitive from the point of view of the occupationof memory even for relatively small examples.

    There are other algorithms that also apply to general Petri nets but are basedon other principles non-related to the Fourier-Motzkin elimination method. Forexample in Cordone et al. (2005) an algorithm based on search problems constructedaround place constraints is presented. The complexity is exponential with respect tothe number of places of the net and the algorithm presented in this paper is alsoexponential but with respect to the number of resources places.

    In this paper we propose a new algorithm that works with objects of higherlevel than the places and transitions allowing a greater efficiency, at least, in theoccupation of memory in the intermediary steps. These higher level objects are theminimal siphons of the net that contain only one resource. The existence of one ofthese minimal siphons for each resource of the net is guaranteed by the definitionof the class (it requires one minimal p-semiflow per resource). We will proveadditionally that for each subset of resources there exists, at most, a minimal siphoncontaining these resources. Therefore, our algorithm proposes the construction ofeach minimal siphon by means of a union of the minimal siphons with one resourcecorresponding to the resources included in the siphon to be constructed. The resultof this union is a siphon, but non-minimal, in general. For this reason we introducea pruning relation on the set of minimal siphons with a resource used to constructthe new siphon, in order to remove the non-essential places of each minimal siphonwith a resource. The representation of the pruning relation by means of a graph,allows us to obtain the minimal siphons by computing and manipulating maximalstrongly connected subgraphs of the graph of the relation (its strongly connectedcomponents). Therefore, the required memory is very small and of the order of thesize of the pruning graph.

    The paper is organized as follows. Section 2 presents the basic notions andnotations used throughout the paper. Section 3 introduces the definition and basicresults concerning the S4 PR class of nets. Section 4 presents some properties ofsiphons in S4 PR nets. Section 5 is devoted to the definition of the pruning relationand the representation in terms of graphs. Section 6 presents the main result of thepaper, the characterization of minimal siphons in terms of the pruning graph, andan algorithm for the computation of the set of minimal siphons. Finally in Section 7,some conclusions are given.

  • Discrete Event Dyn Syst

    2 Petri nets: basic definitions

    We assume that the reader is familiar with basic Petri net concepts (see for exampleMurata 1989). In the following we present the main notation used throughout thepaper.

    A place/transition net (P/T net) is a 3-tuple N = P, T, W, where W is a totalfunction W : (P T) (T P) N, being P, T non-empty, finite and disjoint sets.Elements belonging to the sets P and T are called respectively places and transitions,or generally nodes. P/T nets can be represented as a directed bipartite graph, whereplaces (transitions) are graphically denoted by circles (rectangles): let p P, t T,u = W(p, t), v = W(t, p), there is a directed arc, labelled u (v), beginning in p (t) andending in t (p ) iff u = 0 (v = 0).

    The preset (postset) or set of input (output) nodes of a node x P T is denotedby x (x), where x = {y P T | W(y, x) = 0} (x = {y P T | W(x, y) = 0}).The preset (postset) of a set of nodes X bag(P) bag(T) is denoted by X (X),where X = {y | y x, x X} (X = {y | y x, x X}

    A generalized P/T net is a net with positive arc weights. If the arc weights areunitary (i.e., W can be defined as a total function (P T) (T P) {0, 1}) thenet is called ordinary. A state machine is an ordinary net such that for every transitiont T, |t| = |t| = 1.

    A self-loop place p P is a place such that p p. A pure P/T net (also self-loop free P/T net) is a net with no self-loop places. In pure P/T nets, the net can bealso defined by the 3-tuple N = P, T, C, where C is called the incidence matrix,C[p, t] = W(p, t) W(t, p).

    A marking m of a P/T net N is a vector IN|P|, assigning a finite number of marksm[p] (called tokens) to every place p P. Tokens are represented by black dotswithin the places. The support of a marking, m, is the set of places which aremarked in m, i.e. m = {p P | m[p] = 0}.

    We define a marked P/T net (also P/T net system) as the tuple N , m0, where Nis a P/T net, and m0 is a marking forN , also called initial marking.N is said to be thestructure of the system, while m0 represents the system state.

    Let N , m0 be a marked P/T net. A transition t T is enabled (also firable)iff p t , m0[p] W(p, t), which is denoted by m0[t. The firing of an enabledtransition t T changes the system state to N , m1, where p P , m1[p] =m0[p] + C[p, t], and is denoted by m0[tm1. A firing sequence from N , m0 is anon-empty sequence of transitions = t1 t2 ... tk such that m0[t1m1[t2 ... mk1[tk.The firing of is denoted by m0[ mk. We call the firing count vector of tobe the Parikh mapping IN|T| (i.e. [t] is equal to the number of times t appearsin ). The support of is denoted by .

    A marking m is reachable from N , m0 iff there exists a firing sequence suchthat m0[ m. The reachability set RS(N , m0) is the set of reachable markings, i.e.RS(N , m0) = {m | , m0[ m}.

    A transition t T is live iff for every reachable marking m RS(N , m0), m RS(N , m) such that m[t. The system N , m0 is live iff every transition is live.Otherwise, N , m0 is non-live. A transition t T is dead iff there is no reachablemarking m RS(N , m0) such that m[t. In the system N , m0 a reachable markingm is a total deadlock iff every transition is dead at m, i.e. no transition is firablefrom m.

  • Discrete Event Dyn Syst

    A p-semif low (t-semif low) is a vector Y IN|P|, Y = 0 (X IN|T|, X = 0), whichis a left (right) annuler of the incidence matrix, i.e., Y C = 0 (C X = 0). The sup-port of a p-semiflow (t-semiflow) is denoted Y (X), and its places (transitions)are said to be covered by Y (X). The P/T net N is conservative (consistent) iff everyplace (transition) is covered by a p-semiflow (t-semiflow). A minimal p-semif low(minimal t-semif low) is a p-semiflow (t-semiflow) such that the g.c.d of its non-nullcomponents is one and its support Y (X) is not a strict superset of the supportof another p-semiflow (t-semiflow).

    A siphon in a Petri Net is a structural object defined as a non-empty subset ofplaces, D, such that D D. They are connected via transitions in such a way thatif there are not tokens inside the places then it is not possible that they gain tokenscoming from the rest of the net. A siphon D is said to be minimal iff it does notcontain another non-empty siphon as a proper subset. The removal of a place froma minimal siphon with at least two places yields a subset of places that neither is, norcan contain a siphon.

    A path of a P/T net N is a sequence of nodes = x1 x2 ... xn such that the oddcomponents are places and the even components transitions, or vice-versa, and forevery pair (xi, xi+1), W(xi, xi+1) = 0. An elementary path is a path such that i, j [1, n] , xi = x j, except for x1 = xn (which is allowed). A general circuit is a path suchthat x1 = xn. An elementary circuit (or simply circuit) is both an elementary path anda general circuit.

    3 The subclass of S4 PR nets

    The following is the formal definition of the S4 PR class (Tricas 2003).

    Definition 1 The class of S4 PR nets.Let IN = {1, 2, ..., m} be a finite set of indices. An S4 PR net is a connected

    generalised self-loop free Petri net N = P, T, C where:1. P = P0 PS PR is a partition such that:

    (a) PS = iIN PSi , PSi = and PSi PS j = , for all i = j.(b) P0 = iIN {p0i}.(c) PR = {r1, r2, . . . , rn}, n > 0.

    2. T = iIN Ti, Ti = , Ti T j = , for all i = j3. For all i IN , the subnetNi generated by PSi {p0i} Ti is a strongly connected

    state machine, such that every cycle contains p0i .4. For each r PR there exists a minimal P-Semiflow, yr IN|P|, such that {r} =

    ||yr|| PR, yr[r] = 1, P0 ||yr|| = , and PS ||yr|| = .5. PS = rPR (||yr|| \ {r}).

    Places of PS are called process places. Each place p0i is called idle place, andrepresents the state in which the corresponding processes are idle. Each stronglyconnected state machine in Definition 1.3 models a sequential process competing forshared resources represented by means of the so called resource places belongingto the set PR. For a given resource, r, the holders of r is the set of process places

  • Discrete Event Dyn Syst

    using a copy of r : Hr = ||yr|| \ {r}. The holders of a set of resources A PR, isthe set HA = rAHr. This definition must be completed with the definition of theacceptable initial markings (Colom 2003; Tricas 2003): initial markings representingno activity in the system and allowing the execution of a single sequential process inisolation. Sometimes we will refer to active processes as tokens in process places, i.e.tokens in one of the state machines outside of its corresponding idle place.

    Definition 2 Let N = P0 PS PR, T, C be a S4 PR net. An initial marking m0 isacceptable for N if and only if:

    1. i IN , m0[p0i ] > 0.2. p PS, m0[p] = 0.3. r PR, m0[r] max{yr[p] | p ||yr|| \ {r}}.

    Given a marking m in a S4 PR net, a transition t is said to be m-process-enabled(m-process-disabled) iff it is (not) enabled by its input process place, and m-resource-enabled (m-resource-disabled) iff all (some) input resource places (place) have (hasnot) enough tokens to fire it.

    The following theorem presents a liveness characterization for S4 PR nets that isfully behavioural.

    Theorem 1 (Colom 2003; Tricas 2003) Let N , m0, N = P0 PS PR, T, C bea marked S4 PR. The system is non-live if and only if there exists a marking m RS(N , m0) such that the set of m-process-enabled transitions is non-empty and eachone of these transitions is m-resource-disabled.

    Theorem 1 relates non-liveness to the existence of a marking where activeprocesses are blocked. Their output transitions need resources that are not available.This suggests that there exists a set of circular waits between the blocked processes.

    This concept of circular waits is captured in the model by the existence of asiphon (a structural cause for non-liveness in Petri Net terms) whose resourceplaces are the places preventing the firing of the process-enabled transitions. Thefollowing theorem characterizes non-liveness in terms of siphons, establishing thebridge between behaviour and model structure of the Petri Net.

    Theorem 2 (Colom 2003; Tricas 2003) Let N , m0, N = P0 PS PR, T, C be amarked S4 PR. The net is non-live if, and only if, there exists a marking m RS(N , m0)and a siphon D such that

    pPS m[PS] > 0 and the f iring of each m-process-enabled

    transition is prevented by a set of resource places belonging to D. Moreover, the siphonD is such that:

    1. DR = D PR = {r PR|t r such that m[r] < Pre[r, t] and m[t PS] > 0} =;

    2. DS = D PS = {p HDR |m[p] = 0} = .

    A siphon D and a marking m RS(N , m0) verifying the properties of Theorem 2will be said to be a bad siphon and a D-deadlocked marking, respectively.

  • Discrete Event Dyn Syst

    Definition 3 (Tricas 2003) Let N , m0, N = P0 PS PR, T, C be a markedS4 PR. Let D be a siphon of N . Then, T hD = HDR \ DS is the set of thieves of D.1

    The previous definition represents the places of the net that use resources of thesiphon and do not belong to it.

    The following liveness characterization establishes that when a S4 PR is not live,there exists a D-deadlocked marking such that all the active processes are stealingtokens from the set of resources of an associated siphon D called bad siphon.

    Theorem 3 (Tricas 2003) Let N , m0, N = P0 PS PR, T, C, be a markedS4 PR. The net is non-live if, and only if, there exists a siphon D, and a markingmD RS(N , m0) such that:1. mD[PS] > 0.2. mD[PS \ T hD] = 0.3. p T hDR such that mD[p] > 0, the f iring of each t p is prevented by a set of

    resource places belonging to D.

    From the previous results it is obvious that siphons play an important role inthe analysis of the liveness property in S4 PR nets. Moreover, the liveness enforcingtechniques developed for S4 PR (Reveliotis 2003; Tricas et al. 2005) also use thesiphons of the net. Therefore, this is the motivation for the study of the propertiesof siphons for this subclass of nets and the development of more efficient algorithmsfor their computation exploiting these properties.

    4 Properties of the siphons of S4 PR nets

    In the case of S4 PR nets, the definition of the class imposes strict constraints on thestructure, and in particular on the resource places. Therefore, the siphons in S4 PRhave a particular structure with nice properties. This first lemma states that a siphoncontaining resource places must contain process places.

    Lemma 1 Let N be a S4 PR net and D P a siphon of N . D PR = = D PS = .

    Proof We prove this result by contradiction. Let us suppose that D = is a siphonof N such that D PS = . Let C be a directed circuit in the state machine k ofN such that C = t0t1 tu, t0 (p0k), k IN , t j (t j1) for all j {1, . . . , u 1},t0 = tu, and C = {t0, t1, . . . , tu}. Let CD be the set of input transitions of the places inD belonging to the directed circuit C of N , that is, CD = D C . At least one of thesets CD, for some directed circuit of some state machine, is non-empty because thesiphon is non-empty. Using the ordering imposed in the transitions of the directedcircuit C, we can order the transitions of the set CD. Let t CD be the last transitionaccording to this ordering, and r D the resource such that t r. Because D is asiphon containing only resource places, there exists another resource place r D

    1Sometimes is used T hDR to show the relation among these two sets.

  • Discrete Event Dyn Syst

    such that t (r). Moreover, there is no transition, t, after t in the circuit C, suchthat t r because t is the last transition of the set CD in the circuit. Therefore, ifwe construct the minimal p-semiflow corresponding to the resource place r, to annulthe columns in the incidence matrix corresponding to the transitions in the circuit C,from t until the transition tu, we need the output process places of these transitions,including the idle place. But this contradicts the hypothesis that N is a S4 PR net,where each resource belongs to a minimal p-semiflow that does not include the idleplace. unionsq

    The reciprocal of this lemma is not true, because each subnet Ni (Definition 1.3)generated by PSi {p0i} Ti is a strongly connected state machine, and therefore isa minimal siphon that does not contain resource places.

    Lemma 2 Let N be a S4 PR net and D P a non-empty minimal siphon of Ncontaining at least one resource place. D is the unique minimal siphon ofN containingexactly the set of resources DR = D PR.

    Proof We will prove this result by contradiction. Let us suppose that there exist twominimal siphons D and D such that D = D and DR = D PR = D PR = . Let0 be the set of input transitions to the resource places belonging to DR such that theydo not have input places belonging to DR, i.e. 0 = {t T | t DR, t DR = }.The set 0 must be non-empty, since 0 = implies that DR must be a siphon andthis is not possible according to Lemma 1. Taking into account that D and D areminimal siphons of N , for all t 0 there exists p D PS and p D PS suchthat p t and p t. But p and p are process places belonging to the same statemachine containing the transition t, therefore p = p. Let DS0 be the set of processplaces belonging to both siphons that are input places to the transitions of the set 0.Moreover, if p DS0 , there exists a resource place r DR such that p ||yr||, i.e. pis a holder place of some r DR. Let 1 be the set of input transitions to the placesbelonging to D1 = DR DS0 such that they do not have input places belonging toD1, i.e. 1 = {t T | t D1, t D1 = }. Now, two cases must be distinguished,1 = . In this case we have proven that for all t D1 = t D1, that is, D1 is a

    siphon. We have also proven that D1 D and D1 D, contradicting theminimality of D and D. Therefore, D = D = D1.

    1 = . In this case t 1 = t DS0 , and for the same reasons stated previouslyfor the transitions in 0, there exists a process place q belonging to bothsiphons D and D such that q t. Moreover, if the place p t DS0belongs to the support of the p-semiflow yr, for some r DR, then q ||yr||.Therefore, we will obtain the sets DS1 and D2 = DR DS0 DS1 as in thecase of the set 0. We can iterate this procedure a finite number of times, k,reaching a set k = . In effect, from the iteration j to the iteration j + 1 weare making a backward propagation from each place p DS j to a placeq DS j+1 if and only if j p = . Both places p and q belong to thesupport of a p-semiflow yr of a resource r DR. Therefore, this backwardpropagation from each place p DS0 always finishes in a place q (r)in at most k iterations, where k is the maximal length of a sequence ofprocess places of yr, r DR, in the same state machine. In this case we

  • Discrete Event Dyn Syst

    have proven that for all t Dk = t Dk, that is, Dk is a siphon. Wehave also proven that Dk D and Dk D, contradicting the minimalityof D and D. Therefore, D = D = Dk. unionsq

    From Lemma 2, given a S4 PR net,N , its set of minimal siphons, generally, can bepartitioned into |PR| + 1 classes, each one characterized by the number of resourcesbelonging to each siphon in the class. We will denote the partition of the set D ofthe minimal siphons of N into classes as D = |PR|i=0 Di; where Di is the subset ofminimal siphons such that each one contains exactly i resource places; and for alli, j {0, 1, . . . , |PR|} with i = j, Di D j = .

    The partition of the minimal siphons into the set of classes Di does not meanthat we must have at least one siphon in each class. For example the net of Fig. 1has 6 resource places but we have only four minimal siphons containing morethan 1 resource. The following is the list of minimal siphons of the net of Fig. 1:{P, j}, {S, h, d}, {T, i, c}, {R, a, f }, {U, b , e, m}, {Q, k, l, g}, {R, U, b , f, m}, {Q, R, U,b , g, k, m}, {P, Q, S, T, U, d, e, g, i, k, m}, {P, Q, R, S, T, U, d, g, i, k, m}. That is, inthe classD1 we have 6 minimal siphons and in the classesD2,D3,D5 andD6 we haveonly 1 siphon per class. That is, any of the possible classes can be empty as in this casehappens withD4. This is the major difficulty in order to construct efficient algorithms

    Fig. 1 A S4 PR net without minimal siphons in the class D4 (the idle places are omitted to simplifythe drawing)

  • Discrete Event Dyn Syst

    for the computation of the minimal siphons that proceeds in an incremental way froma class Di to the class Di+1 using only the minimal siphons of the class D1.

    Class D0 is completely characterized by Definition 1, so that it does not need tobe computed. In effect, the only minimal siphons containing zero resources are thesets of places of the strongly connected state machines defined in the net, i.e. D0 ={PSi {p0i} | i IN = {1, 2, ..., m}}.

    On the other hand, the class D1 of the minimal siphons containing only oneresource can be directly obtained from the set of minimal p-semiflows associatedto the resources.

    Lemma 3 Let N be a S4 PR net. For each r PR there exists a minimal siphon, Dr D1, such that Dr ||yr||.

    Proof Let r PR be a resource place, trivially, the support of the minimal p-semiflow associated to r, yr IN|P|, is a siphon of the net. This is because yr is ap-semiflow and in order to annul each column of the incidence matrix correspondingto a transition, t, in the set (||yr||) (||yr||) we need at least one input place andone output place of t since the net is strongly connected. This means that (||yr||) =(||yr||), i.e. ||yr|| is a siphon. Nevertheless, in general, ||yr|| is not a minimal siphon,but it contains a minimal siphon Dr. We prove that r Dr by contradiction. Letus suppose that r Dr. Since r is the only resource in ||yr|| and ||yr|| P0 = , thesubnet generated by Dr is a set of directed paths in the strongly connected statemachines ofN , such that for each path there exists at least a transition without inputplaces and then Dr cannot be a siphon, contradicting the hypothesis. unionsq

    In Fig. 2a the reader can observe that the support of the minimal p-semiflow ofr, ||yr|| = {r, b , c}, is a siphon but it is not minimal because it contains the minimalsiphon {r, c}. This kind of siphons cannot be present in the class of S3 PR nets. Eachminimal siphon of D1 is contained in the support of the corresponding minimalp-semiflow, and this minimal siphon is unique (Lemma 2). In other words, thecardinality of D1 is equal to |PR| and each minimal siphon is obtained from the p-semiflow, possibly removing some places to make it minimal.

    For the rest of the classes, Di and i > 1, the only thing we can say a priori isthat |Di|

    ( |PR|i

    )

    , that is, the number of minimal siphons containing i resources

    is bounded by the number of subsets of i places of the set PR.From the above discussions, the following trivial lemma states lower and upper

    bounds of the number of minimal siphons of a S4 PR net. These bounds cannot beimproved because there exist nets with a number of minimal siphons equal to eachone of the bounds. For example, the nets in Fig. 2a and b have a number of minimalsiphons equal to the lower and to the upper bound, respectively, specified in thefollowing lemma.

    Lemma 4 Let N be a S4 PR net. The number of minimal siphons of N , nD, satisf ies,nI + nR nD nI + 2nR 1, where nI is the number of strongly connected statemachines of N , and nR = |PR|.

  • Discrete Event Dyn Syst

    (a) (b)Fig. 2 a The minimal siphon {c, r} is strictly contained in the support of the minimal p-semiflow yr;b A S4 PR net with a number of minimal siphons equal to the upper bound of Lemma 4

    The upper bound cannot be improved even in the simplest subclass of S4 PR: theL S3 PR subclass (Ezpeleta et al. 1998). In effect, the net in Fig. 3 is a L S3 PRnet with 3 resources and the number of minimal siphons is equal to 11.

    The next lemma presents a technical result stating that a minimal siphon contain-ing a set of resources DR = , is always contained into the union of the minimalsiphons Dr D1, r DR.

    Fig. 3 A Petri Net belongingto the subclass L S3 PR

  • Discrete Event Dyn Syst

    Lemma 5 LetN be a S4 PR net, D P a minimal siphon ofN and DR = D PR =. D rDR Dr, Dr D1.

    Proof D = rDR Dr, Dr D1, is a siphon because each Dr is also a siphon. Letus suppose that D D. This means that there exists, at least, a process place p D Ps such that p D. Moreover, p Dr, r DR, because D = rDR Dr. D isa minimal siphon, therefore the place p is essential for the siphon D, i.e. there existst p such that t D = {p} and t D = . Let q be a place such that q t D.If q is a resource place, then the place p is essential for the minimal siphon Dq,but this contradicts the previous result saying that p Dr, r DR. If q is a processplace, because of the minimality of D, q is essential for D and we can reapply theprevious reasoning on p but for q. Iterating the scheme we have constructed a pathptq... until we reach a resource place x D, and in a similar way to the case whereq is a resource place we conclude that p is essential for the siphon Dx, contradictingthe previous result saying that p Dr,r DR. Therefore, we conclude that D

    rDR Dr, Dr D1. unionsq

    From the two previous results, the following lemma can be trivially obtained.

    Lemma 6 LetN be a S4 PR net, D P a minimal siphon ofN and DR = D PR =. D rDR ||yr||.

    The next lemma proves that is not possible to find idle places belonging to aminimal siphon with resources.

    Lemma 7 Let N be a S4 PR net and D P a non-empty minimal siphon of Ncontaining at least one resource place. D P0 = .

    Proof According to Lemma 6, D rDr ||yr||, where DR = D PR. By thedefinition of S4 PR nets, P0 ||yr|| = , for all r PR. Therefore, D P0 (

    rDr ||yr||) P0 = . unionsq

    This last result allows to remove the idle places from the net before the start ofthe computation of the minimal siphons, reducing the size of the input.

    5 The binary pruning relation on the set of minimal siphons with only one resource

    The proposed algorithm, presented in this paper, to compute minimal siphons inS4 PR nets is mainly based on Lemma 2. That is, given a set of resources DR PRthere exists at most one minimal siphon containing this set of resources. Therefore, inorder to compute all minimal siphons we need to consider at most 2|PR| 1 candidatesubsets, each one containing a different non-empty subset of resources. An easy wayto construct each one of these 2|PR| 1 candidate siphons is by the union of theminimal siphons of D1 corresponding to the resources included in the siphon to beconstructed.

    Obviously, the result of this union operation is a siphon because each one of theoperands is a siphon, but, in general, it is not minimal. This non-minimality can arise

  • Discrete Event Dyn Syst

    from process places, p, that become non-essential for the resulting siphon, i.e. thereare other input places to the transitions p in the resulting siphon that allow us toremove p. The input places of the transitions p in the resulting siphon, making pnon-essential, are resource places because process places belong to state machines.The other source of non-minimality appears when none of the places of a siphonDr D1 becomes non-essential. In this case, the full minimal siphon Dr is containedin the resulting siphon from the union operation, and therefore this last one will benon-minimal. Moreover, in this case, there is not a minimal siphon containing theintended set of resources because, at least, one of them: r, cannot belong becauseDr is contained. In the net of Fig. 1 is possible to find examples of the previouslydescribed scenarios. In effect, any siphon containing four resources is non-minimalbecause at least a minimal siphon containing one of its resources is completelycontained. On the other hand, in the siphon resulting from the union of the minimalsiphons of R and U , the process places a and e become non-essential because of theresources U and R, respectively.

    From the previous informal discussion about non-minimality of the result of theunion of a subset of siphons in D1, in this section we define a set of formal tools andresults. These allow to sieve the 2|PR| 1 candidate siphons, in order to retain onlythose giving rise to the minimal ones.

    The first tool is the so called pruning relation defined on the set D1. We willsay that the minimal siphons Dr and Dx are related by the pruning relation, orequivalently, that the siphon Dr D1 prunes the siphon Dx D1, r = x, if and onlyif Trx = Dr Dx = (the two siphons share some transition) and Ur = r Trx (Trx Dx Ps) = (there exist common transitions with an input process placebelonging to Dx and also the resource r inputs to these transitions).

    The candidate elements to be pruned from the siphon Dx by the siphon Dr are ineach one of the pairs (t, t Ps), where t Ur. The candidate place to be removedfrom one of these pairs is t Ps. This place can be removed, because it becomesnon-essential in Dr Dx, only if (t Ps) Ur, i.e. all its output transitions belongto the previously defined set Ur.

    In order to represent this pruning relation we will define a graph named PruningGraph (PG).

    Definition 4 Let N be a S4 PR net and PR the set of resource places. The PruningGraph (PG) of N is a graph G = (V, E) where, (1) V = PR; and (2) E V Vand for all r, x PR, (r, x) E iff Ur = r Trx (Trx Dx Ps) = with Trx =Dr Dx.

    Given a Pruning Graph G = (V, E), we define the Pruning Subgraph G ofG induced on the set of vertices V V, as the graph G = (V , E (V V )).Associated to a Pruning Graph or Subgraph we define the following three labellingfunctions.

    Definition 5 Let N be a S4 PR net and G = (V, E) a pruning graph or sub-graph of N .

    (a) Resource labelling function. S : PR D1, where for all r PR, S(r) = Dr D1, and Dr PR = {r}.

  • Discrete Event Dyn Syst

    (b) Arc labelling function. L : E 2TPs , where (r, x) E, L((r, x)) = {(t, p)|t r Trx (Trx S(x) Ps); Trx = S(r) S(x); {p} = t Ps}.

    (c) Pruning labelling function. KG : V 2Ps , where for all r V, KG(r) Ps com-puted by Algorithm 1.

    Algorithm 1 Pruning labelling function of G

    Input. N = P0 Ps PR, T, C The S4 PR net.r PR The resource of the siphon Dr D1 for which we will compute the

    pruning set in the graph G.G = (V, E) The pruning graph or subgraph of N .

    Output. KG(r) Ps1. TF = {t|(t, p) L((x, r)) and (x, r) E}2. Ppartial = {p|(t, p) L((x, r)); (x, r) E; and p TF = p}3. KG(r) = {p|(t, p) L((x, r)); (x, r) E; and p TF}4. Tnew = KG(r)\r5. While Tnew = do6. TF = TF Tnew7. Pnew = Tnew Ps S(r)8. A = {p|p Pnew; p TF}9. B = {p|p Ppartial; p TF}10. C = {p|p Pnew; p TF = p}11. KG(r) = KG(r) A B12. Ppartial = (Ppartial\B) C13. Tnew = (A B)\r14. end While

    The function S assigns to each vertex of the graph, i.e. each resource of the net,the minimal siphon belonging to D1 containing this resource. The function L labelseach arc (r, x) E with the set of pairs (t, p) representing a candidate place p tobe pruned by the minimal siphon Dr in the minimal siphon Dx when we constructDr Dx. Both functions, S and L, are defined for the graph G = (V, E) and for eachsubgraph G = (V , E), V V and E = E (V V ) the corresponding functionsS and L are the functions for G but constrained to the set of vertices V .

    The function KG is a function that must be computed for each graph or subgraph.For each node r, KG(r) is the set of places that will be pruned from the minimalsiphon Dr by all minimal siphons Dx such that there exists an arc (x, r) in the graphG on which we are computing KG(r). The places must be removed from Dr when weconstruct the resulting siphon from the union of Dr and all Dx siphons. Observe thatthe algorithm uses as seed the pairs labelling the arcs (x, r), because in these pairs wecan find the candidate process places that can be removed by a resource place. Afterthe detection of the first places to be pruned it is possible that a new set of placesbecomes non-essential and then must be pruned. For example, if we have removedthe place p from Dr, a new candidate to be pruned is a place q ( p) Dr Ps if pis the unique output place in Dr of the transitions p. Additionally, in the algorithm,through the set Ppartial we manage the places that are candidates to be removed butthey cannot be removed because it has an output transition that is an input transitionof a non pruned place of the siphon Dr.

  • Discrete Event Dyn Syst

    Observe that the computation of the pruning graph for nets belonging to the S3 PRclass can be simplified. In effect, if we compute the set TG(r) = {t|(t, p) L((x, r))and (x, r) E}, then we can compute directly KG(r) = {p|(t, p) L((x, r)), (x, r) E, and p TG(r)}. In other words, we do not need to apply Algorithm 1 becausewe do not need to propagate the non-essential property throughout the siphon.

    In Fig. 4 we graphically illustrate the way Algorithm 1 works and the meaning ofthe function KG. In the figure we have two minimal siphons Dr, Ds D1. These twosiphons share the transitions t1 and t2 and in order to compute KG(r) we observe thatthe siphon Ds prunes the siphon Dr by the place A3 (used as seed from transition t2)that becomes non-essential for a siphon resulting from the union of the siphons Drand Ds. Observe that the removal of A3 makes the place A2 non-essential so thatit is also incorporated to the KG(r) set. The place A1 is added to the set Ppartial inAlgorithm 1 but finally it is not added to KG(r) because it is essential in the siphonDr Ds because of its output transition connecting it to the place r. In a similar wayKG(s) can be computed obtaining the set {B1, B2}.

    From the previous discussion, the following lemma presents how to obtain asiphon from a pruning graph or subgraph G of a net. We will denote this associatedsiphon as SG.

    Lemma 8 Let N be a S4 PR net and G a pruning subgraph induced on the set ofresources DR = . The set SG = rDR S(r)\KG(r) is a siphon containing DR.

    Proof It is obvious that

    rDR S(r) is a siphon because each S(r) D1 is also asiphon. Moreover, each process place p KG(r) is removed from S(r) because pbecomes non-essential in SG. That is, the application of the algorithm 1 to computeKG(r), makes p non-essential since for all t p : t S(r) = ; or t S(r) = {q} andq KG(r); or there exists, at least, a resource x DR such that x t. Moreover,DR SG because KG(r) Ps and r S(r) for all r DR. unionsq

    In Fig. 5 the Pruning Graph G of the net of Fig. 1 is depicted. This net has fourminimal siphons containing at least 2 resources. In each class Di, 6 i 2, the nethas only one minimal siphon, except for the classD4 that is empty. Each one of these4 minimal siphons can be computed using Lemma 8 from the graphs G, G1, G2, andG4. Observe that a non-minimal siphon will be generated from the graph G3 becauseKG3(S) = .

    In the case of the net in Fig. 2b the reader can construct easily the pruning graphG obtaining a complete graph of three nodes.

    Fig. 4 The place A1 belongingto the minimal siphon Drcontained in the set Ppartialcannot be pruned

    r

    A1

    A2 A3

    B2 B1D

    r

    Ds

    s

    t2

    t1

  • Discrete Event Dyn Syst

    G

    Q

    R

    U

    P

    S

    T

    KG(P) = {j}KG(Q) = {l}KG(R) = {a, f}KG(S) = {h}KG (T) = {c}KG (U) = {b, e}

    KG1 (P) = {j}KG1(Q) = {l}KG1 (S) = {h}KG1(T) = {c}KG1(U) = {b}

    L((S, T)) = {(t 4 , c)}L((P, S)) = {(t 13, h)}L((Q, P)) = {(t 14, j)}

    L((T, S)) = {(t 11, h)}L((T, U)) = {(t 3, b)}L((U, Q)) = {(t 17, l)}

    Q

    U

    P

    S

    TG1

    L((U, R)) = {(t2 , a)}L((R, U)) = {(t7 , e)}L((Q, R)) = {(t8 , f)}L((U, Q)) = {(t 17, l)}

    KG2(R) = {a, f}KG2 (Q) = {l}

    KG2(U) = {e}

    Q

    R

    UG2

    S

    TG3

    L((U, Q)) = {(t 17 , l)}L((U, R)) = {(t 2, a)}L((R, U)) = {(t 7, e)}L((Q, R)) = {(t8, f)}

    L((S, T)) = {(t4 , c)}L((P, S)) = {(t 13 , h)}L((Q, P)) = {(t14, j)}

    L((T, S)) = {(t 11, h)}L((T, U)) = {(t 3, b)}

    KG3 (S) =

    L((S, T)) = {(t 4, c)}L((T, S)) = {(t 11 , h)}

    KG3(T) = {c}

    L((U, R)) = {(t2 , a)}L((R, U)) = {(t7 , e)}KG4(R) = {a}KG4(U) = {e}

    R

    U G4

    0

    Fig. 5 The pruning graph G and the subgraphs G1, G2, G3 and G4 of the Fig. 1

    A final interesting example is presented in the Petri Net of Fig. 6. The corre-sponding Pruning Graph is depicted in Fig. 7, where the reader can observe thatS(R) prunes itself, and this selfloop is necessary to compute the minimal siphonDRS = {R, S, p2, p3, p4, p6} (it allows to obtain KG(R) = {p1} = ).

    The pruning relation defined previously on the set of minimal siphons containingonly one resource place can be generalized in order to consider other sets of siphons.This generalization is done along two different lines: (1) we allow siphons that arenon-minimal; (2) we allow siphons containing more than one resource place. Therelation to be defined on these sets of siphons will be called Extended Pruning Rela-tion. The main difference is related to the non-minimality of the siphons. Therefore,a siphon can prune itself in order to remove non-essential places that make it non-minimal. Nevertheless, taking into account Lemma 2, in the set of siphons we use todefine this new pruning relation there are not two siphons containing the same setof resources. The extended pruning relation will be represented by means of the socalled Extended Pruning Graph defined in the following.

    Definition 6 Let N be a S4 PR net and PR the set of resource places. Let bea set of siphons of N such that there are not two different siphons with the same

  • Discrete Event Dyn Syst

    Fig. 6 A S4 PR net where thenode R prunes itself (the idleplaces are omitted to simplifythe drawing)

    set of resources. The Extended Pruning Graph (EPG) of N is a graph G = (V, E)where,

    1. V = {D PR | D } 2PR ;2. E V V and

    (a) For all vr, vx V, vr = vx, (vr, vx) E iff Ur = vr Trx (Trx Dx Ps) = with Trx = Dr Dx, vr = Dr PR, vx = Dx PR, and Dx, Dr

    .(b) For all vr V, (vr, vr) E iff Ur = vr (Dr Ps) = or p Dr Ps

    such that p Hvr with vr = Dr PR and Dr

    .

    Given a extended pruning graph G = (V, E), we define the pruning subgraph Gof G induced on the set of vertices V V, as the graph G = (V , E (V V )).Associated to a pruning graph or subgraph we define the following three labellingfunctions.

    Definition 7 Let N be a S4 PR net and G = (V, E) an extended pruning graph orsubgraph of N .(a) Resource labelling function. S : V , where for all vr V, S(vr) = Dr

    such that Dr PR = vr.

    Fig. 7 Pruning graph, G, ofFig. 6

    S(R)= {R, p1, p2, p3, p4, p6 }S(S)= {S, p4, p5}

    L((R, S))= {(t7, p5)}L((S, R))={(t2, p1)}L((R, R))= {(t3, p1)}KG(R)= {p1}KG(S)= {p5}

    G

    R S

  • Discrete Event Dyn Syst

    (b) Arc labelling function. L : E 2TPs , where(i) For all (r, x) E, r = x, L((r, x)) = {(t, p)|t r Trx (Trx S(x)

    Ps); Trx = S(r) S(x); {p} = t Ps}.(ii) For all (r, r) E, L((r, r)) = {(t, p) | t r (S(r) Ps); {p} = t Ps}

    {(t, p) | p (S(r) Ps)\Hr; t p}(c) Pruning labelling function. KG : V 2Ps , where for all r V, KG(r) Ps com-

    puted by an algorithm as the Algorithm 1 where now the nodes of the graph aresubsets of places instead of single resources and the functions are those definedhere.

    As a first example of Extended Pruning Graph we consider the siphon v = {r, b , c}of the net in Fig. 2a. Observe that this siphon is the support of the p-semiflow of theresource r, and it is not a minimal siphon. The EPG, when we consider the set ofsiphons

    = {v}, has only one node, named vr = {r}, and only one arc from the nodeto itself. This arc appears because the set Ur in Definition 6.2(b) is non-empty andequal to the transition b . The set of places to be removed in order to make thesiphon minimal is equal to the set KG(vr) = {b}.

    As a second example, in Fig. 8 we have depicted the Extended Pruning Graph forthe set of minimal siphons of the net of Fig. 9 containing at least one resource. Aninteresting characteristic of this net is that there are not resource-transition circuitsas those defined in the paper Xing et al. (2011), therefore an algorithm to computesiphons in S4 PR based on this concept seems to be non viable. In this case there arenot resource-transition circuits because a transition can have input or output resourceplaces but not both.

    6 A new algorithm to compute the minimal siphons of a S4 PR net

    In the previous section we have defined the PG of a S4 PR net that we will use ascentral tool to compute the minimal siphons of the net. The basic idea of the methodis to construct a minimal siphon D of the net,N , by the union of the minimal siphonsof D1 (minimal siphons of N containing only one resource) corresponding to theresources contained in D, and each one is diminished in the pruned places specifiedby the function KG.

    As we have seen (Fig. 2b) the number of minimal siphons of a S4 PR net,containing resources, can be equal to 2|PR| 1 (the number of non-empty subsets ofresources). Nevertheless, the number of minimal siphons, in practice, is much lowerthan this number. This means that we must evaluate many non-productive unions ofminimal siphons of D1. The following result characterizes a minimal siphon in termsof a pruning subgraph of the net induced on the set of resources of the minimalsiphon.

    Theorem 4 LetN be a S4 PR net and G the corresponding pruning graph. D P is aminimal siphon of N containing the set of resources DR = , if and only if,(a) The subgraph G of G, induced on the set DR is strongly connected.(b) For all r DR, KG(r) = .

  • Discrete Event Dyn Syst

    0

    Fig. 8 The pruning graph and the extended pruning graph of the net of Fig. 9

    (c) There is no strongly connected subgraph G of G, induced on DR = , DR DR such that the siphons associated to G, G verify SG SG = D

    Proof

    () If D is a minimal siphon of N containing the set of resources DR = ,then the PG induced on DR, G, is strongly connected. We prove this claim

  • Discrete Event Dyn Syst

    Fig. 9 A S4 PR net without theidle places to simplify thedrawing

    j i h g f

    edcba

    S

    t1 t2 t3 t4 t5 t6

    t7t8t9t10t11t12

    R T

    by contradiction. Let us suppose that G is not strongly connected. Thestrongly connected components (scc) of G are its maximal strongly connectedsubgraphs and we will have more than one. If each scc is contracted toa single vertex, the resulting graph is a directed acyclic graph named thecondensation graph of G. Let DR the set of vertices of a scc of G

    such thatit has no predecessor scc in the condensation graph (there exists at least onebecause the condensation graph is acyclic). The pruning subgraph induced onDR, G

    , is strongly connected and KG(r) = KG(r), for all r DR, becausethere are not arcs from vertices in DR\DR to vertices in DR, and thereforeAlgorithm 1 gives the same results, for all r DR, in the two graphs G andG. By Lemma 8, SG = rDR S(r)\KG(r) is a siphon, and also is SG =

    rDR S(r)\KG(r) = (

    rDR S(r)\KG(r)) (

    rDR\DR S(r)\KG(r)) = SG (rDR\DR S(r)\KG(r)). That is, SG SG contradicting that D is aminimal siphon. Therefore, if D is a minimal siphon, G is strongly connected.Moreover, if D is minimal KG(r) = , for all r DR, since KG(r) = , forsome r DR implies that S(r) D contradicting the minimality of D. Finally,if there exists a strongly connected subgraph G of G induced on the set DR DR such that DR = and SG SG , D cannot be minimal, contradicting thatD is minimal. Therefore, the condition c) of the statement of the theorem is anecessary condition.

    () By Lemma 8, D = rDR S(r)\KG(r) is a siphon and DR D. We will proveby contradiction that D is a minimal siphon. Let us suppose that the three con-ditions of the theorem are satisfied and D is not minimal. If D is not minimal,there exists a minimal siphon D D, and according to the necessary partof this theorem previously proven, there exists a subgraph G of G inducedon DR = D PR DR = that satisfies the three previous conditions (i.e.G is strongly connected and KG(r) = , for all r DR). G will also be asubgraph of G. Now we prove that D = SG , and therefore SG D = SG ,contradicting that the third condition of the theorem was true for D. In effect,by Lemma 5, D rDR S(r). Moreover, by the proof of Lemma 8, KG(r)represents all places that become non-essential in S(r) because of the rest ofplaces of D, therefore D rDR S(r)\KG(r) = SG . By Lemma 8, SG is asiphon containing DR resources, and taking into account that the number ofpruned places by Algorithm 1 is maximal, therefore D = SG . unionsq

    The following is an algorithm to compute the minimal siphons of a S4 PR net basedon the characterization of minimal siphons in terms of pruning graphs presented inTheorem 4.

  • Discrete Event Dyn Syst

    Observe that the algorithm proceeds in two phases. The first one is an strategy tocompute all maximal strongly connected subgraphs of the pruning graph of the net,where all vertices have a pruning labelling function, KG, different from the emptyset (conditions (a) and (b) in Theorem 4). The second phase removes all subgraphscontaining a subgraph satisfying the condition (c) of Theorem 4.

    The following results concern the termination of Algorithm 2 and its complexity.

    Algorithm 2 Computation of the Minimal Siphons of NInput. N = P0 Ps PR, T, C The S4 PR net.

    D1 The minimal siphons with only one resource.Output. D The minimal siphons of N containing at least one resource.1. D := D12. Compute the pruning graph G = (V, E) of N (Definition 4), and the functions

    S, L and KG (Definition 5).3. Compute all maximal strongly connected subgraphs (strongly connected com-

    ponents, scc) of G, and for each scc, G, compute the functions S, L and KGto form the PG G. Add all PGs G with more than one vertex to the set gnew.

    4. ggood := 5. While gnew = do6. Extract G = (V , E) from gnew7. If there exists r V such that KG(r) = then8. Compute A := {r|r V and KG(r) = }9. If there is no a graph in gnew nor in ggood with a set of vertices equal

    to V \ A then10. Compute the pruning subgraph of G induced on V \A, named G.11. Compute all scc of G, and for each scc, G, with more than one node

    and not contained in gnew, compute the functions S, L and KG to formthe PG G and add it to the set gnew.

    12. end if13. else14. Add G to the set ggood15. for each r V do16. If there is no a graph in gnew nor in ggood with a set of vertices equal

    to V \ {r} then17. Compute the pruning subgraph of G induced on V \{r}, G18. Compute all scc of G, and for each scc, G, with more than one node

    and not contained in gnew, compute the functions S, L and KG toform the PG G and add it to the set gnew.

    19. end if20. end for21. end if22. end while23. Remove all graphs from ggood, G = (V, E), for which there exists another

    G = (V , E) in ggood satisfying: (1)V V; and (2)SG SG24. for each graph G = (V , E) ggood25. Add to D the siphon D = rV S(r)\KG(r) = SG26. end for

  • Discrete Event Dyn Syst

    Lemma 9 Algorithm 2 applied to a S4 PR net,N , terminates and computes all minimalsiphons of N containing at least one resource place.

    Proof The algorithm terminates because in each iteration of the first loop starting inline 5, we add to the set gnew maximal strongly connected subgraphs that contain atleast one vertex less than the graph used in the iteration to compute these maximalstrongly connected subgraphs. Moreover, all the added new subgraphs have a setof vertices (resources) that is different to those corresponding to graphs previouslyadded and with at least two resources. This means that the loop will be executed atmost 2|PR| |PR| 1 times, where |PR| is the number of resources places of N .

    The algorithm computes all minimal siphons containing at least one resourcebecause D1 is added to the final set at the beginning of the algorithm. The first loopcomputes all maximal strongly connected subgraphs where all vertices have a non-empty KG function. The final task in step 23 removes from this set all graphs thatcontain at least one of these graphs with the same properties. Therefore, the set ggoodwill contain only those pruning graphs characterizing minimal siphons as stated byTheorem 4 with at least 2 resources. That is, the final set D will contain all minimalsiphons of N . unionsq

    Finally, the following result formalize the worst-case time complexity of Algo-rithm 2 that is dominated by the square of the number of minimal siphons containingat least two resources.

    Lemma 10 Algorithm 2 can f ind all minimal siphons of a S4 PR net with a worst-case time complexity O(B2( |PR|+12 ) + B(|PR|2 + |PR| |PS| 12 )) where B = 2|PR| |PR| 1.

    Proof The worst-case time complexity of Algorithm 2 corresponds to the case inwhich we have a number of minimal siphons equal to the upper bound of Lemma 4,i.e. |D| = 2|PR| 1 at the end of Algorithm 2. Taking into account that all minimalsiphons containing exactly one resource are directly added to the set D at thebeginning of the algorithm (because they are input data), the computation only mustfind B = 2|PR| |PR| 1 minimal siphons: those containing more than one resource.The main loop of the algorithm starting in line 5 will be executed exactly B times,because the set gnew ggood cannot contain two graphs with the same set of resourcesand all of them must contain more than one resource. To ensure this last property,in each iteration we need to make a number of comparisons between sets of verticesof the new graphs with the sets of vertices of the graphs stored in gnew ggood thatis bounded by O(|PR| B2 ). Additionally, for each one of the B minimal siphonswe must compute the pruning subgraph from the given pruning graph of N with acomplexity of O(|PR| |PS|); and compute the set of strongly connected components.For each graph with V vertices, this can be accomplished in time O(V2). In our caseit can be bounded by O(|PR|2) and therefore for the B minimal siphons we require anumber of operations of these classes in time O(B(|PR| |PS| + |PR|2)). Finally, thelast task of the algorithm requires to detect non-minimal siphons by comparison ofpairs of siphons obtained after the main loop. These comparisons must be done onthe set ggood that contains B minimal siphons, therefore this task can be done in time

  • Discrete Event Dyn Syst

    O( B(B1)2 ). Combining the three previous expressions we obtain the expression ofthe statement. unionsq

    We must say that is possible to derive many variants of this algorithm. A firstgroup is originated depending on the place where the comparison between graphsto eliminate the non-minimal ones is situated. In the algorithm we have presentedthis at the end of phase one, but this can also be done in step 14 when a new graph,fulfilling conditions a) and b) of Theorem 4, is stored in ggood. At this moment, we cancompare the new graph with the previously added and remove those that contain thenew. Other variants depend on the data structures used to implement some objectsof the algorithm. For example, we can use a tree to implement ggood, instead of a set.This makes easier the comparison avoiding a great number of tests.

    Applying Algorithm 2 to the Pruning Graph shown in Fig. 5 the four min-imal siphons of the net in Fig. 1 are obtained as follows: D = {R, U, b , f, m}from the subgraph G4, D = {Q, R, U, b , g, k, m} from the subgraph G2, D ={P, Q, S, T, U, d, e, g, i, k, m} from the subgraph G1 and finally, D = {P, Q, R,S, T, U, d, g, i, k, m} from the pruning graph G. Observe, that the graph G3 does notpass the phase 1 because KG3(S) = . In the same way, the three minimal siphonsfor the net in Fig. 9 are computed by means of the pruning graph shown in Fig. 8as follows: D = {R, S, b , c, d, e, i, j} from G1, D = {S, T, d, e, g, h, i, j} from G2 andD = {R, S, T, d, e, i, j} from G.

    7 Conclusions

    The computation of minimal siphons in the context of Resource Allocation Systemsmodeled with S4 PR nets currently plays a central role. We propose a new method tocompute these minimal siphons based on the use of higher level objects than thoseused in previously known algorithms: the set of minimal siphons of the net with onlyone resource. The computation of a minimal siphon containing the set of resourcesDR requires the union of the minimal siphons corresponding to each resource ofDR. Each one of these minimal siphons, used as operands, must be diminished by apruning set of process places that can be computed from a binary pruning relationdefined on the set of minimal siphons with only one resource. This pruning relationis represented by a graph that is used to compute the minimal siphons by means ofmaximal strongly connected subgraphs.

    The usage of these high level objects for the computation of all minimal siphonsmakes our algorithm very different to the previous algorithms that work directlyon places and transitions. That is, a theoretical comparison between algorithmsis difficult because the strategies of computation are very different. For example,specialized algorithms developed for the strict S3 PR subclass cannot be extended toS4 PR because they use particular concepts that do not work in S4 PR. Nevertheless,our experience with some large examples modelling wormhole routing algorithmsin multicomputer interconnection networks (Rovetto et al. 2010) is very positive.Many of the existing tools are not able to compute the minimal siphons because thegreat amount of memory needed, and in other cases the amount of required time isenormous (of the order of days). Our algorithm finishes in some minutes and with

  • Discrete Event Dyn Syst

    an insignificant need of memory. Nevertheless, much more work must be done inorder to find an optimal implementation with a good selection of data structures andheuristics to reduce the number of comparisons.

    Acknowledgements This work has been partially supported by Technological University ofPanama and Secretara Nacional de Ciencia, Tecnologa e Innovacin, SENACYT, Panama. Also,this work has been partially supported by the European Communitys Seventh Framework Pro-gramme under project DISC (Grant Agreement n. INFSO-ICT-224498) and the project CICYT-FEDER DPI2006-15390. The authors are indebted to three anonymous referees, whose commentshelped to improve previous versions of this paper. Also, the authors extend gratitude to MarcelaParedes de Vsquez, Myriam Gonzalez, Luis Barahona, Martin Candanedo, Ral Barahona, CliftonClunie, Lydia Toppin and Delva Batista for valuable support during the research process ofthis work.

    References

    Barkaoui K, Lemaire B (1989) An effective characterization of minimal deadlocks and traps in Petrinets based on graph theory. In: Proceedings of the 10th international conference on theory andapplication of Petri nets, Bonn, pp 122

    Chao D (2009) Direct minimal empty siphon computation using MIP. Int J Adv Manuf Technol45:397405

    Chu F, Xie XL (1997) Deadlock analysis of Petri nets using siphons and mathematical programming.IEEE Trans Robot Autom 13(6):793804

    Colom JM (2003) The resource allocation problem in flexible manufacturing systems. In: van derAalst W, Best E (eds) Proceedings of the 24th international conference on applications andtheory of Petri nets. Lecture notes in computer science, vol 2679. Springer, Eindhoven, pp 2335

    Colom JM, Silva M (1991) Convex geometry and semiflows in P/T nets. A comparative study ofalgorithms for computation of minimal p-semiflows. In: Rozenberg G (ed) Advances in Petrinets 1990. Lecture notes in computer science, vol 483. Springer, Berlin, pp 79112

    Cordone R, Ferrarini L, Piroddi L (2005) Enumeration algorithms for minimal siphons in petri netsbased on place constraints. IEEE Trans Syst Man Cybern, Part A Syst Humans 35(6):844854

    Ezpeleta J, Couvreur JM, Silva M (1993) A new technique for finding a generating family of siphons,traps and ST-components. Application to colored Petri nets. In: Advances in Petri nets. Lecturenotes in computer science, vol 674. Springer, New York, pp 126147

    Ezpeleta J, Colom JM, Martnez J (1995) A Petri net based deadlock prevention policy for flexiblemanufacturing systems. IEEE Trans Robot Autom 11(2):173184

    Ezpeleta J, Garca-Valls F, Colom J (1998) A class of well structured petri nets for flexible manu-facturing systems. In: Desel J, Silva M (eds) Application and theory of Petri nets 1998. Lecturenotes in computer science, vol 1420. Springer, Berlin, pp 6483

    Lautenbach K (1987) Linear algebraic calculation of deadlocks and traps. In: Voss K, Genrich HJ,Rozenberg G (eds) Concurrency and nets. Springer, New York, pp 315336

    Li ZW, Zhou MC (2008) On siphon computation for deadlock control in a class of Petri nets. IEEETrans Syst Man Cybern Part A Syst Humans 38(3):667679

    Li Z, Zhou MC (2009) Deadlock resolution in automated manufacturing systems: a novel Petri netapproach. In: Advances in industrial control. Springer, New York

    Li Z, Zhou MC, Jeng M (2008) A maximally permissive deadlock prevention policy for FMS basedon Petri net siphon control and the theory of regions. IEEE Trans Autom Sci Eng 5(1):182188

    Lopez-Grao JP, Colom JM (2010) The resource allocation problem in software applications: aPetri net perspective. In: Proceedings of the international workshop on Petri nets and softwareengineering PNSE10, Braga, Portugal, pp 721

    Murata T (1989) Petri nets: properties, analysis and applications. Proc IEEE 77(4):541580Reveliotis S (2003) On the siphon-based characterization of liveness in sequential resource allocation

    systems. In: van der Aalst W, Best E (eds) Applications and theory of Petri nets 2003. Lecturenotes in computer science, vol 2679. Springer, Berlin, pp 241255

    Reveliotis SA (2005) Real-time management of resource allocation systems. A discrete event systemsapproach. Springer, New York

  • Discrete Event Dyn Syst

    Rovetto CA, Cano EE, Colom JM (2010) Deadlock analysis in minimal adaptive routing algorithmsusing petri nets. In: IEEE international conference on systems man and cybernetics (SMC), 2010,Istanbul, Turkey, pp 26192626

    Tricas F (2003) Analysis, prevention and avoidance of deadlocks in sequential resource allocationsystems. PhD thesis, Zaragoza. Espaa, Departamento de Ingeniera Elctrica e Informtica,Universidad de Zaragoza

    Tricas F, Garca-Valls F, Colom JM, Ezpeleta J (2005) A Petri net structure-based deadlockprevention solution for sequential resource allocation systems. In: Proceedings of the 2005 IEEEinternational conference on robotics and automation, Barcelona, Spain, pp 272278

    Wang AR, Li ZW, Jia JY, Zhou MC (2009a) An effective algorithm to find elementary siphons in aclass of Petri nets. IEEE Trans Syst Man Cybern Part A Syst Humans 39(4):912923

    Wang Y, Liao H, Reveliotis S, Kelly T, Mahlke S, Lafortune S (2009b) Gadara nets: modeling andanalyzing lock allocation for deadlock avoidance in multithreaded software. In: Proceedings ofthe 48th IEEE conference on decision and control, 2009 held jointly with the 2009 28th Chinesecontrol conference. CDC/CCC 2009, pp 4974976

    Williams HP (1986) Fouriers method of linear programming and its dual. Am Math Mon 93(9):681695

    Xing K, Zhou MC, Wang F, Liu H, Tian F (2011) Resource-transition circuits and siphons fordeadlock control of automated manufacturing systems. IEEE Trans Syst Man Cybern Part ASyst Humans 41(1):7484

    Elia Esther Cano received the M.S. and Ph.D. degrees in computer science engineering from theUniversity of Zaragoza, Spain, in 2007 and 2011, respectively. In 1996, she joined the ComputerSystems Engineering Department, Technological University of Panama, Panama, where she iscurrently professor. Her research is devoted to the modeling and analysis of concurrent systemsusing Petri Nets.

  • Discrete Event Dyn Syst

    Carlos A. Rovetto received the M.S. and Ph.D. degrees in computer science engineering from theUniversity of Zaragoza, Spain, in 2007 and 2011, respectively. He is professor in the Departmentof the Computer Systems Engineering of the Technological University of Panama since 2002 andlead research projects. His main research interests include control and scheduling of manufacturingsystems and discrete-event systems, interconnections networks for multiprocessors using Petri Nets.

    Jos-Manuel Colom received the Ph.D. degree in industrial-electrical engineering from the Uni-versity of Zaragoza, Zaragoza, Spain, in 1989. He is currently a professor in the Department ofComputer Science and Systems Engineering, University of Zaragoza. He has co-authored over 100research papers in technical journals and conferences. His research interests include modelling,qualitative, and performance analysis, and implementation of discrete event systems using Petrinets. Dr. Colom has served on the technical committees of several international conferences in thefield of formal methods and concurrent systems. He organized, as a conference co-chair, severalinternational conferences in the field of Petri nets and discrete event systems.

    An algorithm to compute the minimal siphons in bold0mu mumu SSunitsSSSSbold0mu mumu 44units4444bold0mu mumu PRPRunitsPRPRPRPR netsAbstractIntroductionPetri nets: basic definitionsThe subclass of S4PR netsProperties of the siphons of S4PR netsThe binary pruning relation on the set of minimal siphons with only one resourceA new algorithm to compute the minimal siphons of a S4PR netConclusionsReferences