A solution to the covering problem for 1-bounded conflict-free Petri nets using Linear Programming

A solution to the covering problem for 1-bounded conflict-free Petri nets using Linear Programming

Information Processing North-Holland Letters 17 April 1992 41 (1992) 313-319 A solution to the covering problem for l-bounded conflict-free Petri ...

605KB Sizes 0 Downloads 22 Views

Information Processing North-Holland

Letters

17 April 1992

41 (1992) 313-319

A solution to the covering problem for l-bounded conflict-free Petri nets using Linear Programming * Javier Esparza Institut fiir Informatik, Universitiit Hildesheim, Samelsonplatz I, W-3200 Hildesheim, Germany Communicated by T. Lengauer Received 21 August 1991 Revised 30 December 1991

Abstract Esparza, .I., A solution to the covering problem Information Processing Letters 41 (1992) 313-319.

for

l-bounded

conflict-free

Petri

nets

using

Linear

Programming,

Given a marking F of a Petri net, the covering problem consists of determining if there exists a reachable marking IL’ 2 p. We show that the covering problem for l-bounded conflict-free Petri nets is polynomially reducible to a Linear Programming problem. This proves that the covering problem is in PTIME for this class of Petri nets, which generalises a result of Yen. Keywords: Concurrency,

conflict-free

Petri nets, Linear

1. Introduction Conflict-free Petri nets have been extensively studied from a computational point of view. Some interesting problems have been proved to be tractable. In particular, Howell and Rosier showed in [l] that the reachability problem for bounded conflict-free Petri nets is in PTIME (whereas, if the restriction to bounded nets is removed, the problem is NP-complete). In [61, Yen gave a polynomial time algorithm to determine if two transitions in a l-bounded conflictfree Petri net can become simultaneously enabled (called in [61 the concurrency problem), a probCorrespondence to: Dr. J. Esparza, Institut fiir Informatik, Universitat Hildesheim, Samelsonplatz 1, W-3200 Hildesheim, Germany. Email: [email protected]. * This work was partially supported by the Esprit Basic Research Action 3148 DEMON. 0020-0190/92/$05.00

0 1992 - Elsevier

Science

Publishers

Programming

lem with applications to the verification of selftimed circuits [5]. In this paper, we show that the covering problem for l-bounded conflict-free Petri nets is polynomially reducible to a Linear Programming problem. Since Linear Programming is known to be in PTIME, it follows that this problem is in PTIME as well. Both the concurrency problem and the reachability problem in the l-bounded case are particular instances of the covering problem. Given a marking p of a Petri net, the covering problem consists of determining if there exists a reachable marking p’ 2 EL.The concurrency problem for any set of transitions U (i.e. the problem of determining if all the transitions in U can become simultaneously enabled) can be reduced to the covering problem by taking p(p) = 1 iff p is an input place of some transition in U. We are

B.V. All rights reserved

313

Volume

41, Number 6

INFORMATION

PROCESSING

also able to compute the smallest reachable marking p’ 2 p; this solves the reachability problem because p’ = p if and only if p is reachable. The reduction makes use of a result of [6], and of a characterisation of the Parikh vectors corresponding to the computations of l-bounded conflict-free Petri nets. This characterisation can be used as a basis for the solution of other problems by means of Linear Programming.

2. Definitions As in [6], a Petri net is a 4-tuple (P, T, 4, po), where P is a finite set of places, T is a finite set of transitions, $J is a j7ow function

and pLg is the initial marking, t+, : P + N. Markings, firing of transitions, firing sequences-also called here computations-and reachable markings are defined as usual. Given a place p, we denote

and

l p={tETlqfr(t,p)=l}. Let 9 = (P, T, 4, po) be a Petri net with P = {P 1,. . . ,pJ and T = it,,. . ., t,). 9 is a marked graph iff for every p E P, I‘p I G 1 and I p* I G 1. 9 is confhct-free iff for every place p E P either (1) I P* I G 1, or (2) Vt Ep*: t E-p. Given p E P, we denote T,’ =‘p\p’ and T,=p’\‘p. T,’ (T;) is the set of transitions whose occurrence increases (decreases) the marking of p. Notice that if a net is conflict-free then for every place p: I T; I G 1. The n x m matrix C given by C(i, j) = +(ti, pj) - 4(pj, ti> is the incidence matrix of 9. A nonnegative integer vector of dimension IT I is called a Parikh vector. Given a firing sequence u, #, : T + N is the mapping defined by #, (t> = number of occurrences of t in (T. The representation of this mapping in vector form, according to 314

LETTERS

17 April 1992

the total order t, < t2 < . . . < tm, is the Parikh vector associated to u. A Parikh vector X is executable iff X= #, for some computation u. We denote by S(X) the set of transitions with positive components in X, i.e. S(X) = It E T I X(t) > 0).

3. Characterisation

of executable

Par&h vectors

We assume within this paper, unless otherwise stated, that 9= (P, T, 4, po) is a l-bounded conflict-free Petri net in which every transition occurs in some computation. Transitions occurring in no computation can be removed in polynomial time without changing the behaviour of the net, as the next lemma shows. Therefore, we can transform an arbitrary l-bounded conflict-free Petri net into an equivalent one satisfying the assumption in polynomial time. Lemma 3.1 [2]. Given a conflict-free Petri net 9 = (P, T, 4, uO), we can construct in polynomial time a computation r enabled in u0 in which no transition in r is used more than once, such that if some transition t is not used in r, then there is no computation (emanating from u,,) in which t is used. IJ In the sequel, the symbol r is reserved for this particular computation. Notice that, in the nets satisfying our assumption, #, (t) = 1 for every transition t. There exists a simple characterisation of the set of executable Parikh vectors for the class of marked graphs, when every transition is known to occur in some computation [4]. Namely, X is executable iff /_&cLo+c~x>o,

(1)

where C is the incidence matrix of the marked graph. This is no longer true for l-bounded conflict-free systems. The Petri net of Fig. 1 is an example: X= (0, 1, 1) satisfies (11, but it corresponds to no computation. This is due to the fact that (1) does not impose any constraint on the

Volume

41, Number

6

INFORMATION

PROCESSING

LETTERS

17 April 1992

Lemma 3.4. Let p be a place. (1) If t E T,’ and u E ?p np’), then (t, u) E 5z. (2) Zf t,u E T; and there exists a computation o1 t with #,,Ju> = 0, then (t, u) E SF.

Fig. 1. A l-bounded

conflict-free

system.

order in which transitions have to occur, and in this case t, must occur before t, or t,. We show in this section that by adding some information about the causal relationships between transitions these solutions corresponding to no computation can be eliminated. We recall, first, a fundamental lemma. Given two vectors X=(X~,...,X,) and Y= 1,. . . , y,) of integers, define (Y max(X,

Y) = (max(.,,

Y,)).

Y1),...,max(x,,

Lemma 3.2 [3]. Let ul, u2 be computations of 9. There is a computation (+ such that #, = max(#,l,

Proof. (1) Since u E (‘I, np’) and the net is conflict-free, T; = @. Hence, the marking of p cannot decrease along a computation. Then Tl = {t}, because otherwise the computation T contains at least two occurrences of transitions in T,' , against the 1-boundedness of 9. Moreover, since T contains t, pO(p) = 0. Let uu be a computation. Since u is enabled after the occurrence of u, and p,&p) = 0, t must occur in ff. So (t, u) E 87. (2) Let uzu be a computation and pO 2 F. By Lemma 3.2, there exists a computation u such that

p(p) > 1, against the 1-boundedness of 9. Consider two cases: Case 1: T; = @. Then p(p) > 1 because u contains at least one occurrence of t and one of U.

Case 2: T; f #. Then, by the property, T; = {VI. We have:

%,).

u2 Moreover, if p0 3 pl, p0 + pz and pu, 2 p, then p is reachable from p, and from p2. 0

1 a/-%(p)

&cLO(P) + #,,N

l>P2(P)

&P”(P)

In fact, this lemma is proved in [31 for all persistent Petri nets, of which conflict-free nets are a subclass.

4

Definition 3.3. Let 9 = (P, T, 4, pO> be a Petri net. The causal relation G?c TX T is defined by:

and (4)

UU: #,(t)

In words, in every computation precedes U.

> 0.

containing

It is easy to see that, as would be expected, causal relation is a partial order.

U, t

maxI#$,

P(P)

PO(P)

+

#,,tW

#,,,

-??&G% +

max{%&+ (211,

- +%,t(&

+#,,uW

(v>l

=

(2) (3)

#,,uW

#,,uW}. #,,,

2 +&U(u) + 1.

If max{#,,, (v), #,,,(vN and (4) 4P)

the

a

If

(t, u) E SF- V computations

P>

conflict-free

(4) (VI,

we

get from (2)

(5) = #,,, (cl, we get from (3)

2 #,,t(t> + 1.

Since #,,,(u) 2 1 and #,,,(t) cases E*(p) > 1. 0

(6) a 1, we have in both

315

Volume 41, Number 6

INFORMATION

PROCESSING

We can now formulate and prove our characterisation of the executable Parikh vectors. Consider a Parikh vector X and (t, U) E Z?. If X is executable and X(U) > 0, then, since every computation containing u contains also t, we have X(t) > 0. This gives a necessary condition for a Parikh vector to be executable, which turns out to be sufficient as well. Moreover, it is not necessary to verify this condition for every pair of transitions in %‘; it suffices to do it for the pairs (t, u) where both t and u are input transitions of the same place. Theorem 3.5. A Parikh vector X is executable (1) pa+C.XzO and (2) vp E P, Wt, u) E 5Ff-l CT_,+x-p): (X(t) -X(u) = 0).

iff = 0

Proof. ( - > (1) is well known. (2) follows from the

definition of the causal relation. ( =) We show that if X is not executable and (1) holds, then (2) does not hold. Let X’ O. Follows from p’+C.Y= p.,+c.x>o. (b) No transition in S(Y) is enabled at p’. Follows from the maximality of X’. By (b), every transition in S(Y) has at least one unmarked input place at p’. Denote by Q the set of these unmarked places. Then: (c) Every place in Q has at least one input transition in S(Y). By the definition of Q, every place p E Q has at least one output transition in S(Y). Assume p has no input transition in S(Y ). Then, since p’(p) = 0, we have (p’ + C. Y) < 0, contradicting (a). We construct a preorder -Q on Q U S(Y) in the following way: x ax’ iff there exists a path (x,. . . , x’) in 9 containing only elements of Q U S(Y). Since Q u S(Y) is finite, there exists at least one minimal element x0 of
class of (P,,

17 April 1992

LETTERS

x0 induced

a n

by

D,

and

N, =

T,, ~$1 the subnet givenby:

T,=TnX,,

-

P,=PnX,,

-

~o=~n(P,xTouToxPo).

Notice that, by definition of -4, N, is strongly connected. We have: (d) P, # fl and T, # fl. Follows easily from (b), (c) and the minimality of xc. (e) P,’ c’PO (PO is a trap). In conflict-free nets, this is true of the set of places of any strongly connected subnet. Since N, is strongly connected, (e) holds. = 0 and Cp,p,~o(~) = 0. (f) c ptPop’(~) c p E pa/-d a> = 0 foil ows from PO c Q and the definition of Q as set of unmarked places at p’. BY (e), for every pl, E.L~: c /-%(P) =OA/-% i PEP,

b2

-

Pz_~l(

P> = 0.

i

(if a trap becomes marked, it remains marked). Taking p, =pO and p2 = p’, the second part of (f) follows. (g) (‘P, \ P,‘) n S(Y) = f3. Let t E-P0 \ P,‘. Then there exists p E t’ n P,. Assume t E S(Y) as well. We derive a contradiction: Since ,?E S(Y), we have tap. Then t E X0 by the minimal&y of p w.r.t. 4. By (b), there exists a place p’ ant n Q. By de?%tion of Q, p’~ t. This implies p’ E Pa, against our hypothesis t E l P0 \ P,‘. Consider the computation T. By (f), the places of P, are initially unmarked. Hence, no transition of PO’ can occur in r before some transition %\P,’ has occurred. So a transition t E ‘P,\P,’ appears in r before any transition of P,‘. By (g), t G S(Y). Since N, is strongly connected, there exists u E To such that t’ n U*# @. Since t occurs before u in 7, we have (t, u> E ‘i? by Lemma 3.4. We show that X(U) > 0 and X(t) = 0, which implies that (2) does not hold. - X(U) > 0: Since u E T, and T, c S(Y) by definition of T,, we have u E S(Y). SO Y(U) > 0. Since Y=X-X’, X(u) > 0.

LETTERS

17 April 1992

X(t) = 0. Assume X(t) > 0. Since t P S(Y), Y(t) = 0. Therefore, since Y =X -X’, X’ > 0 follows. Since t E’P~, some marking p, is reached along the execution of X’ such that c pEPO&~) > 0. BY (e), this implies C,,,~,&P) > 0. This contradicts (f). So X(t) = 0. 0

Corollary 4.2. computations

Zf p0 4 p is one of the shortest leading to p, then #, <

4. The covering problem is reducible

+%= i

Volume

41, Number 6

INFORMATION

PROCESSING

_

we have

Programming

to a Linear

(T into (T~(T~.. . a, as in Lemma

4.1. Then:

i=l

(8)

%,

k

to the system (1) in Theorem 3.5 which guarantee that the solutions of the augmented system are exactly the executable Parikh vectors. This requires to express condition (2) as an inequation. However, it is easy to see that this inequation cannot be linear, which forbids the use of Linear Programming. Fortunately, things change if we are interested only in the executable Parikh veck) for some number k. Then, tors X<(k,..., condition (2) can be expressed as: 2X(u)

ITI).

Proof. Rearrange

problem

We would like to add additional inequations

k.X(t)

(ITI,...,

(7)

which is linear. We show that for every reachable marking there exists an executable Parikh vector X leading to it such that X<(lTI,...,ITI>. This result derives from Lemma 3.2 of [61, which will allow us to make use of (7) to reduce the covering problem to a Linear Programming problem. We have to reformulate this lemma to adapt them to our context. Lemma 4.1 161. Zf p0 5 p is one of the shortest computations leading to p, then (T can be rearranged into a,~, . . . a, such that

(2) Vl
This result is proved in [6] for computations enabling two particular transitions u and u, but this assumption is not used in the proof. We have now the following:

<

c

(l,...,l)

(by Lemma 4.1(2))

(9)

(by Lemma 4.1(4)).

(10)

i=l

l T I)

ITI,...,

G(

0 Theorem 4.3. Let p be a marking of 9, and Z(p) be the following system of linear inequalities:

/L()+c*x>p, X,<(

ITI,...,

vp EP,

ITI),

V(t, u) E5FC-I (T;

ITl.X(t)

x-p):

>,X(u).

There exists a reachable marking I_L’2 F iff Z(F) has an integer solution. Proof. Use Theorem 3.5, Corollary 4.2 and the observation leading to equation (7). cl

Deciding if a system of linear inequalities has an integer solution is known to be NP-complete. Hence, even if we can write Z(p) in polynomial time (which will be shown later), Theorem 4.3 does not directly provide a polynomial algorithm. Fortunately, we can do better. Given a real number x, 1x1 denotes the smallest integer greater than or equal to x and lx] the largest integer less than or equal to x. Theorem 4.4. Let LP(pL) be the following Linear Programming problem : maximise

tFTX( t)

subject to

Z(p) 317

Volume

41, Number

6

INFORMATION

PROCESSING

There exists a reachable marking u’ > u iff LP(u) has an optimal solution X that for any other so1~0~‘~X~ , so1ution C,,.Xt) such =G c f E rXop(t )). Moreover, XOp is an executable Parikh vector leading to u’.

Proof. Since the solutions of LP(u) are bounded by ( I T I,. . . , I T I>, LP(u) has an optimal solution iff it has a solution at all. By Theorem 4.3, all we have to do is prove that the optimal solutions of LP(u) are integer. Given a vector X= (x,, . . .,x,), define [Xl =

Ux,l,. ..,Tx,l). optimal solution. Assume XOp is a noninteger We show that [X0,1 is solution of LP(u), against the optimality of X0,: (1) (I.L~+ C. [X0,1) 2 u. Let p be a place. By the conflict-free property, I T; I G 1. Taking into account that (I.L,, + C -X,,)(p) a P(P) and p(p) is integer, some elementary arithmetic leads to:

l T I). Follows from X0,, (2) D&,,ldlTl,..., <(ITI,..., ITI). (3) Wt, U> E E’n (T,f x-p): I T I . TX(t)1 a [X(u)]. Follows from the corresponding property for XOp. 0 Solving LP(u) takes polynomial time in the size of the system of inequalities. We prove now that writing LP(u) takes polynomial time in the size of the net, which implies that the covering problem is polynomial in the size of the net. By inspection of LP(u), it is easy to see that the only problem consists of finding for each place p the pairs (t, u) E CT? n (Tz X Tl).

Proposition 4.5. Let p be a place. ‘$7n (Tl can be computed in polynomial time. Proof. If I T,’ I = 1, we are done. Assume > 1 and let (t, u) E CT,’ x T;). By our

X T,‘)

I T,’ I initial assumption, every transrtron occurs in some computation. Therefore, the sequence r contains all transitions. In particular, it contains t and u. By 318

LETTERS

17 April 1992

Lemma 3.4(2), if t appears before u in r, then (t, u) E Z?‘;otherwise, (u, t) E i??. Therefore, once the sequence r is known, we can easily compute % n (T,f x Tz). Since 7 can be computed in polynomial time by Lemma 3.1, 5??n (Ti X Tz) can be computed in polynomial time. 0 Howell and Rosier gave in [l] a polynomial time algorithm to solve the reachability problem for bounded conflict-free Petri nets. We show now that the problem LP(u) can also be used to decide the reachability of p, albeit only in the l-bounded case. The advantage of the derived algorithm is that it is easy to implement once a Linear Programming tool is available, and joins the already large set of Linear Programming algorithms for the verification of properties in Petri nets.

Theorem 4.6. p is reachable iff LP(u) has optimal solutions and every optimal solution XOp satisfies u = uO + C ’ X0,. Moreover, XOp is an executable Parikh vector leading to I_L. Proof. (3)

Since p is reachable, there exists an executable Parikh vector X, leading to I-L. By Theorem 4.4, X, is solution of LP(u). Since the basic solutions of LP(u) are bounded by l T I), the problem has optimal solu(IT\,..., tions. Let XOp be an optimal solution, and let pOp = pa+ C.XO,. By the definition of LP(u), we have @opap. We show that p = pop, which proves the result. Then, by By Theorem 4.4, XOp is executable. Lemma 3.2, Y = max{XOp, X,} is also executable. Claim. Y = XOp. Proof of the claim. Since Y >-XOp and X0, is optimal, it suffices to show that Y is a basic solution of LP(u). It is easy to see from its definition that Y satisfies the second and third constraints of LP(u). It remains to prove pO + C.Yap. Let p E P. Consider two cases:

Volume

41, Number

(1) pL(p) /.&*o + c Y> (2) p(p) have p,,(p)

INFORMATION

6

PROCESSING

= 0. Since Y is executable, we have 0. so (/Jo + C . Y>(p) > /&). = 1. Then, since p = pop, we also = 1. Moreover:

(/% + C-Y)(p) =cL(p)

+

c

Y(t)

-

=hW

+

-

C

c

Y(t)

f E 7;;

f t .rn+

E+

ma+C,W~

max’;X,,(t),

~,<4}

LETTERS

17 April 1992

reducible to a Linear Programming problem. As a consequence, it is in PTIME. The concurrency of an arbitrary set of transitions (a generalisation of the problem considered in [6]) and the reachability of a marking in the l-bounded case can be decided solving particular instances of this problem. In order to obtain the reducibility result, we have proved a characterisation of the set of executable Parikh vectors, generalising known results for marked graphs (see [4] for a survey). A lemma of [6] was also very useful.

x,(t)}.

I E T,-

If T,-=& th en (p,, + C. Y)(p) a pop(P) and (pO + C. Y)(p) 2 p(p), and we are done. If T; = (u}, then we have: (/-%+C.Y)(P) ifmax(X,,(u), (kl+c.Y)(P)

if max{X,,(u),

%0,(P) X,(u)}

=X&u),

X,(u)}

=X,(u). = 1.

By Lemma 3.2, pcLopis reachable from p and, since Xur, is solution of LP(pcL),we have ~~~ > ,u. #p, then the Petri net is not l-bounded If PcLol, (even not bounded), against our hypothesis. So =. ““<-‘;

I am very indebted to two anonymous referees for pointing out several mistakes in an earlier version of this paper and for very helpful suggestions.

>-F(P)

In all cases, (pO + C. Y)(p)

p

Acknowledgment

Use Theorem

4.4.

0

5. Conclusions We have shown that the covering problem for l-bounded conflict-free Petri nets is polynomially

References [I] R. Howell and L. Rosier, On questions of fairness and temporal logic for conflict-free Petri nets, in: G. Rozenberg, ed., Advances in Petri Nets 1988, Lecture Notes in Computer Science 340 (Springer, Berlin, 1988) 200-226. [2] R. Howell, L. Rosier and H. Yen, An O(n’.‘) algorithm to decide boundedness for conflict-free vector replacement systems, Inform. Process. Lett. 25 (1987) 27-33. [3] L. Landweber and E. Robertson, Properties of conflict-free and persistent Petri nets. J. ACM 25 (3) (1978) 352-364. [4] T. Murata, Petri nets: Properties, analysis and applications, Proc. IEEE 77 (4) (1989) 541-580. [5] M. Tiusanen, Some unsolved problems in modeling selftimed circuits using Petri nets, EATCS Bulletin 36 (1988) 152-160. [6] H. Yen, A polynomial time algorithm to decide pairwise concurrency of transitions for l-bounded conflict-free Petri nets, Inform. Process. Left. 38 (1991) 71-76.

319