Chapter 5. Maintaining the O-graph for Item Deletion and Mergence
5.5 Place Mergence
This section discusses the maintenance of the O-graph for Place Mergence.
5.5.1 Scenario of Place Mergence
Let a relation which belongs to P×P be named as a MPR relation. The mergePlace example in section 3.3 can be translated into: PN is transformed into PN’ by applying mergePlace with a MPR relation (p4, p1). A formal definition of a MPR addition is described in Definition 5.22.
Definition 5.22 (MPR mergence)
Let PN = (P, T, F, m0) be a Petri net. A Petri net PN’ = (P’, T’, F’, m’0) constructed by applying a MPR relation mpr = (pfrom, pto) into PN has the following properties:
(1) P’ = P \ { pfrom };
(2) T’ = T;
(3) F’ = F \ (Foldt∪Foldh)∪ (Fnewt∪Fnewh), where Foldt = { f = (ti, pj) ∈ F | pj = pfrom },
Foldh = { f = (pi, tj) ∈ F | pi = pfrom }, Fnewt = { f = (ti, pto) | ∃ (ti, pfrom) ∈ F }, and Fnewh = { f = (pto, tj) | ∃ (pfrom, tj) ∈ F };
(4) 𝑚0′= m0 + m0[pfrom] * PCV.pto, and then DPT(𝑚0′, pfrom).
In a MPR mergence, both the original net PN and the refined net PN’ have the same transitions, but PN has one more place representing the MPR relation merged. Also, item (3) shows the redirections described in section 3.1. The tokens in pfrom and pto of the original net are put in pto of the refined net.
Definition 5.23 (state space mapping function for mergePlace SSME) With Definition 5.22 and M‟, the set of all markings of PN’. The state space
mapping function SSME is a function defined from M into M’, and mpr = (pfrom, pto):
∀ mi ∈ M: SSME(mi) = mi + mi[pfrom] * PCV.pto
SSME is a function which maps the reachable markings of PN to the reachable markings of PN’. For example, while using marking m4=(0,1,0,0,1,0) in Table A3.19(a) as input, SSME
outputs marking 𝑚4′ = (0,2,0,0,0) = m4 + m4[p4] * PCV.p1 = (0,1,0,0,1,0) + 1 * (0,0,0,0,1,0), as shown in Table A3.20(a).
Definition 5.24 (arc mapping function for mergePlace RE)
Let E = mergePlace be defined as in Definition 5.23, and M‟ be the set of all
markings of PN’. The arc mapping function RE is a function defined from A into M‟
× T’ × M‟, and mpr = (pfrom, pto): ∀ak = (mi, tn, mj) ∈ A:
RE(ak) = ( DPT(SSME(mi), pfrom) , tn, DPT(SSME(mj), pfrom) ).
For example, marking m3 can enable the firing of transition t0, i.e. a6=(m3, t0, m6) in Table A3.19(b). After arc mapping function RE is applied with inputs a6, RE(a6) = (𝑚3′,t0,𝑚6′), as shown in Table A3.20(b).
Definition 5.25 (temporal occurrence graph for mergePlace OGE) Let E = mergePlace be defined as in Definition 5.23, and M be the set of all
markings generated from SSME. The temporal occurrence graph OGE is the directed graph OGE = (V, A) with mpr = (pfrom, pto), where
(1) ∀ vi ∈ V, vi ∈ V: mi = ( DPT(SSME(mi), pfrom), (2) A = { (mi, tn, mj) ∈ M×T×M | mi [ tn > mj }, and (3) ∀ak ∈ A, ak ∈ A: ak = RE(ak).
For example, Figure 5.6 is the OGE after DPT, SSME, and RE are applied with input OG in Figure 3.41.
Figure 5.6 The temporal occurrence graph OGE modified from Figure 3.41.
v0
v2 v1
v5 v4 v3
v7 v6
v8
a1 a0
a5 a4 a3 a2
a9 a8 a7 a6
a11 a10
Definition 5.26 (must re-generated marking set for mergePlace MRGE)
For a temporal occurrence graph OGE and M, the set of all markings in OGE. OGE
might have a must re-generated marking set MRGE ⊆ M, mpr = (pfrom, pto):
MRGE = { mi ∈ M| mi[pto]>0 }.
MRGE in Figure 5.6 is {m1, m2, m4, m6, m7}.
Proposition 5.1
Let E = mergePlace be defined as in Definition 5.23, C be the incidence matrix of PN, C’ be the incidence matrix of PN’, and a temporal occurrence graph OGE be defined as in Definition 5.25. Then,
(1) v0 = 𝑣0′, (2) V ⊆ V’, and (3) A ⊆ A’.
Proof:
(1) Since the initial markings of PN and PN’ are the same, v0 = 𝑣0′. (2) For each node vi in V,
mi = DPT(SSME(mi), pfrom).
Since the firing sequence of 𝜎 𝑖∗ can be fired in PN’, there is a marking 𝑚𝑖′ = 𝑚0′ + 𝐶′ ∗ 𝜎 𝑖∗.
Because there might be some token(s) generated after mergence from pfrom to pto, the difference between mi[pto] and 𝑚𝑖′[pto] is mi[pfrom]. Besides, the rest of mi are equivalent to those of 𝑚𝑖′, i.e.
𝑚𝑖′ = DPT(SSME(mi), pfrom).
According to Definition 5.23,
mi = DPT(SSME(mi), pfrom) is 𝑚𝑖′. From Definition 5.25 and 𝜎 𝑖∗ = 𝜎 𝑖∗′, vi = 𝑣𝑖′.
Thus, and V is the subset of V’.
(3) For each arc ak = (mi, tn, mj) in A, there is a node 𝑣𝑖′∈ V’ and a marking 𝑚𝑖′= mi based on the discussions in (2). Since 𝑚𝑖′[pto] ≧ mi[pto] and the token numbers in the rest places do not change, transition tn enabled at mi can also be fired at 𝑚𝑖′. From Definition 5.25(1), another marking mj ∈ M can be modified as
mj = DPT(SSME(mj), pfrom).
From Definition 2.4,
mj = mi + C * TCV.tn. From Definition 4.2,
𝜎 𝑗∗ = 𝜎 𝑖∗+ TCV.tn.
Therefore, mj = DPT(SSME(mi), pfrom) + DPT(C * TCV.tn + (C * TCV.tn)[pfrom] * PCV.pto, pfrom). Because (C * TCV.tn)[pfrom] * PCV.pto is the number of new tokens in the place pto, C’ * TCV.tn = DPT(C * TCV.tn + (C * TCV.tn)[pfrom] * PCV.pto, pfrom).
Thus, there exists an arc 𝑎𝑘′ =(𝑚𝑖′, tn,𝑚𝑗′) ∈ A’ and mj = 𝑚𝑖′ + C’ * TCV.tn = 𝑚𝑗′. Hence, ak = 𝑎𝑘′ and A is the subset of A’.
Proposition 5.2
Let E = mergePlace be defined as in Proposition 5.1. Then, ∀ 𝑎𝑘′=(𝑚𝑖′, tn,𝑚𝑗′) ∈ A’ : (1) if 𝑚𝑖′ ∉ M, then 𝑎𝑘′∉ A.
(2) if 𝑚𝑖′ ∈ MRGE and ∄ (mi, tn, mj) ∈ A, then 𝑎𝑘′∉ A.
(3) if 𝑚𝑖′ ∈ MRGE and ∃ (mi, tn, mj) ∈ A, then 𝑎𝑘′∈A.
(4) if 𝑚𝑖′ ∈ M and 𝑚𝑖′∉ MRGE, then 𝑎𝑘′ ∈A.
Proof:
(1) If 𝑚𝑖′ does not exist in OGE, the arcs starting from it to 𝑚𝑗′ can not occur in OGE. (2) Because ∄ (mi, tn, mj) ∈ A and Definition 5.25(3), ∄ (mi, tn, mj) ∈ A. Thus, 𝑎𝑘′∉ A.
(3) Since ∃ (mi, tn, mj) ∈ A and Definition 5.25(3), ∃ (mi, tn, mj) ∈ A. Thus, 𝑎𝑘′ ∈A.
(4) Because 𝑚𝑖′ ∉ MRGE, mi[pto]>0. Hence, mi can enable all transitions which 𝑚𝑖′ can enable. Since mi can enable all transitions which 𝑚𝑖′ can enable, each arc from 𝑚𝑖′ belongs to A.
We use the mergePlace example in section 3.3 to explain Proposition 5.2. In the example:
(1) Because 𝑎14′ =(𝑚9′,t0,𝑚7′) and 𝑚9′∉ M, 𝑎14′ ∉ A.
(2) 𝑚1′∈ MRGE, a2=(m1,t3,m3), and a3=(m1,t0,m4) cause 𝑎12′ =(𝑚1′,t1,𝑚9′)∉ A.
(3) 𝑚1′∈ MRGE and a3=(m1,t0,m4) cause 𝑎3′=(𝑚1′,t0,𝑚4′)∈ A.
(4) Since 𝑚3′∈ M and 𝑚3′ ∉ MRGE, 𝑎6′=(𝑚3′,t0,𝑚6′) ∈ A.
Proposition 5.2(1) and (2) detect the arcs which do not belong to A. Proposition 5.2 certifies that the detections are complete.
5.5.2 Updating an Occurrence graph and the time complexity
Algorithm 5.11 presents a method to update the corresponding O-graph OG’ for the mergence of a MPR relation. Based on Definition 5.22, Algorithm 5.11 firstly modifies OG for OGE (Definition 5.25), and then extends OGE for the O-graph OG’ = (V’, A’).
Algorithm 5.11 Main_MP (PN, OG, mpr) → PN’ and OG’
// Input PN: the original net // OG: the O-graph of PN // mpr: a MPR relation
// Output PN’: the refined net with mpr // OG’: the O-graph of PN’
● Mnr ←∮: a set of markings. Mnr ⊆ M’ \ M. Mnr contains those markings for which we have not yet found the successors.
● MRGE ←∮: a set of markings as in Definition 5.26.
● OGE : a temporal occurrence graph. V ←∮and A ←∮.
● OG’ : an occurrence graph. V’ ←∮and A’ ←∮.
1 delete place to psrc // construct PN’
2 the tokens in pfrom and pto of PN are put in pto of PN’
3 redirect the arcs connected with pfrom
4 ModifyOG_MP // Algorithm 5.12
5 Findmarking // Algorithm 4.4
6 ExtendOG // Algorithm 4.5
Line 1 to line 3 in Algorithm 5.11 constructs the refined Petri net PN’. Line 4 calls the function ModifyOG_MP (Algorithm 5.12) to modify the state space in OG. Line 6 calls the function ExtendOG (Algorithm 4.5) to generate the new nodes and arcs whose ancestors are in Mnr. The details of each step will be presented below.
Algorithm 5.12 ModifyOG_MP
1 ATF ← ATF 2 A ← A
3 for all vi ∈ PmapV (pfrom, pto) do
//the nodes affected by mergePlace(PN, pfrom, pto) 4 begin
5 NewV(vi ,vi)
6 mi ←mi + mi[pfrom] * PCV.pto // Definition 5.23 7 DPT(mi, pfrom) // Definition 5.18 8 if(∃mj∈ M where mi = mj)
9 Merge(vi, vj)
10 else if (mi[pto]>0) // Definition 5.26 11 MRGE ←MRGE∪{mi}
12 endif 13 endfor
In Algorithm 5.12, the loop from line 3 to 13 selects a node vi in PmapV (pfrom, pto). In each turn, lines 6 and 7 modify the marking of vi as described in Definition 5.25(1). Some of the markings after modification would be duplicated and codes from line 8 to 10 deal with this situation by calling Merge as in Algorithm 4.3 with corresponding parameters. After Merge, the node represented by the first parameter and its connected arc(s) are deleted.
Otherwise, if mi[pto]>0, mi is added to MRGE in line 11.
For example, when the loop from line 3 to 13 selects v4, lines 6 and 7 modify m4 as m4 + m4[p4] * PCV.p1. Since m4[p1]>0, m4 is added to MRGE in line 11.
Proposition 5.3
Assume that the mergence from pfrom to pto is applied in PN and Algorithm 4.3 merges vx and vy correctly. Algorithm 5.12 modifies OG as OGE and generates MRGE correctly, i.e., OGE as defined in Definition 5.25 and MRGE as defined in Definition 5.26.
Proof:
The temporal occurrence graph defined in Definition 5.25 is calculated from line 3 to 13.
Algorithm 4.3 merges vx and vy correctly. Otherwise, if mi[pto]>0, mi is added to MRGE. Hence, the correctness of Algorithm 5.12 holds.
Theorem 5.1 (Correct O-graph Modification and Extension)
Algorithm 5.11 generates OG’ correctly when merging pfrom and pto, i.e. OG’ has the same characteristic as the one constructed from PN’ directly.
Proof:
From Proposition 5.3, Algorithm 5.12 modifies OG as OGE correctly. From Proposition 5.1, OGE is the subnet of OG’. From 4.8 and 4.9, the nodes and arcs generated by Algorithm 4.4 and 4.5 all belong to OG’ and the nodes and arcs belonging to OG’ but not OGE are all
generated by Algorithm 4.4 and 4.5. Hence, the correctness of Algorithm 5.11 holds.
Let t be the number of transitions in the Petri net, n be the number of vertexes in the input O-graph, and n’ be the number of vertexes in the result O-graph. In algorithm 5.12, it is assumed that all markings in the O-graph of the original net should be modified one time.
Thus, the loop from line 3 to 13 will run n times. Therefore, the complexity of Algorithm 5.12 is O(n). The complexity of Algorithm 5.11 is O(n + |n’- n|*t). Since designers usually edit the Petri nets sequentially, the complexity of Algorithm 5.11 is O(n + t).