Chapter 3. Matrix Approaches on CPNs
3.1 Two-dimensional Matrix Method
The proposed method is a concept of flattening. The information in matrices of three dimensions expressing input and output functions are flattened into the ones of two dimensions respectively. In Definition 2.6, it can be seen that the firing equation of a CPN is ∀p ∈ P: m'(p) = m(p) - I(p, t) + O(p, t). Hence, there are four matrices that need to be designed for describing the states and state transitions of a CPN. They are input matrix, output matrix, marking matrix and firing matrix.
Definition 3.1: Let G = <N, m0> be a CPN where N = (P, T, A, C, I, O), a marking is m, |P| = β and |C| = γ.
A marking matrix Q is a β × γ matrix describes the marking m. The entries in matrix Q are
qij = m(pi)(cj), where 1 ≤ i ≤ β, 1 ≤ j ≤ γ, pi ∈ P, cj ∈ C, and qij represents the entry in ith row and jth column of Q.
Definition 3.1 describes the format and content of a marking matrix of a CPN.
Each row in Q represents the tokens of each colour in a place, and each column in Q represents the token distribution of a colour on each place. In Definition 3.1, m(pi) represents the tokens on place pi, which is a multi-set over colour set C, hence m(pi)(cj) is the coefficient of colour element cj of m(pi), which means the number of tokens with colour cj on place pi.
Definition 3.2: Let G = <N, m0> be a CPN where N = (P, T, A, C, I, O), |P| = β, |T| = α and |C| = γ.
An input matrix B- is a β × n matrix describes the input function I, where n = αγ.
The entries in matrix B- are b-ij = I(pi, tr)(cs), where r =
⎡
j/γ⎤
, s = (j - 1) mod γ + 1, 1 ≤ i ≤ β, 1 ≤ j ≤ α × γ, 1 ≤ r ≤ α, 1 ≤ s ≤ γ, pi ∈ P, tr∈ T, cs∈ C, and b-ij represents the entry in ith row and jth column of B-. An output matrix B+ is a β × n matrix describes the output function O, where n
= αγ. The entries in matrix B+ are b+ij = O(pi, tr)(cs), where r=
⎡
j/γ⎤
, s = (j - 1) mod γ + 1, 1 ≤ i ≤ β, 1 ≤ j ≤ α × γ, 1 ≤ r ≤ α, 1 ≤ s ≤ γ, pi∈ P, tr∈ T, cs∈ C, and b+ij represents the entry in ith row and jth column of B+.In Definition 3.2, the input and output matrix of a CPN is defined. Each row in B-/B+ represents the token number of each colour that would be removed/deposited
from/into a place while each transition fires. Each column in B-/B+ represents the number of tokens with a colour that would be removed/deposited from/into each place while a transition fires. The operator “mod” in Definition 3.2 represents the modular arithmetic.
Definition 3.3: Let G = <N, m0> be a CPN where N = (P, T, A, C, I, O), |T| = α, |C| = γ, tr∈ T, and two markings are m1 and m2 such that m1 [tr> m2.
A transition firing matrix Xr is an n × γ matrix describes the firing transition tr, where n = αγ. The entries in matrix Xr are
⎡ ⎤
⎩⎨
⎧ = = − + =
= otherwise
i s where i
j and t t
xr if s r
ij 0
/ ,
1 mod ) 1 (
1 γ γ
, andxrijrepresents the entry in ith row and jth column of Xr.
Definition 3.3 describes how to indicate a firing transition of a CPN. On the other hand, a transition firing matrix Xr can be deemed as a column of α square sub-matrices, and each sub-matrix is a γ × γ matrix. The rth sub-matrix is an identity matrix, where tr is the firing transition, and the entries of others entries are all zero.
Lemma 3.1: Let G = <N, m0> be a CPN where N = (P, T, A, C, I, O), |P| = β, |T| = α,
|C| = γ, tr ∈ T, two markings are m1 and m2 such that m1 [tr> m2, Q1 and Q2 are the matrix representation of m1 and m2 respectively, B- and B+ are the matrix representation of I and O respectively, and Xr is the matrix representation of firing transition tr.
The state transformation between Q1 and Q2 would satisfy Q2 = Q1 - B-Xr + B+Xr.
In other words,
Q2 = Q1 - B-Xr + B+Xr iff ∀pi∈ P: m2(pi) = m1(pi) - I(pi, tr) + O(pi, tr).
Proof:
(→) Since, by Definition 3.3, Xr =
matrices square
r a
matrices square
r I
−
−
⎪⎭
⎪⎬
⎫
⎪⎭
⎪⎬
⎫
⎥⎥
⎥⎥
⎥⎥
⎥⎥
⎥
⎦
⎤
⎢⎢
⎢⎢
⎢⎢
⎢⎢
⎢
⎣
⎡
×
×
×
×
×
1
0 0 0 0
γ γ
γ γ
γ γ
γ γ
γ γ
M M
, where 0γ×γ
represents a γ × γ matrix whose entries are all zero, and Iγ×γ represents a γ × γ identity matrix, B-Xr will be a β × γ matrix, where (B-Xr)ij = b-is, s = (r - 1)γ + j, and (B-Xr)ij
represents the entry in ith row and jth column of B-Xr. Likewise, (B+Xr)ij = b+is. Since Q2 = Q1 - B-Xr + B+Xr, 1 ≤ i ≤ β, 1 ≤ j ≤ γ: q2ij= q1ij- (B-Xr)ij + (B+Xr)ij. Hence, 1 ≤ i
≤ β, 1 ≤ j ≤ γ: q2ij= q1ij- b-is + b+is, where s = (r - 1)γ + j. By Definition 3.1 and 3.2,
∀pi ∈ P, ∀cj ∈ C: m2(pi)(cj) = m1(pi)(cj) - I(pi, tr)(cj) + O(pi, tr)(cj). Hence,
∑
∑
= =+
−
=
∈
∀ γ γ
1 1
1 2( )( )' ( )( )' ( , )( )' ( , )( )'
:
j i j j i r j j i r j j
j i j j
i P m p c c m p c c I p t c c O p t c c
p .By
Definition 2.2, ∀pi∈ P: m2(pi) = m1(pi) - I(pi, tr) + O(pi, tr).
(←) Since m1 [tr> m2, by Definition 2.6, they satisfy ∀pi∈ P: m2(pi) = m1(pi) - I(pi, tr) + O(pi, tr). Hence, by Definition 2.2, ∀pi∈ P, ∀cj∈ C: m2(pi)(cj) = m1(pi)(cj)
- I(pi, tr)(cj) + O(pi, tr)(cj). By Definition 3.1 and 3.2, 1 ≤ i ≤ β, 1 ≤ j ≤ γ: q2ij= q1ij-
b-is + b+is, where s = (r – 1) × γ + jIII. By Definition 3.3, 1 ≤ i ≤ β, 1 ≤ j ≤ γ: q2ij= q1ij
-∑
×=
− ×
γ α
1 u
iu r
xuj
b +
∑
×=
+ ×
γ α
1 u
iu r
xuj
b IV, and therefore Q2 = Q1 - B-Xr + B+Xr.
The arithmetic in a state transformation equation, Q2 = Q1 - B-Xr + B+Xr, only contains the operations of matrix: addition, subtraction and multiplication. Lemma 3.1 proves that state transformation equation, Q2 = Q1 - B-Xr + B+Xr, conforms to the firing equation in Definition 2.6 by applying the matrix representations in Definition 3.1 to 3.3.
Definition 3.4: Let G = <N, m0> be a CPN where N = (P, T, A, C, I, O), |T| = α, |C| = γ, two markings are m and m', and there exists a firing vector σ such that m [σ> m'.
A firing matrix X is an n × γ matrix describes the firing vector σ, where n = αγ.
The entries in matrix X are
⎡ ⎤
⎩⎨
⎧ = − + = −
= otherwise
i s where i
j if xij ts
0
/ ) 1 ( ,
1 mod ) 1 ( )
( γ γ
σ ,
and xij represents the entry in ith row and jth column of X.
Definition 3.4 describes a sequence of state transformations and can be deemed as a generalization of Definition 3.3. A firing matrix X can be deemed as a column of α square sub-matrices. The sth square sub-matrix is an identical matrix scalar multiplied by σ(ts).
III By Definition 3.2, it should satisfy r =
⎡
s/γ⎤
and j = (s - 1) mod γ + 1.Lemma 3.2: Let G = <N, m0> be a CPN where N = (P, T, A, C, I, O), |T| = α, |C| = γ, two markings are m and m', and there exists a firing vector σ such that m [σ> m', Q and Q' are matrix representation of m and m' respectively, B- and B+ are matrix representation of I and O respectively, and X is the matrix representation of firing vector σ.
The state transformation between Q and Q' would satisfy Q' = Q - B-X + B+X.
Proof:
Assume the firing vector σ represents a finite occurrence sequence such that m [ts1> m1 [ts2> m2 … [tsn> m'. Hence, Q1 = Q - B-Xs1 + B+Xs1, Q2 = Q1 - B-Xs2 + B+Xs2, …, Q' = Qn-1 - B-Xsn + B+Xsn, where Xsi represents a transition firing matrix describing tsi. Hence, Q' = Q - B-Xs1 + B+Xs1 - B-Xs2 + B+Xs2 - … - B-Xsn + B+Xsn. Since all the operations in previous equation are matrix operations, it will obey the left distributive lawV in matrix operations, and hence Q' = Q - B-(Xs1 + Xs2 + … + Xsn) +
B+(Xs1 + Xs2 + … + Xsn). Since Xsi =
matrices square
si
matrices square
si I
−
−
⎪⎭
⎪⎬
⎫
⎪⎭
⎪⎬
⎫
⎥⎥
⎥⎥
⎥⎥
⎥⎥
⎥
⎦
⎤
⎢⎢
⎢⎢
⎢⎢
⎢⎢
⎢
⎣
⎡
×
×
×
×
×
α
γ γ
γ γ
γ γ
γ γ
γ γ
1
0 0 0 0
M M
, (Xs1 + Xs2
+ … + Xsn) is an n × γ matrix, where jth square matrix counted from the top of (Xs1 + Xs2 + … + Xsn) is an identity matrix multiply by the number of appearance of Xj in (Xs1
+ Xs2 + … + Xsn). Since each transition firing matrix in (Xs1 + Xs2 + … + Xsn) represents a transition, the number of appearance of Xj in (Xs1 + Xs2 + … + Xsn)
V
represents the number of appearances of tj in the firing vector σ, i.e. σ(tj). Therefore, the firing matrix X = Xs1 + Xs2 + … + Xsn and Q' = Q - B-X + B+X.
Lemma 3.2 proves that the state transformation equation of a finite occurrence sequence is Q' = Q - B-X + B+X by derived from Lemma 3.1. By the matrix representations proposed in Definition 3.1, Definition 3.2 and Definition 3.4 and the equation in Lemma 3.2, a CPN can be presented.