Partial Reachability Graph Analysis of Petri Nets for Flexible Manufacturing Systems

Petri nets are an important and popular tool to model and analyze deadlocks in flexible manufacturing systems. The state space of a Petri net model can be divided into two disjoint parts: a live-zone and a dead-zone. Reachability graph analysis plays an important role in the modeling and control of Petri nets. Most existing studies have to fully enumerate the reachable markings of a Petri net to obtain the first-met bad markings (FBMs), which exacerbates the computational overheads. In this paper, a computationally efficient method to find dead markings in Petri nets is presented. We first introduce an algorithm to find dead markings by solving an integer linear programming problem. Then, the set of markings in the dead-zone is calculated, including the set of dead markings and the set of bad markings. Then we can find all the FBMs. By using a vector covering approach, the minimal covered set of FBMs is computed. The proposed approach can obtain the dead markings and FBMs by searching only a part of a reachability graph. Finally, examples are provided to demonstrate the proposed method.


I. INTRODUCTION
Flexible manufacturing systems (FMSs) can automatically finish various kinds of jobs by using shared resources such as robots, machines, and automated guided vehicles. The survivability and competitiveness of an automated manufacturing system largely depends on whether it can produce lowcost, high-quality products of different varieties in a short development cycle [38], [42]. This makes the flexibility of the system more and more desirable to the survival of the system. In order to shorten product cycle and reduce product cost while ensuring product quality, FMSs came into being. An FMS is usually defined as a computer control system composed of a computer numerical control machine tool and a material transfer system, and can efficiently produce small and medium batch products. Due to the competition of limited resources, deadlocks may occur in such systems [1], [11], [14], [15], [37]. Deadlocks in a system usually mean that the whole system or a part of it is blocked [9], [10], [13], [41], resulting in a reduction in productivity and major economic losses, in some cases even catastrophic consequences. The description, analysis, control, and solution of deadlocks in The associate editor coordinating the review of this manuscript and approving it for publication was Guangdong Tian .
FMSs are undoubtedly essential to the realization and normal operation of system control. Therefore, it is necessary to handle deadlocks in these systems.
Several tools are used to deal with deadlocks in FMSs: graph theory, automata [27], and Petri nets [7], [8], [12], [16], [17], [21]- [23], [28], [35], [39], [40]. As a mathematical modeling and analysis tool, Petri nets can accurately and effectively model, analyze, and control FMSs. For a system, if we can construct its Petri net model and analyze it, we can reveal many important information about the structure and dynamic behavior of the described system. These information can be used to evaluate the performance of the system or to make suggestions for improving the design of the system. As a system model, Petri nets can describe the dynamic behavior of the system, for example, the state change of the system. Petri nets have intuitive graphical representations, and many mathematical methods can be introduced to analyze their properties. An FMS to be controlled is first modeled with Petri nets. Then, the deadlocks in the net model are analyzed and a supervisor is designed to prevent the occurrence of the deadlocks. A Petri net supervisor usually consists of control places, arcs, and transitions. The supervisor can enforce some conditions on the request of resources to ensure that deadlocks never occur. Petri nets are adopted for VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ detecting deadlocks of a system and developing a policy to prevent their occurrences. Many researchers use Petri nets as a formalism to deal with deadlock problems. For Petri nets, there are mainly two analysis techniques to deal with deadlock problems: structural analysis [18]- [20], [24], [25], [30], [31] and reachability graph analysis [5], [32]- [34]. Reachability graph analysis is an important technique to deal with the deadlock problem in Petri nets. The reachability graph of a net model can completely reflect the behavior and the evolution of a system. Uzam and Zhou [33], [34] classify a reachability graph into two parts: a live-zone (LZ) and a deadlock-zone (DZ), where DZ contains all illegal markings (deadlocks, livelocks, and bad markings that inevitably lead to deadlocks and livelocks), and the LZ includes all legal markings. An FBM is a node in the DZ, representing the very first entry from the LZ to the DZ. Once all FBMs are forbidden, the controlled system is live since it cannot enter the DZ anymore.
The concept of FBMs is widely studied in the literature. In [3], a vector covering approach is proposed to reduce the number of legal markings and FBMs that need to be considered. Then, an integer linear programming problem (ILPP) is formulated to design a control place to forbid a selected FBM. Meanwhile, constraints are designed to ensure that all legal markings are not prohibited. Finally, a maximally permissive Petri net supervisor can be obtained. In [4], the objective function of an ILPP is used to minimize the number of control places and constraints are designed to make all FBMs unreachable but no legal marking forbidden. Hence, a compact supervisor can be obtained which is optimized in both behavioral permissiveness and structural complexity. The work in [6] focuses on the design of a control place to forbid as many FBMs as possible. Then, an iterative approach is developed to obtain a supervisor to forbid all FBMs. This study can reduce the number of constraints in the ILPPs and lead to a maximally permissive supervisor with a small number of control places. In [2], by combining FBMs and structural analysis, a suboptimal Petri net supervisor can be obtained.
All the aforementioned papers deal with deadlocks in Petri nets by using the concept of FBMs. It is not efficient to find FBMs by generating the whole reachability graph since the number of reachable markings increases exponentially with the size of a net model. The traditional methods always need to enumerate all reachability graph, which exacerbates the computational overheads. Different from traditional methods, we propose a computationally efficient method to obtain the dead markings and FBMs in Petri nets by searching only a part of a reachability graph. We first find all generalized deadlock markings of a net model. A generalized deadlock marking is one satisfying the state equation and there exist some transitions cannot be enabled anymore. Through the generalized deadlock markings, we explore all the bad markings that will inevitably lead to some generalized deadlock markings. Once all bad markings are found, then we can define the boundary markings of DZ and LZ as the set of FBMs. By using the vector covering approach, a minimal covered set of FBMs are computed. Experimental results show that the obtained minimal covering set of FBMs are the same as the one obtained by the whole reachability graph analysis.
The rest of this paper is organized as follows. Section II briefly outlines the basics of Petri nets, structural analysis, and the reachability graph analysis used throughout this paper. An approach to enumerate all generalized deadlock markings is proposed in Section III. Section IV introduces an algorithm to compute the set of all generalized bad markings and the generalized FBMs. A number of Petri net examples are presented in Section V to show the experimental results. Finally, we conclude this paper in Section VI.

A. PETRI NETS (PNs)
A Petri net is a four-tuple N = (P, T , F, W ), where P and T are finite and nonempty sets. P is a set of places and T is a set of transitions with P ∩ T = ∅. F ⊆ (P × T ) ∪ (T × P) is called a flow relation of the net, represented by arcs with arrows from places to transitions or from transitions to places. W : (P × T ) ∪ (T × P) → N is a mapping that assigns a weight to an arc: W (x, y) > 0 if (x, y) ∈ F, and W (x, y) = 0, otherwise, where x, y ∈ P ∪ T and N is the set of nonnegative integers. If ∀f ∈ F, W (f ) = 1, a Petri net N is called an ordinary net; otherwise it is called a general net. · x = {y ∈ P ∪ T |(y, x) ∈ F} is called the preset of x and x · = {y ∈ P ∪ T |(x, y) ∈ F} is called the postset of x. M (p) denotes the number of tokens in place p. The pair (N , M 0 ) is called a marked Petri net or a net system. A net Let N = (P, T , F, W ) be a Petri Net and σ be a finite transition sequence. The Parikh vector σ is defined as σ : T → N that assigns the number of occurrences of transition t in σ , denoted as σ (t). For axample, t 1 = (10 · · · 0) T , t 2 = (010 · · · 0) T , . . . , t k = (000 · · · 01) T , k = |T |.
Equation (1) is called the state equation of Petri nets. It is only a necessary condition to judge the reachability of a marking. This means that any reachable marking satisfies the state equation, but the reverse is not true.

B. STRUCTURAL ANALYSIS
Structural analysis mainly studies the special structures in Petri nets such as places invariants, siphons, and resource loops. In a Petri net (N , M 0 ), a P-vector refers to such a column vector I : P → Z with place as a sequence mark. Similarly, a T-vector refers to such a column vector J : T → Z with transition as a sequence mark. P-vector I is called P-invariant (Place invariant, PI for short) if I = 0, and If there exist a P-invariant I in a Petri Net (N , M 0 ) and M ∈ R (N , M 0 ), we have: A P-invariant indicates a marking-invariant relationship, which holds at any reachable marking (state).
Definition 1: A set S is a Siphon if S ⊆ P and · S ⊆ S · .
(1) S is a minimal siphon if the true subset of S does not contain any other siphons.
(2) S is a strict siphon if · S ⊆ S · but · S = S · .
(3) S is a strict minimal siphon (SMS) if it is strict and minimal.

C. ANALYSIS OF A REACHABILITY GRAPH
A reachability graph can be partitioned into a deadlock-zone (DZ) and a live-zone (LZ) [33], [34]. The DZ contains deadlocks and critical bad markings that inevitably lead to deadlocks. The LZ contains all the legal markings, where the set of legal markings M L is the maximal set of reachable markings, from which it is possible to reach initial marking M 0 without leaving M L . Generally, the set of legal markings of a Petri net system (N , M 0 ) can be defined as follows: An FBM is the one within the DZ, representing the very first entry from the LZ to the DZ. Hence, we provide a mathematical form of the set of FBMs as follows: The set of dangerous markings, denoted as M D , can be defined as followings: From Eqs. (2)(3)(4)(5), we can see that the markings in M D may cause the appearance of bad or dead markings. Removing all dangerous markings from M L , the rest are called good markings. Therefore, the set of good markings M G can be defined as follows:

III. EFFICIENT COMPUTATION OF DEADLOCK-ZONE MARKINGS
For optimal deadlock control purpose, reachability graph analysis is generally used to find a Petri net supervisor. The main idea is to design a set of control places to forbid all FBMs. Then, all markings in the DZ cannot be reached. However, it is not efficient to find FBMs by generating the whole reachability graph. By combining siphon and state equation, we propose an approach to enumerate all FBMs by generating a part of a reachability graph.

A. GENERALIZATIONS OF REACHABILITY ANALYSIS
Let M and M be two markings of This equation means that we can get a pre-marking of M by reversing [N ]. The reverse transition enabled rules can be defined as follows:  If the structure and deadlock markings of a net model are known, we can get the bad markings and dangerous markings by converse transition enabled rules. We can find all deadlock-zone markings by searching a part of rather than the whole reachability graph.
We first provide an example to illustrate the idea of explore deadlock-zone markings from deadlock markings. Fig. 1 shows the reachability graph of a simple Petri net where M 13 and M 14 are dead markings.
The proposed converse searching process is described as follows. The deadlock-zone contains two markings M 13   Proof: Since M is a critical marking of S, we have M (S) = 0. Hence, for any p ∈ S, we have M (p) = 0. Then, for any t ∈ S · , M [t . Since S is a siphon, · S ⊆ S · . Hence, for any t ∈ • S, t ∈ S · and M [t . That is to say, no transition in S · can fire at M . Therefore, for any M ∈ M post M , M (S) = 0. Hence, we have for any t ∈ S · , M [t . Finally, we have for any t ∈ S · , for any M ∈ R (N , M ), M [t .
It can be seen that for any generalized deadlock marking, there exist some transitions that cannot be enabled anymore. For deadlock control purpose, the generalized deadlock markings should not be reachable.

B. COMPUTATION OF GENERALIZED DEADLOCK MARKINGS
This section presents an approach to find all generalized deadlock markings by P-invariants and strict minimal siphons of a net model. We formulate an integer linear programming problem (ILPP), namely, Find Dead-zone Marking (FDM), to calculate all the generalized dead markings of a Petri net. Let S j be a strict minimal siphon. An ILPP, namely, FDM(S j ) is formulated to find the critical markings of S j .
The objective function of the FDM(S j ) is defined as follows: In Eq. (8), M can be any marking that satisfies the state equation. Hence, M (p i ) is considered as a nonnegative integer variable of the ILPP. Since any finite integer can be represented by a set of binary variables, for a place p i ∈ P, if M (p i ) ≤ 2 n i − 1, we can use 2 0 y i,1 + 2 1 y i,2 + 2 2 y i,3 + . . . + 2 n i −1 y i,n i to replace M (p i ), where y i,1 , y i,2 , . . . , y i,n i are binary variables.
In this way, the objective function is converted into the following form: min f = p i ∈P 2 0 y i,1 + 2 1 y i,2 + . . . + 2 n i −1 y i,n i (9) Let (N , M 0 ) be a Petri net model with n p P-invariants I 1 , I 2 , . . . , I n p , and n s strict minimal siphons S 1 , S 2 , . . . , S n s . In order to find all the generalized deadlock markings, by Definition 6, we have the following constraints: By combining Eqs.
M (S j ) = 0 FDM(S j ) can be used to generate a critical marking of a siphon. In order to find all critical markings, we need to develop an iterative approach. At each iteration, a critical marking is computed by solving an ILPP and some constraints are added to eliminate the obtained siphons in the previous iterations.
Let y * i,k be an optimal solution of FDM(S j ). In the next iteration, we need to exclude the current solution to find a different critical marking. Let n i denote the number of variables y i,k 's for place p i . Then an additive constraint is shown as follows: .

Corollary 2:
No other feasible solution of FDM(S j ) is excluded by Eq. (14).
Proof: Let y i,k be a feasible solution to FDM(S j ) and there exists k ∈ {1, 2, . . . , n i }, y i,k = y * i,k . Then, we show that Eq. (14) does not exclude y i,k . Since there exists k ∈ {1, 2, . . . , n i }, That is to say, the solution y i,k satisfies Eq. (14).  while FDM(S j ) has a solution do 5.
Let M be the critical marking obtained from the solution of FDM(S j ). 6. out until FDM(S j ) has no solution. Hence, all critical markings of S j can be computed. Once all strict minimal siphons are dealt with, all generalized deadlock markings can be obtained.

IV. EXPLORATION OF DEADLOCK-ZONE MARKINGS
This section presents an algorithm to compute the set of generalized bad markings and the set of GFBMs.

A. COMPUTATION OF GENERALIZED BAD MARKINGS
The converse searching process consists of two steps. First, initially, let SetDZ = M GD and we compute the pre-markings of SetDZ . Then, by checking whether the post-markings of the new generated markings are generalized bad ones or not, we can decide the set of markings to be added to SetDZ . The other new generated markings are added to the set of undetermined markings, denoted as MDD. Second, for the undetermined markings, find the pre-markings of MDD and add the markings that satisfy the conditions for generalized bad markings SetDZ . Then, the rest new generated markings are added to MDD. This process is carried out until the markings in the MDD do not change. Fig. 2 shows the process to find all generalized bad markings from the set of generalized deadlock markings.
Algorithm 2 is developed to compute the set of generalized bad markings.
In Algorithm 2, SetDZ stores all deadlock-zone markings, SetPre stores the pre-set of SetDZ , and MDD stores the undetermined markings. By applying Algorithm 2, it is possible to obtain the set of all generalized dead markings SetDZ . Finally, all the undetermined markings in MDD are generalized dangerous markings. According to the set of generalized bad markings, we can compute the set of GFBMs as follows: From the viewpoint of deadlock control, once all GFBMs are forbidden, then no marking in M GB is reachable. When designing a Petri net supervisor to forbid GFBMs, a vector covering approach [3] can be used to reduce the number of markings to be considered, which can improve the efficiency of the deadlock control policies. The proposed algorithms calculate the generalized deadlock markings through P-invariants and strict minimal siphons. We first find all the generalized deadlock mark-

Algorithm 3 Computation of the Set of GFBMs and the Minimal Covered Set of GFBMs
Input: the set of dangerous markings SetMD and the set of dead markings SetDZ Output:the first-met bad markings SetFBM and the minimal covered set SetFBM * 1. SetPost = ∅ and SetFBM * = ∅.
ings. Then, by using a converse firing approach, we can find all generalized bad markings. Then, two kinds of border markings, generalized dangerous markings and GFBMs are obtained. Finally, by using a vector covering approach, we find the minimal covered set of GFBMs.
We consider the dead-zone markings as a multi-layered sets of markings. The upper layer consists of the union of the set of the pre-markings of the marking contained in its lower layer. The bottom layer is the set of deadlock markings, and there are no post-markings for them. The top layer set is the set of dangerous markings. The flowchart of the proposed algorithms is shown in Fig. 3.

V. EXPERIMENTAL RESULTS
This section provides some experimental results for the application of the proposed approach. We also do comparison on the efficiency between the proposed approach and the reachability graph analysis. Fig. 4 shows a Petri net with 11 places and 8 transitions. The set of idle places is P 0 = {p 1 , p 5 }, the set operation places is P A = {p 2 , p 3 , p 4 , p 6 , p 7 , p 8 }, and the set of resource places is P R = {p 9 , p 10 , p 11 }. The initial marking is M 0 =[3, 0, 0, 0, 3, 0, 0, 0, 1, 1, 1] T .
By solving FDM(S 2 ), there is no feasible solution. Hence, all critical markings of S 2 are generated.
Next, we formulate FDM(S 3 ) to find the critical markings of S 3 . To obtain FDM(S 3 ), we just need to replace y 3 + y 8 + y 9 + y 11 = 0 in FDM(S 2 ) by y 4 + y 7 + y 10 + y 11    It can be seen that the net model has five illegal markings and five FBMs. However, we generate seven generalized bad markings that are two more than the number of illegal markings. The reason is that there are two unreachable markings generated by the proposed method. However, it can be verified that M GF is equal to M FBM . Hence, from the point view of deadlock control, the proposed results are equivalent to the enumeration of all reachable markings.

B. EXPERIMENTAL RESULTS
In this section, we provide some experimental results to demonstrate the proposed approach. We develop software to implement the proposed algorithms in a 64-bit Windows operating system with a 2.60GHz CPU and 4GB RAM.
First, we apply the proposed approach to a well-studied example from the literature as shown in Fig. 5. The net model has 19 places and 14 transitions, where the places have the following partitions:P 0 = {p 1 , p 8 }, P A = {p 2 , p 3 , p 4 , p 5 , p 6 , p 7 , p 9 , p 10 , p 11 , p 12 , p 13 }, and P R = {p 14 , p 15 , p 16 , p 17 , p 18 , p 19 }. In order to show the results by generating the whole reachability graph, we use INA [29] as a tool to generate all the reachable markings.
The net model shown in Fig. 5 has only 251 reachable markings. Hence, we show more results by varying the initial  Figure 5.   Table 1, where the first column indicates the number of tokens in the places p 1 , p 8 , p 15 , p 18 , and p 19 at the initial marking, |M GB | represents the number of generalized bad markings, τ FDM indicates the time for the proposed approach, τ INA represent the time to generate the reachability graph by INA, |R(N , M 0 )| indicates the number of reachable markings, and |M GB |/|R(N , M 0 )|% represents the proportion of the number of generalized bad markings to that of reachable markings. Fig. 6 shows the results by the data in Table 1. It can be seen that, the proposed method only needs to generate a part of the reachable markings to find all generalized bad markings and GFBMs. Hence, the proposed approach is more efficient than the enumeration of all reachable markings.  Next, the proposed approach is tested by using randomly generated Petri nets of different sizes. The results are shown in Table 2, where the first column shows the size of the generated Petri nets represented by the numbers of places and transitions, |P| and |T |, respectively. Fig. 7 shows the experimental results of Table 2, which can compare the efficiency between the proposed approach and the whole reachability graph based method. The following conclusions are obtained from the experimental results: 1. The proposed approach is more efficient than enumeration of the whole reachable graph since it only generates a part of the reachability graph.
2. Experimental results show that the proposed method can obtain the same minimal covered set of FBMs as the reachability graph analysis. VOLUME 8, 2020

VI. CONCLUSION
In this paper, we first propose an algorithm to find all generalized deadlock markings of a Petri net by solving ILPPs. Then, we work out an algorithm to generate all generalized bad markings. Finally, we can compute all GFBMs and the minimal covered set of GFBMs. Experimental results show that the minimal covered covered set of GFBMs is the same as the minimal covered set of FBMs obtained by reachability graph analysis. Since the proposed approach only generates a part of the reachability graph, it is more efficient than the enumeration of the whole reachability graph. A number of examples are provided to show the efficiency of the proposed approach.
Although the proposed method can find the minimal covered set of FBMs, it cannot find the minimal covering set of legal markings. Hence, we cannot ensure the reachability of all legal markings when designing Petri net supervisors. In the future, we will consider to design a maximally permissive Petri net supervisor only by the minimal covered set of GFBMs.