One Computational Innovation Transition-Based Recovery Policy for Flexible Manufacturing Systems Using Petri Nets

Featured Application: This paper proposes one novel transition-based control policy to solve the deadlock problem of flexible manufacturing systems. This paper contains some acronyms. For easy tracking, their corresponding meaning is present in Appendix A. Abstract: In the third and fourth industrial revolutions, smart or artificial intelligence flexible manufacturing systems (FMS) seem to be the key machine equipment for capacity of factory production. However, deadlocks could hence appear due to resources competition between robots. Therefore, how to prevent deadlocks of FMS occurring is a very important and hot issue. Based on Petri nets (PN) theory, in existing literature almost all research adopts control places as their deadlock prevention mean. However, under this strategy the real optimal reachable markings are not achieved even if they claimed that their control policy is maximally permissive. Accordingly, in this paper, the author propose one novel transition-based control policy to solve the deadlock problem of FMS. The proposed control policy could also be viewed as deadlock recovery since it can recover all initial deadlock and quasi-deadlock markings. Furthermore, control transitions can be calculated and obtained once the proposed three-dimension matrix, called generating and comparing aiding matrix (GCAM) in this paper, is built. Finally, an iteration method is used until all deadlock markings become live ones. Experimental results reveal that our control policy seems still the best one among all existing methods in the literature regardless of whether these methods belong to places or transitions based.


Introduction
In the third and fourth industrial revolutions, smart or artificial intelligence flexible manufacturing systems (FMS) are much adopted for capacity of factory production. However, deadlocks could hence appear due to resources competition between robots [1]. Therefore, how to prevent FMS deadlocks occurring is a very important and hot issue. In the existing literature, automata theory [2,3], queueing theory [4,5], Petri nets theory [6], and state chart/flow [7] are all used as mathematical tools to process above deadlock problems of FMS. Among them, Petri nets (PN) have been recognized as the most powerful semantic-based tool to solve FMS's deadlock problem. The reason is that it is well suited to represent such discrete event dynamic system (DEDS) [8] characteristics such as precedence relations, concurrence, conflict and synchronization. Especially for FMS, the complexity resulting from the inherent nonlinearity and state space dimension found in most of these systems leads to unusual difficulty in design and analysis.
Reachability graph analysis can be used to design the optimal or maximally permissive deadlock prevention policy. In this approach, all reachable states of PN model are needed firstly to compute reachability graph. Although this technology could be a NP-hard problem since it needs to generate the reachability graph of a PN, it is still widely used to solve the deadlock problem of FMS. Whatever, this analysis owns maximally permissive controllers.
Under the method, Uzam firstly adopts the theory of regions [23] to design one optimal (maximally permissive) deadlock prevention based on the novel concepts of deadlock zone (DZ) and deadlock-free zone (DFZ). In the following, Ghaffari et al. [24] also design one optimal (maximally permissive) deadlock prevention by giving a redefinition of the theory of regions based on forbidden marking, dangerous marking, legal marking, and the set of marking/transition-separation instances (MTSI). For enhancing computational efficiency of the above two kinds of traditional theory of regions, Huang and Pan [31], and Huang et al. [32] propose one new optimal deadlock prevention using the concept of crucial marking/transition-separation instances (CMTSI).
For reducing computing time of the theory of regions, Uzam and Zhou [35] propose a reduction technique to simplify large FMS models. Huang and Pan also adopted the reduction approach to [36] so that the computational efficiency of CMTSI can be further enhanced.
On the other hand, Pirrodi et al. [37] consider selective siphons with reachability graph to reduce redundancy problems and provide small-size controllers. The control policy solves deadlock problems of FMSs successfully. It also makes FMSs optimal. However, as indicated by [38], the process of eliminating all critical markings is time consuming, since all legal markings must be checked in each iterative step. According to the above descriptions, it is clear that determining how to obtain optimal (maximally permissive) controllers for solving the FMS deadlock problem seems an extremely time-consuming and difficult issue.
For improving above disadvantage, Chen et al. [39][40][41] proposed one novel technology called MFFP (i.e., the maximal number of forbidding first bad marking (FBM) problem) to obtain maximally permissive reachable markings with very a smaller number of controllers based on Place Invariant (PI) [17] and reachability graph analysis methods. It successfully solves the problem of the excessive consumption of time. It is so pity, when the complexity of one flexible manufacturing system increases, the computational burden raises rapidly. Besides, under our survey the MFFP could just be applied in some special net, outside S 3 PR (The Systems of Simple Sequential Processes with Resources) [10] the method would be failed. Therefore, in author's previous paper [42] the author proposes one iterative deadlock prevention policy to circumvent its disadvantage of conventional MFFP. Besides, the author also proposes one computational improved deadlock concept called IMFFP [43] to enhance MFFP's computational efficiency.
Huang et al. [44] firstly introduced the concept of transition-based deadlock prevention policy in their paper, but not the optimal method yet, due to its manual designing process and low control efficiency documented in the expansion literature [45]. Both have the same feature, which helps little in larger and more complicated system [44,45].
In the following, Chen et al. [46] developed another transition-based control policy to obtain proper supervisors and propose two different kinds of concepts to recover the deadlock problem of FMS. The first one adopts iteration approach. At each iterative step, one integer linear programming problem (ILPP) is calculated to obtain a transition-based controller until all deadlock markings are recovered. The second stage is one-time skill that can find and pick up all transition-based controllers. Although Chen et al. claim that the policy can be applied to all classes of FMS, according to [47], it suffers from the computation complexity problem, since there are too many constraints and variables in the formulated ILPPs.
Besides, Bashir et al. [48] presented an iteration procedure to design a deadlock prevention policy via control transition constraints. In their work, the structural property of Petri net models is considered for preventing the state explosion problem in reachability graph analysis. Then the controlling transitions are generated and attached to the model to raise up system activity. Nevertheless, this method is still suboptimal since it does not recover system completely.
Row and Pan [49] propose one improved concept to solve system's deadlock problem based on [44]. This article presents an optimal transition-based recovering policy rather than existing method via control places, which just forbids undesirable deadlock states with disadvantage of reducing system liveness. The brand-new method helps accessing all reachable system states and each of them has activated-able transition, implying enough resources for providing competing process.
Dong et al. [47] also adopt the transition-based controllers to solve deadlock problem of FMS based on a vector intersection approach. Next, an iteration is used to calculate one small number of recovery controllers to recover all illegal markings.
Rather than preventing the system from accessing to undesirable state, in this paper the author firstly presents a new method to recover all deadlock markings by attaching control transitions (CT) to deadlock system. Within reachability graph analysis, transitions connect all reachable markings, in other words, a deadlock state could be re-directed to another legal state by adding a computed CT to the system rather than forbidding the deadlock state.
In order to recover deadlock system states, the author adopted the most effective CT for the system. To build the corresponding CT, one deadlock marking and one legal marking must be determined before the main computation, which denotes start and end points of CT in several systems. After two points have being chosen, CT could be calculated out with some simple processes. Experimental results reveal that the new method proposed in this paper is as good as existing methods in the literature. Section 2 describes the definitions of PNs and the properties of the reachability graph analysis. Sections 3 and 4 present the proposed theory and policy. Section 5 shows examples and relative experimental data. Finally, conclusions are made in Section 6.

Petri Nets (PN)
A Petri Net model is a five tuple = ( , , , , ), which is also a kind of directed model. and are two finite, nonempty and disjoint sets. is a set of places and is a set of transitions. ⊆ ( × ) ∪ ( × ) implies the set of arcs of this net, which is symbolized by arrows going from places to transitions or from transitions to places denotes a flow relation in the Petri Net model. ∶ ( × ) ∪ ( × ) → ℕ is a mapping that assigns a weight to an arc: ( , ) > 0 for each ( , ) ∈ , where , ∈ ( ∪ ) and ℕ is the set of non-negative integers. • = { ∈ ∪ |( , ) ∈ } is called the preset of x, and • = { ∈ ∪ |( , ) ∈ } is called the postset of . A marking is a multiset of Petri nets places, which allocates tokens to each place of a Petri net model. [⟩ is the set of reachable markings of net with initial marking , often denoted as ( , ). It can be graphically represented by a reachability graph, which can, in turn, be denoted as ( , ). It is a directed graph in which each node represents a marking in ( , ), and arcs are labeled by the fired transitions.
Let ( , ) be a net system with = ( , , , ) . A transition ∈ is live at if ∀ ∈ ( , ), ∃ ∈ ( , ), A P-vector is a column vector ∶ → ℤ indexed by . P-vector is called a P-invariant (place invariant, PI for short) if ≠ 0and [ ] = 0 . P-invariant is said to be a P semi flow if ≥ 0. Let be a PI of ( , ) and be a reachable marking from . Then, = .

Reachability Graph (RG) Analysis
In reachability graph (RG) analysis, all reachable markings can be divided into two main groups: legal and illegal markings. Illegal markings include deadlock and quasi-dead markings. In the above, the legal, illegal, deadlock, and quasi-dead markings can be defined as follows: The reachable markings except quasi-deadlock and deadlock markings are called legal markings. The set of legal markings ℳ in conventional deadlock prevention means the maximal number of reachable markings of one system, from which the initial marking is reachable without leaving ℳ . However, in this paper, it just represents the group of legal markings outside deadlock and quasideadlock markings. The set of legal markings ℳ can be defined as follows: of Definition 3 means the set of illegal markings. Therefore, the set of illegal markings ℳ can be defined as: Definition 5: A zone consisting of all dead markings is called a dead zone, denoted by ZD. Definition 6: A zone consisting of all quasi-dead markings is called a quasi-dead zone, denoted by ZQ.
Definition 7: A zone consisting of all quasi-dead and dead markings, i.e., ZI = ZD  ZQ, is called an illegal zone.
All markings except quasi-dead and dead markings are legal ones. Once a legal marking is enforced into the illegal zone, the net will eventually become deadlock.
Definition 8: A zone consisting of all legal markings is called a legal zone, i.e., ZL = R(N, M0) -ZI.
Please notice again, that in this paper, deadlock markings and legal markings are used in the proposed deadlock recovery policy. Besides, all markings will be identified in reachability graph analysis stage. Further, in the traditional deadlock prevention domain, the maximal permissive or optimal control means the maximal number of legal markings in a live system. In our recovery policy, our controllers will make all markings live including deadlock and quasi-dead markings. In other words, our designed policy recovers one deadlock system.

Basic Theory
Before designing CT, it is essential to spread out whole RG and determine the set of legal and deadlock markings. According to these two groups of markings, a three-dimensional matrix, called the generating and comparing aiding matrix (GCAM), is created to list all possible and effective CT. There are certainly two dimensions in GCAM, deadlock and legal markings. Note that only deadlock markings are considered in DZ, which includes deadlock and illegal markings, since trying to recover the latter will make more computational cost which is not necessary. This three-dimensional GCAM can be simplified as two-dimensional by regarding each transition as a single element. Creating GCAM helps numerating all effective CT, and the size of GCAM relies on the size of the model. The objective in this section is to find out the most effective CT in GCAM, hence, we have to compare every CT with each other. During creating GCAM, we define row as deadlock markings and column as legal markings. Note that the CTs in same row must be different, due to their same start point.
Within process of comparing CTs, if a CT matches any ones in the chosen row, this CT can also connect corresponding deadlock marking to else legal marking, then the rest of this row will be skipped. After whole comparing process, we choose the most recovered CT as supervisor in this iteration and do next one, until DZ becomes empty.

Leading Transitions
In reachability graph analysis, all reachable states are needed to be identified and connected by enabled transitions. Therefore, all enabled transitions play one important role in a Petri nets model. One marking changes to another marking by firing any enabled transition.
For example, there are two different markings belonging to the same reachability graph of a Petri nets model of FMS, which is shown in Figure 1. These two markings are connected by one arc labelling transition x. Under one marking , this model may have one or more enabled transitions including tx. Note that the transition tx must be enabled in , or the arc labeled with transition tx, which is shown in Figure 1, could not be generated within the reachability graph. When transition tx is activated in , the state will be fired to another marking , which is presented as the terminal of the arc tx in Figure 1. Therefore, in the reachability graph, and are connected with a singledirection arrow leading from to . Figure 2 is a PN model of FMS and its reachable graph is shown in Figure 3.   Figure 3. Generated reachability graph of Petri net model shown in Figure 2.
For easy tracking, the detailed information of all markings are shown in Table 1. Each marking in reachability graph is connected with existing transition, and each of its deadlock marking has no reachable marking. For example, in Figure 3, there are two markings, the legal marking and the dead marking , which are linked by transition . In other words, the legal marking M7 through the transition t5 is fired to the dead marking M14. In this case, = 7, = 14 and = is shown in Equation (1) as below: Equation (1) can be present in Equation (2): Similarly, some transition can also change the dead marking to the legal marking shown in Equation (3) as below: Therefore, a generated control transition can lead to and the computation can be simply presented shown in Equation (4) as below: Definition 9: One added transition between one legal marking and one deadlock marking is called the leading transition if = − .

Generating and Comparing Aiding Matrix (GCAM)
Huang et al. [44] control the PN model of FMS by adding control transition to recover all deadlock markings, though the control policy cannot afford too huge system and has more structural complexity. The proposed method can solve these two problems and either of the possibly occurring live-lock situations. This method compares all possible generated control transitions to find out the optimal one in each iteration until DZ becomes empty. A three-dimension matrix, also called the generating and comparing aiding matrix (GCAM), is built and helps comparing computation a lot. According to the set of legal and deadlock markings, GCAM is created, where the first dimension is deadlock markings, the second dimension is legal ones and the third dimension is − . Before building GCAM, the reachability graph analysis hence has to be done to partition the RG into legal, illegal and deadlock markings. For easy tracking, GCAM can be represented in simple model called simplified GCAM (SGCAM) in this paper. For example, the uncontrolled PN model of FMS shown in Figure 2 and Figure 3 has two deadlock markings, 15 legal markings and 11 places, then the size of its GCAM is 2 × 15 × 11. Tables 2 and 3 show its GCAM and SGCAM, respectively. Please notice that only the deadlock markings are adopted to build up the first dimension of GCAM rather than all illegal ones, because only deadlock ones need to be recovered and other illegal ones in DZ still have enough liveness. All control transitions in GCAM are compared with each other, and the computation complexity depends on the scale of the size of reachability graph and GCAM, precisely, about ( × ) times comparing would be executed in computation of an iteration.

Algorithm
The proposed deadlock control policy is presented in this section, which aims to raise up system liveness by recovering all undesired deadlock situations. Aforementioned techniques are summed up to designed effective supervisors. PN model in Figure 2 and its reachability graph shown in Figure  3 help demonstrating proposed method as following.
Definition 10: Let function ( ) denote the recovering efficiency of , which is used to recognize the most effective control transition in GCAM. The values of ( ) are possible zero or positive integer, and initially reset as zero before comparing comparison from to others. The value of ( ) increases by one when a deadlock is identified being solved by . After whole computation of , the value of ( ) indicates the number of deadlocks recovered by . This algorithm based on reachability graph analysis accordingly illustrates its maximally reachable graph at first. Notice that reachability graph will be calculated at each iteration, due to the LZ and DZ changes after attaching generated supervisors to system. Under provided control policy, generally, LZ extends and DZ reduces after every iteration. The presented approach aims to recover all existing deadlock markings, the set of legal and deadlock markings, are therefore, recognized in the reachability graph at the beginning within each loop.
After attaching new control transition (usually the most effective one) to PN model, a brand new reachability graph is illustrated due to its updated model. Although repeating analysis to generate reachability graph makes more computation heavy, the following process of designing supervisors is much more timesaving and systematic than other methods, such as MFFP (ILPP) [40], which is a kind of NP-hard problem.
Finally, please notice that building GCAM and SGCAM is extremely essential for the main comparing computation process. Viewing the entire recovery possibility of the whole system is clearer than generating a leading transition before each comparing process.

Experimental Results
This section will demonstrate our proposed deadlock recovery policy which is proposed in Section 4 through two classic S 3 PR [10] (the system of simple sequential process with resources) examples. Besides, for easy checking, the two examples used INA [63] and PN-Tools [64] to run their reachability graph, respectively.
Definition 11: An S 3 PR [10] is defined as the union of a set of nets Ni sharing common places, called resource idle places (i.e., called resource places in this paper) PRi, such that is a strongly connected state machine where = ( ∪ { }, , ) is the resultant net after PRi is removed from Ni ; (3) every circuit of contains the place and (4) any two are composable when they share a set of common resource idle places. In the above definition, is called the process idle place and Pi the set of operation places. The shall be called a process net. An S 3 PR has an important characteristic that only one shared resource is allowed at each operation state, i.e., a place in Pi is marked. The resource used in a state is released when the system moves to the next state. Since there are two prebuilt process competing resources in this example, deadlock states hence occur. Further, according to reachability graph analysis, the system's reachability graph consists of 20 reachable states in total, shown in Figure 3, including fifteen legal and five illegal markings (three quasi-dead markings, i.e., M5, M9 and, M10, and two deadlock markings, i.e., M14 and M15). Please notice that under our proposed transition-based recovery control policy, only deadlock and legal markings are needed to be considered, and are adopted to build its GCAM and SGCAM matrixes. Therefore, we show both of them in Tables 2 and 3, respectively. Furthermore, for easy tracking we show the GCAM matrix in PN places form. Based on Equation (3), each leading (control) transition can then be obtained under two deadlock markings and fifteen legal ones. For instance, , can be built by the two markings, { , }, shown in Equation (5) as follows:

Examples
In Equation (5), it is worthy note that the marking M1 belongs to ℳ and the marking M14 belongs to ℳ . Further, Equation (5) After the computation in Equation (6), the leading transition of , is equal to [2 − − − + + + + ]. It is also present in Table 2 (please refer to bold face). Note that all leading transitions in GCAM can be viewed as control transitions since they can recover their corresponding (relative) dead markings simultaneously. Furthermore, it means that they can recover the same dead markings once two sets or more of markings (one legal with one dead markings) in GCAM have the same leading transition.    In other words, it means that the set of leading transition can make the two deadlock markings M14 and M15 live and make this system recovery. Further, this system will be optimal controlled once the control transition tc is equal to [ − − + + + ]. Figure 4 shows that the control transition is added into the system. Further, all illegal (i.e., quasi-dead and deadlock) markings are recovered and become live as shown in Figure 5. In summary, the system has real maximal permissive states since all original 20 reachable markings are held totally.   [18]. Please note that due to the space limitation of this paper, we will not present the detailed information of CGAM, SCGAM, and all detailed process of seeking leading transitions. We just show the key information. Firstly, the properties of deadlock and legal markings in matrix form are present in Tables 4 and 5, respectively.

Marking
No.

Information of Markings [p1~p19]
Marking No.   In this example, we cannot merely use only one leading (control) transition to solve the system's deadlock problem and make the system recovery due to the complexity of this system. Under this situation, therefore, we must try to identify the least number of leading (control) transitions so that they can recover maximal number of deadlock markings.

Information of Markings
Accordingly, in the first iteration, there are 40 sets of leading transitions identified and they all can recover maximal eight same deadlock markings (i.e., M107, M172, M174, M211, M227, M249, M261, and M277), which are listed as follows (refer to Table 6): Table 6. The detailed information of all leading transition of Example 2 in first iteration. ] is chosen as the first control transition since it is the first one identified from CGAM. After the controller is added into this system eight deadlock markings are still left (i.e., 16  8 = 8). Therefore, we must run second iteration for recovering the other deadlock markings.

Leading Transition
In second reachability graph, eight deadlock markings and 246 legal markings are identified. Therefore, the new GCAM's size is: 8 × 246 × 19. In the following, accordingly, 25 sets of all leading transitions are identified since they all can recover the maximal five same deadlock markings, which are listed as follows (refer to Table 7): Table 7. The detailed information of all leading transition of Example 2 in second iteration. ] is chosen as the second control transition since it is the first one identified from CGAM. After the controller is added into this system, three deadlock markings are still left (i.e., 8  5 = 3). Therefore, we must run third iteration for recovering the other deadlock markings.

Leading Transition
In the third iteration, three deadlock markings and 276 legal markings are identified. Therefore, the GCAMs scale is: 3 × 276 × 19. Further, there are 81 sets of leading transitions identified and they all can recover final three deadlock markings. Due to the space limitation of this paper, the author just shows the first leading transition and it is [2 − − + 2 − − + + + + ]. Further, it is chosen as the third control transition. When the third control transition is added into the system with previous two controllers the system is deadlock free. Most importantly, the total reachable legal markings are 282. In other words, the three controllers recover the system. Figure 7 presents the controlled system of Figure 6 when the above three controllers is added into Example 2.

Conclusions
In existing research, the deadlock prevention policy seems to be the best technology among all strategies and is almost used to solve the FMS 'deadlock problems since it can check the deadlock situation in advance. Almost all of the research adopts places based as system controllers regardless of it they use structure methods or reachability graph analysis. However, all of them cannot make the optimal control even if they claimed that they can obtain maximally permissive controllers. Based on the above reason, in previous works [44,49,62], our teammates start to develop all kinds of control transitions deadlock prevention policies to solve the deadlock problem of flexible manufacturing systems. This research [44] is the first paper which adopted the concept of control transitions to solve the deadlock problem. The advantage of these strategies is that it can obtain more live states by adopting state equations. It is a pity that they cannot identify the optimal number of maximally permissive markings of the reachability graph of one FMS in advance although it does recover the deadlock system. In [49], the author proposed two different algorithms (i.e., "the all reachability graph viewpoint" and "the first deadlock marking viewpoint") to obtain recovery controllers. The two algorithms can not only obtain the correct optimal number of maximal reachable states firstly, but recovers all original illegal ones and makes them alive whatever these states initially belong to deadlock or quasi-deadlock ones. Besides, the number of controllers becomes six. It is better than [44]. In [62], the developed method can identify the maximal saturated tokens of idle places of one deadlock FMS in advance and still reserves all kinds of original markings. The really maximal permissive number of markings of one system's reachability graph can then be examined, once the saturated number of tokens in idle places is identified. Furthermore, the number of controllers is less with respect to [44,49]. Further, in this paper, the author adopts the developed CGAM to further reduce the number of controllers and relative arcs. Undoubtedly, this new policy in this research is evident better than almost existing literature. Preciously, the new policy is very simple and easy. In future work, the author will propose a new algorithm to further reduce the number of control arcs to make the real best one among existing literature.
Author Contributions: This research has only one author. The author has read and agreed to the published version of the manuscript.
Funding: This research does not receive any external funding.

Conflicts of Interest:
The author declares no conflicts of interest.