BW Analysis: a Backward Reachability Analysis

B-W Analysis: a Backward Reachability Analysis
for Diagnostic Problem Solving
Suitable to Parallel Implementation
Cosimo Anglano, Luigi Portinale
Dipartimento di Informatica - Universita' di Torino
C.so Svizzera 185 - 10149 Torino (Italy)
e-mail: fmino,[email protected]
Abstract. Backward reachability on Petri net models has been proposed
since the beginning of the development of net theory without giving it a
suitable motivation. For this reason, reachability analysis has been successively developed essentially by taking into account forward reachability. In
this paper backward reachability analysis is motivated by showing its suitability to diagnostic problem solving. A particular technique for backward
reachability analysis (B-W analysis) is dened for a net model called Behavioral Petri Net (BPN), intended to model the behavior of a system to
be diagnosed. Such a technique is based on the use of two dierent types of
tokens (normal and inhibitor tokens) whose aim is to represent the truth or
falsity of the condition associated to a marked place. A distributed approach
for parallel B-W analysis is also proposed. Such an approach is based on a
set of processes derived from the structure of a BPN by means of a formal
partitioning technique; this allows us to address the problem of mitigating
the high ineciency diagnostic algorithms usually have.
1 Introduction
Backward reachability on Petri net models has been proposed since the beginning
of the development of net theory (e.g. in the Condition/Event systems [1]) without giving it a suitable motivation. For this reason, reachability analysis has been
successively developed essentially by taking into account forward reachability. However, progresses in elds like Articial Intelligence (AI) showed that a lot of dierent
practical tasks require inference to be performed in backward fashion [13].
One of the most important task requiring backward reasoning is certainly represented by diagnostic problem solving. In this paper, we aim at discussing a particular
technique for backward reachability analysis on a Petri net model, called B-W Analysis, that can be actually applied to diagnostic reasoning. This technique relies on
a net model called BPN (Behavioral Petri Net) whose aim is to model the behavior
of a system to be diagnosed. Formal aspects of B-W Analysis are introduced and its
applicability to diagnostic problem solving is shown. The method exploits two different types of tokens (i.e. normal and inhibitor tokens) aimed at modeling the truth
or falsity of the condition associated to the marked place. This allows us to point
out inconsistencies when looking for the possible \explanation" of a given marking
in a BPN.
One of the peculiarities of B-W analysis is its suitability to parallel implementations. In this paper we present a distributed approach for parallel B-W analysis,
in which a set of processes is derived starting from the structure of a BPN. Given a
BPN, its transitions are partitioned into independent subsets, from which both processes and interactions among them are derived. A simplication technique, whose
purpose is that of producing a deadlock-free concurrent program, is also presented.
The above technique exploits the information provided by the the marking from
which the analysis starts.
The paper is organized as follows: in section 2, basic notions about Petri nets are
reviewed; in section 3, the BPN model is introduced; in section 4, B-W Analysis is
formally dened and in section 5 its application to diagnosis is discussed; in section 6,
an approach to the parallel implementation of B-W Analysis is proposed; in section 7
an example of the parallel execution of B-W Analysis is discussed; nal conclusions
and comparison with related works are then reported in section 8.
2 Petri Nets: Fundamentals
This section outlines some basic denitions on which we will rely throughout the
paper.
Denition1. A (Petri) net is a triple N=(P,T,F) where
{
{
{
{
P \T = ;
P [ T 6= ;
F (P T) [ (T P)
dom(F) [ cod(F) = P [ T
P is the set of places, T is the set of transitions and F is the ow relation represented
by means of directed arcs. For each x 2 P [ T we will use the classical notations
x = fyjyFxg and x = fyjxFyg1. A marking is a function : P ! IN from places
to nonnegative integers represented by means of tokens into places;
Denition2. Given a Petri net N = (P; T; F) and a marking , a marked Petri
net is dened as = (P; T; F; ) (we can also use = (N; )).
Denition3. Let = (P; T; F; ) be a marked Petri net; a transition t 2 T has
concession in if and only if 8p 2 t (p) 1; if t has concession in , then t may
occur (re) yielding a new marking 0 (we write [t > 0 ) such that for every place
p 2 P we have
0(p) = (p) ? inp(p; t) + out(p; t)
where:
inp(p; t) = 1 if (p; t) 2 F; 0 otherwise
out(p; t) = 1 if (t; p) 2 F; 0 otherwise
1
S
This notation
can be trivially extended to sets as follows: X = x2X x and
S
X = x2X x.
The reachability set of a Petri net N from a marking 0, indicated as R(N; 0 ), is
the smallest set of markings such that:
1) 0 2 R(0);
2) if 1 2 R(N; 0) and 1 [t > 2 for some t 2 T, then 2 2 R(N; 0).
Denition4. Given a marked Petri net = (P; T; F; 0) a place p 2 P is k-bounded
if and only if 8 2 R(N; 0) ((p) k); is k-bounded if and only if 8pi 2 P (pi is
ki-bounded and k = maxi ki); is safe if and only if it is 1-bounded.
A safe marking is a marking such that 8p 2 P((p) 1). Two transitions are said
to be concurrent if and only if each time they have both concession, the ring of one
does not prevent the other from having concession.
Denition5. A marked Petri net = (N; 0) is deterministic if and only if
8 2 R(N; 0 ) 8t1; t2 2 T(if [t1 > and [t2 > then t1 and t2 are concurrent):
3 The Behavioral Petri Net Model
In [11], a Petri net model called Behavioral Petri Net (BPN) was introduced in
order to address the problem of model-based diagnosis [5] in a Petri net framework;
indeed, a Behavioral Petri Net is intended to model the behavior of a system to be
diagnosed, while reachability analysis on the model can be used to perform diagnostic
reasoning.
Denition6. A Behavioral Petri Net is a 4-tuple N = (P; TN ; TOR ; F) where:
1. TN \ TOR = ;
2. (P; (TN [ TOR ); F) is a net
3. F + (transitive closure of F) is irreexive
4. 8p 2 P(jpj 1 ^ jpj 1)
5. 8p1 ; p2 2 P (( p1 = p2) ^ (p1 = p2 ) ! p1 = p2)
6. 8t 2 TN (j tj = 1 ^ jtj > 0) _ (j tj > 0 ^ jtj = 1)
7. 8t 2 TOR (j tj = 2 ^ jtj = 1)
The set of transitions of a BPN is partitioned into two subsets TN and TOR . Transitions in TN are intended in the usual way, and can be classied as:
{ Linear Transitions: t 2 TN : jtj = jtj = 1;
{ Fork Transitions: t 2 TN : jt j > 1;
{ Join Transitions: t 2 TN : jtj > 1;
Transitions in TOR are intended to represent the logical connective OR; a transition
t 2 TOR (graphically represented as an empty thick bar) is said to be an ORtransition and it represents a macro transition whose semantics can be given in
terms of a Petri net with inhibitor arcs (see [11]). Informally, a transition t 2 TOR
has concession in a marking if and only if at least one of its input places is marked.
An obvious consequence of the irreexivity of F + (axiom 3 of denition 6) is that
it denes a partial order, denoted as \", over transitions of a BPN; given two
transitions t1 and t2:
t1 t2 , t1F + t2
By considering such a partial order we can dene the following enabling rule.
Denition7. Given a Behavioral Petri Net N and a marking , a transition t is
enabled at (and so it may re) if and only if it has concession in and 6 9t0 t
such that t0 has concession in .
Denition 7 corresponds to imposing a priority ordering on transitions. Figure 1
shows an example of a BPN; as we will discuss in section 5, such a BPN is intended to represent a partial fault model of a car engine. For instance, transition t1 models the fact that an \increased oil consumption" (modeled by place
oil cons(incr)) can be caused by either a \worn state of piston rings" (modeled
by place pist ring state(worn)) or a \worn state of pistons" (modeled by place
pist state(worn)).
road_cond(poor)
pist_ring_state(worn)
ground_clear(low)
pist_state(worn)
t11
t1
oil_cons(incr)
oil_sump(holed)
t2
t5
B
A
ex_smoke(black)
t10
spark_plug_mileage(high)
C
D
t8
t6
lack_of_oil(sev)
t21
hole_oil_sump(yes)
spark_plugs(used_up)
t9
t22
oil_light(red)
E
F
t17
t12
H
t19
temp_ind(red)
spark_ign(irr)
t18
eng_temp(incr)
G
t20
accel_resp(del)
Fig. 1. Example of a BPN
Notice also that given a marking where spark ign(irr) and lack of oil(sev) are the
only marked places, t20 and t9 have both concession, however t9 is the only enabled
transition since t9 t20.
Denition8. An initial marking of a BPN is a safe marking 0 such that if
0 (p) = 1 then p is a source place (i.e. p = ;).
Denition9. A marked Behavioral Petri Net is a pair (N; ) where N is a Behavioral Petri Net and is either an initial marking or a marking such that there exists
an initial marking 0 and 2 R(N; 0).
A marking such that no transition is enabled at is called a nal marking. The
following theorems have been proved in [11].
Theorem1. A marked BPN is safe and deterministic;
Theorem2. In a marked BPN there exists exactly one nal marking.
Safeness property is a consequence of the priority imposed on transition ring and
allows us to interpret in a simple way a marked place, i.e. a condition can be associated to the place and a token into the place means that the condition is satised;
determinism is a trivial consequence of net structure and of the semantics of ORtransitions. The existence of a unique nal marking in a BPN will be exploited in
section 5 to characterize diagnoses on a BPN model.
4 The B-W Analysis
Given a Behavioral Petri Net, a particular analysis technique, called B-W Analysis,
can be dened. Such a technique consists in a backward reachability analysis performed with two dierent types of tokens called respectively normal tokens (black)
and inhibitor tokens (white). The meaning of normal tokens is as usual: we can associate a condition with a place and a normal token into a place means that such a
condition is satised. On the contrary, inhibitor tokens represent conditions which
are certainly not satised in the case under examination (i.e. the inhibition of a particular condition). If a place with associated condition C is marked with this kind
of token, then :C holds. As a consequence, no constraint is imposed on condition C
when the corresponding place is empty. From a logical point of view, this corresponds
to considering a three-valued logic whose truth value are ftrue; false; unknowng.
In order to formally discuss B-W Analysis, we have to generalize the concept of
marking.
Denition10. Given a BPN N = (P; TN ; TOR ; F), a b-w marking is a function
: P ! fb; w; 0g.
If (p) = b then the place p is marked with a normal token (black), if (p) = w
then the place p is marked with an inhibitor token (white) and if (p) = 0 then the
place p is empty. Let us now introduce the backward enabling rule for this kind of
analysis. Notice that in order to dene such a rule, we need to consider the inverse
relation of the partial order previously introduced; given two transitions t1 and
t2 we dene t1 t2 , t2 t1 .
Denition11. Let N = (P; TN ; TOR ; F) be a BPN, a b-w marking and
t 2 TN [ TOR a transition:
{ t is b-enabled at if 8p 2 t ((p) = b ^ p = ;);
{ :t is b-enabled at if 8p 2 t((p) = w ^ p = ;);
{ t is b-enabled at if 8p 2 t ((p) = b ^ p 6= ;^ 6 9t0 t(t0 or :t0 are b ?
enabled at ));
{ :t is b-enabled at if 8p 2 t((p) = w ^ p 6= ;^ 6 9t0 t(t0 or :t0 are b ?
enabled at )).
The basic concept underlying this denition is that t b-enabled means that we are
reconstructing an evolution of the system where t must re, while :t b-enabled means
that we are reconstructing an evolution where t must not re.
Particularly relevant for B-W Analysis is the concept of inconsistent marking.
Denition12. Given a BPN N = (P; TN ; TOR ; F), a b-w marking is said to
be inconsistent if and only if 9t 2 TN and 9pi ; pj 2 t such that (pi ) = b and
(pj ) = w.
This denition reects the fact that, given a fork transition, it is impossible to have
its output places consistently marked with dierent types of tokens. Another feature
of B-W Analysis is the possibility of forcing the backward ring of fork transitions,
by performing an abstraction step as dened below.
Denition13. Given a BPN N = (P; TN ; TOR ; F), a transition t 2 TN such that
t = fp1 : : :pr g is forced at the b-w marking if and only if:
1. t is not b-enabled at ;
2. is not inconsistent;
3. 9pi (1 i r)(pi ) 6= 0;
4. 6 9t0 t(t0 or :t0 are b ? enabled or forced at ).
The abstraction step can be formalized in the following way:
if t is forced then 8pi 2 t : (pi ) = 0 ) ((pi ) = b) _ ((pi ) = w) in such a
way that is not inconsistent.
This means that we have to mark empty places in the output of t with the same
type of tokens contained in the marked places.
Denition14. Given a BPN and a b-w marking , a b-step at is the maximal
set s = fti1 : : :tir ; :tj1 : : : :tjs g having the property that each tik (1 k r) and
each :tjh (1 h s) is b-enabled at .
Every s0 s is said to be a b-substep.
Notice that in dening a b-step a condition of maximality is required. In order to
show how a new b-w marking is produced from an old one in B-W Analysis, we
introduce some backward ring rules. In the denition of the backward ring rules,
given a place p and a b-w marking , we have to distinguish two possible cases:
1. p = ftg ^ t 2 TN ( t = fp1 : : :pr g; r 1)
2. p = ftg ^ t 2 TOR ( t = fp0; p1g)
In each case we can further distinguish two alternatives; let 0 be a marking resulting
from the b-step s at :
1.a) (p) = b ) ftg is a b-substep of s, 0(p1 ) = : : : = 0 (pr ) = b and 0 (p) = 0.
1.b) (p) = w ) f:tg is a b-substep of s and we have a non-deterministic choice
such that < 0(p1 ); : : :0(pr ) > is any combination of values from fb; wg dierent
from that corresponding to 8pi (1 i r) 0 (pi ) = b.
2.a) (p) = w ) f:tg is a b-substep of s, 0 (p0 ) = 0 (p1) = w and 0 (p) = 0.
2.b) (p) = b ) non-deterministic choice among the following alternatives:
- ftg is a b-substep of s, 0 (p0 ) = b; 0(p1 ) = w and 0(p) = 0;
- ftg is a b-substep of s, 0 (p0 ) = b; 0(p1 ) = b and 0(p) = 0;
- ftg is a b-substep of s, 0 (p0 ) = w; 0(p1 ) = b and 0(p) = 0.
In gure 2 the above backward ring rules are graphically represented. B-W Analysis
OR
OR
OR
OR
INCONSISTENT
Fig. 2. Backward Firing Rules of a BPN
starts with a b-w marking such that (p) 6= 0 ! p = ; (a place p such that
p = ; is said to be a sink place); a given alternative ends when either an initial b-w
marking 0 (i.e. 0 (p) 6= 0 ! p is a source place) or an inconsistent b-w marking
is reached. In the rst case empty source places represent initial conditions that
are not signicant for the case under examination, while source places marked with
normal and inhibitor tokens represent initial conditions that have been proved true
and false respectively.
A backward reachability graph can be obtained in B-W Analysis as shown in
gure 3. Notation p[b] means that place p is marked with a black token and p[w]
that p is marked with a white token; arcs are labeled with b-steps and underlined
<ex_smoke(black)[w],oil_light(red)[b],temp_ind(red)[b]>
f:t5; t17; t19g
<B[w],F[b],H[b]>
ft18g
<B)[w],F[b],eng_temp(incr)[b]>
ft12g
<B[w],F[b],E[b]>
ft9g
ft6g
<B[w],lack_oil(sev)[b]>
ft6g
ft6g
<B[w],A[b],C[b]>
INCONSISTENT
<B[w],A[b],C[w]>
<B[w],A[w],C[b]>
f:t2; t10g
INCONSISTENT
<oil_cons(incr)[w],oil_sump(holed)[b]>
f:t1; t11g
<pist_ring_state(worn)[w],pist_state(worn)[w],road_cond(poor)[b],ground_clear(low)[b]>
Fig. 3. Backward Reachability Graph for B-W Analysis
transitions represent forced transitions. The gure represents the result of B-W
analysis on the BPN shown in gure 1 when the starting marking is
ex smoke(black)[w]; oil light(red)[b]; temp ind(red)[b].
5 Applying B-W Analysis to Diagnostic Problem Solving
One of the most important aspects of the BPN model concerns its suitability in
modeling the behavior of a system to be diagnosed. In [11] the equivalence between
the BPN model and a particular class of logical models quite popular in modelbased diagnosis (i.e. hierarchical denite logic programs) is discussed and formally
shown. In particular, following an approach pioneered in [17], by suitably introducing
a notion of \derivation" in the net model, it is possible to show its equivalence
with respect to classical derivation in the logical model. As a consequence, formal
notions concerning diagnostic problems and their solutions can be re-formulated in
the framework of Behavioral Petri Nets.
Following [3], a diagnostic problem can be suitably described by the 4-tuple
DP =< S; Exp; + ; ? > where S is a set of logical formulae representing the
model of the system to be diagnosed, Exp is a set of ground atoms in terms of which
the solutions have to be computed, + is a set of ground atoms representing observations to be covered in the case under examination and ? is a set ground atoms
representing the values of parameters conicting with the observations. Observations
are usually represented by manifestations of internal states of the modeled system,
while solutions are computed in terms of initial causes of a malfunction. We can then
think to Exp as the set of possible initial causes of the behavior of the system under
examination. If we abstract from time, we can assume that at most one instance of a
manifestation can be observed in a given diagnostic problem; this means that every
admissible value of a manifestation dierent from the observed one is conicting
with the observations. Given a diagnostic problem DP =< S; Exp; +; ? >, a set
E Exp is a solution to DP or a diagnosis for DP if and only if:
8m 2 + S [ E ` m ; 8n 2 ? S [ E 6` n
where ` is the logical derivation symbol. Notice that + is in general a suitable
subset of the set of all the observations OBS (see also the example at the end of this
section) and that dierent choices of + give rise to dierent denitions of diagnosis
(see [3] for a more detailed discussion).
Let us introduce the labeling : P ! BS where P is the set of places of a BPN
and BS is the Herbrand base [6] of the logical model S (i.e. the set of ground atoms of
S). Since a BPN can play the role of model of the system to be diagnosed and since
a notion of derivation equivalent to the logical one can be dened, then a diagnostic
problem can be soundly captured in terms of a BPN.
Denition15. Given a diagnostic problem DP =< S; Exp; + ; ? > and a Behavioral Petri Net NS corresponding to S, we can dene the diagnostic problem in
terms of the BPN model in the following way: DP =< NS ; PE ; P + ; P ? > where:
PE = fp 2 P j(p) 2 Expg, P + = fp 2 P j(p) 2 + g and
P ? = fp 2 P j(p) 2 ? g.
Denition16. A marking of a Behavioral Petri Net covers a set of places Q if
and only if 8p 2 Q ! (p) = 1.
Denition17. A marking of a Behavioral Petri Net zero-covers a set of places Q
if and only if 8p 2 Q ! (p) = 0.
The notion of diagnostic solution can then be captured with the following theorem
(that has been proved in [11]).
Theorem3. Given a diagnostic problem DP =< NS ; PE ; P +; P ? >, an initial
marking E is a solution to DP if and only if the nal marking of NS covers P +
and zero-covers P ?.
It can be shown that, given this formalization, B-W Analysis can be actually
used to compute diagnostic solutions. Let us consider the BPN of gure 1; we will
consider the labeling to be the identity function for every place except for places
indicated as capital letters whose labeling is undened. As already mentioned, this
BPN represents a partial model concerning the faulty behavior of a car engine. Let
us also consider the diagnostic problem characterized by the following observations:
OBS = fex smoke(normal); oil light(red); temp ind(red)g;
in case we require abnormal observations to be covered by a solution we obtain the
following set of places:
PE = fpist ring state(worn); pist state(worn); road cond(poor); ground clear(low);
spark plug mileage(high)g;
P + = foil light(red); temp ind(red)g;
P ? = fex smoke(black)g.
Diagnostic solutions can be computed by performing B-W Analysis starting from
the following b-w marking :
8 b if p 2 P +
<
(p) = : w if p 2 P ?
0 otherwise
We can get all the possible solutions by exploring all the possible non-deterministic
alternatives. In case we get an inconsistent marking, the explored alternative is not
correct and we have to examine other possible search paths. By considering initial
markings obtained at the end of B-W Analysis, the obtained solutions will be formed
by the ground atoms corresponding to places marked with normal tokens and by the
negation of the ground atoms corresponding to places marked with inhibitor tokens.
Graph of gure 3 represents the B-W Analysis leading to the computation of the
solutions to the diagnostic problem DP dened above; in particular the only possible
diagnosis is: E = froad cond(poor); ground clear(low); :pist ring state(worn);
:pist state(worn)g.
Notice that nothing has to be said about spark plug mileage since it is irrelevant
for the case under examination.
6 Exploiting Parallelism in Backward Reachability Analysis
In this section we describe how B-W Analysis can be performed by means of a set of
asynchronous processes, executing in a concurrent fashion and interacting through
exchange of messages. The concurrent implementation of B-W Analysis corresponds
to a concurrent implementation of the token game executed in a backward fashion.
Two dierent kinds of approaches have been proposed in the literature for the
concurrent implementation of the token game, usually classied as centralized or decentralized ([2, 14, 15]). In the former approach the token game is carried out by a
set of processes (usually identied with the transitions of the net) whose execution
is controlled by a coordinator process. On the other hand decentralized approaches
are based on a set of sequential processes (each of them managing a set of transitions) running asynchronously and interacting by a communication/synchronization
mechanism.
As pointed out in [2] the centralized approach is not adequate when performance
is the major concern, because of the intermediate coordinator process presence.
Moreover if the message passing model is adopted, then the number of messages
needed to implement the centralized approach is much larger than needed to implement the decentralized solution, resulting in a considerable overhead. The approach
we choose in this paper is then the decentralized one.
The use of a set of asynchronous processes produces several advantages that can
be better understood by comparing this execution model with a sequential one. In the
latter, B-W analysis is performed step-by-step and transitions are considered as static
entities that need to be tested for their enabling; the modications in the marking
produced by the red step are computed looking at the type of transitions red. On
the contrary, in the proposed decentralized approach transitions are considered as
active entities that decide to re independently, according to the availability of the
tokens they need. Moreover each transition knows the actions it has to perform when
ring, so the produced modications in the partial marking related to it are dened
locally to transitions; global marking modications are computed only when needed
and only for meaningful situations. Finally when several alternative markings can
be generated from a given one through dierent steps, all of them can be explored
in the same execution.
Given a BPN model, a set of sequential processes implementing B-W analysis is
automaticallyderived from the net structure. The basic idea underlying our approach
is that independent transitions should be managed by dierent processes so that
concurrency is eectively exploited.
Our approach works as follows: the rst step is the derivation of a partition of
the transitions of a given BPN model and then a process is associated with each
subset of transitions. In this paper we will not deal with any specic implementation language, but rather we will present a general technique to obtain the parallel
program implementing B-W analysis. The language we use to describe processes is
a \meta-language", based on explicit message passing, easily translatable in one of
the classical parallel languages such as OCCAM.
6.1 Net partitioning
As said above, the rst step is that of deriving a partition of the set of transitions of
a given BPN. To partition the set of transitions we use a binary relation dened
over (TN [ TOR ) (TN [ TOR ). In the following let N = (P; TN ; TOR ; F) be a BPN
and T = TN [ TOR .
Denition18. Let ti; tj be two transitions of a BPN N. The relation T T is
dened as:
ti tj ,j ti j= 1 and j tj j= 1 ^ ti = tj
The following property can be easily proved.
Property 1 Let ti ; tj ; t 2 T be transitions of a BPN N . If both ti t and tj t,
then ti = tj .
Denition19. Given a BPN N, a transition t 2 T is said starting i j t j> 1 or
(j t j= 1 ^ t \ tj = ;); 8tj 2 T.
The above denition corresponds to say that a starting transition has either several
output places or exactly one output sink place.
Given a starting transition t, it is possible to dene a subset of transitions, called
the partitioning subset generated by t, in the following way.
Denition20. Let t 2 T be a starting transition of a BPN N. The partitioning
subset Ti T generated by transition t is dened in the following way:
1. t 2 Ti
2. if ti 2 Ti ^ 9tj 2 T: ti tj then tj 2 Ti .
Given a starting transition t, its corresponding partioning subset Ti is built by
computing the transitive closure + of the relation. This process stops when the
rst transition tj , such that 8tk 2 T tj 6 tk , is added to Ti . Such a transition tj
is said to be the ending transition of Ti . By denition of the relation, an ending
transition t can be characterized in the following way: either (a) j t j> 1 or (b)
t = fpg and p is a source place or (c) t = fpg and t tj and tj is a starting
transition.
We now prove that the partitioning subsets of a BPN (i.e. the set of partitioning
subsets generated by all the starting transitions of the BPN) determine a partition
of the set of transitions of the net.
Lemma 4. Let Q = fTi g be the set of partitioning subsets of a BPN N . Then:
1. 8Ti ; Tj 2 Q; Ti \ Tj = ; and
j T =T
2. [ijQ=1
i
Proof of 1
By contradiction suppose that 9Ti ; Tj 2 Q; Ti 6= Tj such that Ti \ Tj 6= ; and
consider a transition t 2 Ti \ Tj . If t is a starting transition, then, by denition 20,
Ti = Tj which is a contradiction.
On the other hand, if t is not a starting transition then 9ti 2 Ti ; tj 2 Tj ; ti 6= tj
such that both ti t and tj t. By property 1, ti = tj which is a contradiction.
Proof of 2
By contradiction suppose that 9t 2 T such that t 62 [ijQ=1j Ti . If t is a starting transition, then, by denition 20, t belongs to the partioning subset it generates, so a
contradiction arises. Suppose consequently that t is not a starting transition. In this
case if t 62 [ijQ=1j Ti then
8Ti 2 Q; 8ti 2 Ti ; ti 6 t
(1)
It should be noted that if t is not a starting transition, then j t j= 1. Denoting as
p the unique output place of t, condition (1) implies that p is not in the input set
of any transition belonging to any partitioning subset, i.e. p is a sink place. This in
turn implies that t is a starting transition, since its output set comprises only one
sink place, and this contradicts the hypothesis that t is not a starting transition.
2
Given a partition of the set of transitions, it is possible to generate independent
subnets called transition-generated subnets.
Denition21. Let N = (P; TN ; TOR ; F) be a BPN and let T = TN [ TOR . Given a
partition fT1 ; : : :; Tng of T, we dene the transition-generated subnets (TGS) of N
w.r.t. the partition to be the nets Ni = (Pi; Ti ; Fi) (i = 1; : : :; n) where:
{ Pi = P \ ( Ti [ Ti )
{ Fi = F \ ((Pi Ti) [ (Ti Pi))
Given a TGS Ni , we denote as S(Ni ) its starting transition and as E(Ni ) its ending
transition.
Figure 4(a) shows the partitioning subsets Ti , obtained from the net of gure 1.
In gure 4(b), for the sake of clarity, only some of the transition generated subnets
(in particular those corresponding to T1 ; T2 and T8) have been highlighted.
ground_clear(low)
road_cond(poor)
pist_ring_state(worn)
pist_stat(worn)
t11
t1
oil_cons(incr)
oil_sump(holed)
t2
t5
B
ex_smoke(black)
A
t10
spark_plug_mileage(high)
D
C
T1
= ft1; t2g
T2
= ft6; t9g
T3 = ft5g
T4
= ft10; t11g
t8
t6
t21
spark_plugs(used_up)
t9
E
T5 = ft8g
T6
= ft21; t22g
T7 = ft17g
T8
hole_oil_sump(yes)
lack_of_oil(sev)
t22
oil_light(red)
F
t17
H
t19
temp_ind(red)
t12
spark_ign(irr)
t18
eng_temp(incr)
= ft12; t18g
T9 = ft20g
T10 = ft19g
(a)
G
t20
accel_resp(del)
(b)
Fig.4. An example of the application of the partitioning technique
6.2 Processes derivation
Given a BPN model, a process is associated with each TGS generated from it. Each
process is constructed by providing, for each transition in a given TGS, an activity
implementing its backward ring rule, by sequentially composing the above activities
beginning from the starting transition and consecutively adding those related to
transitions in the same TGS. An additional process, called the Assembly Process
(AP), is used to collect partial results from processes holding source places and it is
responsible for the assembling of nal solutions.
According to the denitions given is section 3, each transition t of a BPN
N = (P; TN ; TOR ; F) can be classied as Fork, Join, Or and Linear transition. To
each transition class a simple activity, performing the backward ring rule for that
class, can be associated as depicted in gure 5, where the following notation has been
used: the input and output parameter lists have been specied using the keywords
in and out, while the symbol `2' is used to denote dierent mutually exclusive
alternatives. In the activity corresponding to Join transitions we denote as Ai one
among the 2n ? 1 possible instantiations of values to output variables (except that
assigning b to all of them). The activity corresponding to linear transitions has been
procedure Join(in p ;out p1 ; p2; : : : ; pn );
begin
if p = b then
p1 := b; p2 := b; ; pn := b
else
nondeterministically do
2 A1
2 A2
.
.
.
2 A2n?1
enddo
endif
end
procedure Or(in p ; out p1; p2 ); procedure Fork(in p1 ; p2; : : : ; pn ;out p );
begin
begin
if p w then
if ( p1 ; p2; : : : ; pn ) inconsitent then quit
p1 := w; p2 := w
endif
else
if 9 i : pi = b then p := b
nondeterministically do
else p := w
p1 := b; p2 := w
endif
p1 := b; p2 := b
end
=
2
2
2
p1 :=
w; p2
:=
b
enddo
endif
end
Fig. 5. Activities associated to transition classes
omitted since it corresponds to a copy of the contents of its unique input variable to
the unique output variable.
The behavior of an activity is derived from the backward ring rule, dened for
the corresponding class of transitions, in the following way: given a transition t, we
introduce in the related activity an output variable for each places in t and one
input variable for each place in t . The above variables contain either black (b) or
white (w) tokens; if no token is contained in a place, the content of the corresponding
variable is undened. In order for an activity to start, the contents of all its input
variables must be dened and when it ends, the contents of its output variables are
updated. An activity corresponding to a transition having more than one output
places is called synchronization point, since all its input variables must be dened
in order for the activity to start. Since the set of output variables of an activity t1
may not be disjoint from the set of input variables of another activity t2, the end
of t1 may imply the start of t2 ; t2 receives as input the data items produced by t1 .
In this case we say that t1 and t2 are interacting activities. The content of variables
corresponding to sink places is considered as a data item provided by the external
environment, while in other places the data items are provided by other activities.
It should be noted that the set of TGSs does not form a partition over the set of
places of a given BPN. This implies that some processes have variables corresponding
to the same place of the BPN. In this case we consider the variables as input and
output buers of a communication channel among processes. More precisely if Ni ; Nj
are two TGS such that E(Ni ) \ S(Nj ) 6= ;, then there is a communication channel
between processes i and j , respectively corresponding to Ni and Nj , and the ow
of messages occurs asynchronously (i.e. there is no rendez-vous) from i to j .
The direct use of TGSs to derive the set of processes performing B-W analysis
can lead to deadlock problems. In fact it may happen that some processes holding
sink places are never active due the particular starting marking. Consequently some
other processes, waiting messages from the inactive ones, are blocked. This eect is
propagated through the set of processes, producing thus a deadlock. In the sequential
execution model transitions which are never active are forced to re (i.e. they are
forced transitions). Forced transitions could also be used in the concurrent execution
model, but a more ecient solution can be devised. This problem can indeed be
solved by observing that if the starting transition of a TGS cannot receive tokens
in some of its output places, then these places can be safely removed. If all the
output places of the starting transition of a TGS are removed, then the overall
TGS can be removed. Considering the concurrent program, this step corresponds to
remove input channels and processes. To obtain a deadlock free concurrent program
a simplication step over the set of TGSs is performed. The simplication step is
dened as follows:
1. Given a TGS Ni , remove all the places p 2 S(Ni ) which are unmarked sink
places;
2. if S(Ni ) becomes empty then remove Ni from the set of TGSs
3. if Ni has been removed, then remove all the places in E(Ni ).
The simplication step is iteratively performed considering each TGS in turn. After
the simplication step, the set of processes corresponding to the remaining TGSs
is built. In this way no process will wait for a message that cannot be sent, so the
resulting program is deadlock free.
The set of TGSs corresponding to a given BPN can then be considered as a
template, for the set of processes performing B-W analysis, which can be instantiated
according to the particular starting marking provided for B-W analysis. When such
a marking is specied, a simplication step (as described above) is performed and
only the processes corresponding to the remaining TGSs are built and scheduled for
execution. The construction of the set of TGS need to be performed only once for
a given BPN model, while the simplication step has to be performed each time a
new starting marking for B-W analysis is specied.
6.3 Multiple solutions and inconsistency checking
As said above, one of our design goals is that of analyzing all the possible evolutions of the system. In order to perform this task the behavior of the elementary
activities needs to be modied as discussed below. When a nondeterministic choice is
present, each possible alternative is generated and then propagated among activities,
allowing the computation of the overall set of solutions within a single execution. It
should be noted that exhaustive generation of alternatives implies that each place
can simultaneously contain more tokens, each of them being related to a particular
alternative. To correctly manage this situation it is necessary to keep track of the
dierent evolutions generated. This can be accomplished by modifying the interpretation of variables, considering them as memory buers which can contain several
items of the type < c; > where c 2 fb; wg represents either a black (c = b) or white
(c = w) token and , called evolution identier (eid), is a string denoting a path
in the backward reachability graph. In a similar way the content of each message
exchanged among processes can be dened. Nondeterministic choices are then eliminated generating all the possible alternatives, and to each of them a dierent eid
is assigned. Using this method all the possible alternatives, generated during B-W
analysis, can be considered in the same execution; this means that all possible solutions to a diagnostic problem can be collected at the end of the analysis. It should be
noted that in this way, at the end of the analysis, the backward reachability graph
is not available to the Assembly Process. Nevertheless it can be easily built by AP
if data items are modied to include also information about the ring of transitions.
The choice of a set of processes running asynchronously implies that there is
no explicit representation of the marking, which instead is split among dierent
processes. This situation implies that a protocol must be devised for inconsistency
checking. In fact a process discovering the inconsistency of a given marking should
signal the inconsistent situation to all the other processes managing dierent parts of
the same marking. However, because of the lack of a global state, it may be the case
that the process discovering the inconsistency does not know the identities of the
other processes holding part of the same marking. The solution we propose, called
i-propagation, is based on the propagation of the inconsistency towards synchronization points. The process discovering the inconsistent marking produces a data item
of the type < i; > where i means \inconsistent" and is the current eid; such a
data item is then propagated by means of messages to other processes. Inconsistency
is discovered by means of a merge operation, dened on the above mentioned data
items, performed at each synchronization point. The merge operation is a commutative operation dened as follows:
Denition22. Let 0 be a prex string of and c; c0 2 fb; wg such that c 6= c0.
{ merge(< c; >; < c; 0 >) =< c; >
{ merge(< c; >; < c0; 0 >) =< i; >
{ merge(< c; >; < i; 0 >) = merge(< i; >; < c; 0 >) =< i; >
Since the rst operation after a synchronization point corresponds to a Fork transition, the merge result is put into the location corresponding to the input place of
such a transition. The merge operation is performed on data items with the same
eid, contained into dierent memory buers (corresponding to output places of the
transition). At the end of the analysis the Assembly Process checks all the data items
contained in the locations corresponding to source places. If one of these places contains a data item of the kind < i; >, then from each source place the data items
< c; >, which are related to the same evolution , are removed and not considered
as nal solutions. It should be noted that the introduction of the merge operation
requires a slight modication of the activities associated to transitions (see [11] for
more details).
7 An Example
In this section we describe, as an example, the derivation of the parallel program
implementing B-W analysis for the BPN depicted in gure 4 and its execution on
a particular starting marking. In what follows we denote as Ni the transition generated subnet corresponding to the partitioning subset Ti , and with i the process corresponding to Ni . Suppose that the starting marking for B-W analysis is
ex smoke(black)[w]; oil light(red)[b]; temp ind(red)[b]. The simplication step over
the set of TGSs is performed as follows:
{ N9 is removed from the set of TGS since S(N9 ) contains only one unmarked
sink place;
{ places G and spark ign(irr) are removed as a consequence of the removal of N9 ;
{ N6 is removed since the unique place in S(N6 ) (spark ign(irr)) has been removed
as a consequence of the removal of N9 ;
{ N5 is removed since S(N5 ) contains only one unmarked sink place.
After the simplication step described above, the set of processes corresponding to
the remaining TGSs is built. In gure 6 the interaction among processes is represented through a graph in which nodes correspond to processes and directed arcs
corresponds to communications whose ow is represented by arc directions.
3
Environment
10
1
8
7
2
AP
4
Fig.6. Interaction structure of processes corresponding to TGSs in Fig. 4
Let us now present an example of the execution of the concurrent program on
the starting marking above dened. For the sake of simplicity in the description we
suppose that if more alternatives are generated by a process, then all the corresponding messages are sent in a single bunch to each destination process. Moreover we do
not consider the fact that dierent processes may need dierent times to perform
internal computations before sending messages. This implies that after receiving a
message, the next action performed by a process is the sending of the messages
corresponding to the results of its internal computation. This expedient allows us
to describe the execution of the example program in a step-by-step fashion. This
assumption is made only for description purposes; actually in real executions all the
described actions occur asynchronously.
Q
j : fm1 ; : : :; mk g to denote that
In the description we use the notation i ?!
process i sends to process j the bunch of messages m1 ; : : :; mk through channel
Q
Q. The notation j ;
i is used to denote that process i is waiting for a message
from process j through channel Q. The specication of the channel on which
messages are sent is needed if a process holds more than one source place (in our
example 1 and 4). In this way the Assembly process can build nal solutions. It
should be noted that a process may have more than two input channels. The merge
operation should be therefore applied in a pipeline fashion, i.e. if fm1 ; : : :; mn g is a
set of messages such that mi is received from channel pi , then the resulting sequence
of applications of the merge operation is
merge(mn ; merge(mn?1 ; merge(mn?2 ; merge(: : :merge(m2 ; m1 ) : : :))))
The function merge*(fm1; : : :; mn g) is used to denote the merge operation applied
to a set of messages. This function is recursively dened as
{ merge*(fm1; g)=m1
{ merge*(fm1; m2; : : :; mng)=merge(merge*(fm1; : : :; mn?1g); mn)
where m1 ; : : :; mn are messages and denotes the empty message.
In the following we denote as C1 ; C2; C3; C4 respectively the communication channels
pist ring state(worn), pist state(worn), road cond(poor) and ground clear(low).
The generation of a new eid is performed through the concatenation of the previous
eid with an integer representing a new evolution generated, separated through the
character `#'. Each data item provided by the external environment is assumed to
have the eid set to the empty string .
step 0: Initially all the processes are waiting for input. The external environment
performs the following actions: Env ?! 3 :< w; >, Env ?! 7 :< b; >,
Env ?! 10 :< b; >.
step 1: 3 ?! 1 :< w; >, 10 ?! 8 :< b; >, 7 ?! 2 :< b; >.
C4
C3
C2
C1
AP.
AP, 4 ;
AP, 4 ;
AP, 1 ;
2 ; 1, 8 ; 2, 2 ; 4, 1 ;
step 2: 8 ?! 2 :< b; >. 2 performs merge*(f< b; >; < b; >g), producing
the message < b; >;
C4
C3
C1 AP, C;2 AP, ;
2 ; 1, 2 ; 4, 1 ;
4 AP, 4 ; AP.
1
step 3: 2 produces the three messages corresponding to dierent assignments,
since the output place of its ending transition (t6) contains < b; >.
2 ?! 1 : f< b; #1 >; < b; #2 >; < w; #3 >g
2 ?! 4 : f< w; #1 >; < w; #2 >; < b; #3 >g
C4
C3
C2
C1 AP, ;
2 ; 1, 2 ; 4 1 ;
1 AP, 4 ; AP, 4 ; AP.
step 4: 1 performs the following merge* operation:
merge*(f< w; >; < b; #1 >g) =< i; #1 >
merge*(f< w; >; < b; #2 >g) =< i; #2 >
merge*(f< w; >; < w; #3 >g) =< w; #3 >
C1
AP : f< i; #1 >; < i; #2 >; < w; #3 >g
1 ?!
C2
1 ?! AP : f< i; #1 >; < i; #2 >; < w; #3 >g
C3
AP : f< w; #1 >; < b; #2 >; < b; #3 >g
4 ?!
C
4
4 ?! AP : f< w; #1 >; < b; #2 >; < b; #3 >g
step 5: AP discards from all the source places the data items related to evolutions
#1 and #2 since there are data items of the kind < i; #1 > and < i; #2 >. The
nal result is thus:
< pist state ring(worn)[w]; pist state(worn)[w]; road cond(poor)[b];
ground clear(low)[b] >
8 Conclusions and Related Works
The approach proposed in this paper gives a suitable motivation to the usefulness
of backward reachability analysis on Petri net models, by applying it to diagnostic
problem solving; it can be seen as the complement of the approach proposed in [10],
where T-invariant analysis is exploited to perform diagnosis.
The possibility of using Petri nets in AI applications is recently receiving a lot
of attention [7, 16]; the present work shows how Petri net-based and AI-based techniques can be successfully merged in diagnostic problem solving.
Other attempts to address the problem of diagnostic reasoning using Petri nets can
be found in [8], where algebraic analysis is used to detect single-fault diagnoses using
a set of production rules modeled as a Petri net, and more recently in [12], where
the correspondence between linear logic [4] and Petri nets is exploited in order to
diagnose exible manufacturing systems. We rely on a general and formal theory of
diagnosis where multiple fault can be naturally addressed and we consider systems
for which underlying logic is much simpler than linear one. However, when cyclic
processes has to be modeled (as in the case of exible manufacturing systems) the
use of more complex frameworks is needed.
Notice that B-W Analysis can be applied also to tasks dierent than diagnostic
one; indeed, in [9], the use of this type of analysis is proposed as a tool for the
validation of a causal model (represented through a Petri net) following some correctness criteria and by detecting some errors that can happen when constructing
the end-user model.
In the present paper, we also proposed a parallel implementation of B-W analys,
based on the net structure and on the marking used to start analysis. The problem
of obtaining, in a single execution, all the solutions to a diagnostic problem has been
solved introducing the concept of evolution identier (eid). This concept is also the
basis for the proposed approach for inconsistency checking, namely i-propagation.
The possibility of parallel implementation makes B-W analysis a good candidate for
the mitigation of the relatively high ineciency diagnostic algorithms usually have.
Future works are planned toward the actual evaluation of the proposed approach
on a multiprocessor architecture and to the comparison of the parallel approach with
a sequential one.
Acknowledgements
The authors would like to thank Prof. Gianfranco Balbo and Dr. Matteo Sereno for
fruitful discussions and comments during the preparation of the rst draft of this
paper.
References
1. L. Bernardinello and F. De Cindio. A survey of basic net models and modular net
classes. In G. Rozenberg, editor, Advances in Petri Nets 1992, LNCS 609, pages 304{
351. Springer Verlag, 1992.
2. J.M. Colom, M. Silva, and J.L. Villarroel. On software implementation of Petri nets
and Colored Petri nets using high-level concurrent languages. In Proceedings of the 7th
International Conference on Application and Theory of Petri Nets, 1986.
3. L. Console and P. Torasso. A spectrum of logical denitions of model-based diagnosis.
Computational Intelligence, 7(3):133{141, 1991.
4. J.Y. Girard. Linear logic. Theoretical Computer Science, 50, 1987.
5. W. Hamscher, L. Console, and J. de Kleer. Readings in Model-Based Diagnosis. Morgan Kaufmann, 1992.
6. J.W. Lloyd. Foundations of Logic Programming. Springer-Verlag, 1987.
7. J. Martinez, P.R. Muro, M. Silva, S.F. Smith, and J.L. Villaroel. Merging articial
intelligence techniques and Petri nets for real-time scheduling and control of production
systems. In Proc. 12th IMACS World Congress on Scientic Computation, pages 528{
531, Paris, 1988.
8. T. Murata and J. Yim. Petri-net deduction methods for propositional-logic rule-based
systems. Technical Report UIC-EECS-89-15, University of Illinois at Chicago, 1989.
9. L. Portinale. Verication of causal models using Petri nets. International Journal of
Intelligent Systems, 7(8):715{742, 1992.
10. L. Portinale. Exploiting T-invariant analysis in diagnostic reasoning on a Petri net
model. In Proc. 14th Int. Conf. on Application and Theory of Petri Nets, LNCS 691,
pages 339{356. Springer Verlag, Chicago, 1993.
11. L. Portinale. Petri net models for diagnostic knowledge representation and reasoning.
PhD Thesis, Dip. Informatica, Universita' di Torino, 1993.
12. B. Pradin-Chezalviel and R. Valette. Petri nets and linear logic for process oriented diagnosis. In Proc. IEEE Int. Conference on Systems Man and Cybernetics, Le Touquet,
France, 1993.
13. E. Rich and K. Knight. Articial Intelligence (2nd Edition). Mac Graw Hill, 1991.
14. M. Silva and R. Valette. Petri nets and exible manifacturing. In Advances in Petri
Nets 1989. Springer-Verlag, 1989. LNCS 424.
15. D. Taubner. On the implementation of Petri nets. In Proceedings of the 8th International Conference on Application and Theory of Petri Nets, 1987.
16. R. Valette and M. Courvoisier. Petri nets and articial intelligence. In Proc. Int. Workshop on Emerging Technologies for Factory Automation, North Queensland, Australia,
1992.
17. D. Zhang and T. Murata. Fixpoint semantics for Petri net model of denite clause
logic programs. Technical Report UIC-EECS-87-2, University of Illinois at Chicago,
1987. also to appear in Advances in the Theory of Computation and Computational
Mathematics, Ablex Publ.
This article was processed using the LaTEX macro package with LLNCS style