Discrete Dynamics in Nature and Society

Volume 2015 (2015), Article ID 579623, 15 pages

http://dx.doi.org/10.1155/2015/579623

## Deadlock Prevention Policy with Behavioral Optimality or Suboptimality Achieved by the Redundancy Identification of Constraints and the Rearrangement of Monitors

^{1}College of Electronics and Information, Xi’an Polytechnic University, No. 19 South Jinhua Road, Xi’an 710048, China^{2}School of Electro-Mechanical Engineering, Xidian University, No. 2 South Taibai Road, Xi’an 710071, China^{3}Faculty of Telecommunication Networks, Odessa National Academy of Telecommunications Named after A.S. Popov, Koval’ska Street 1, Odessa 65029, Ukraine

Received 22 May 2015; Accepted 20 September 2015

Academic Editor: Kamel Barkaoui

Copyright © 2015 Liang Hong et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

This work develops an iterative deadlock prevention method for a special class of Petri nets that can well model a variety of flexible manufacturing systems. A deadlock detection technique, called mixed integer programming (MIP), is used to find a strict minimal siphon (SMS) in a plant model without a complete enumeration of siphons. The policy consists of two phases. At the first phase, SMSs are obtained by MIP technique iteratively and monitors are added to the complementary sets of the SMSs. For the possible existence of new siphons generated after the first phase, we add monitors with their output arcs first pointed to source transitions at the second phase to avoid new siphons generating and then rearrange the output arcs step by step on condition that liveness is preserved. In addition, an algorithm is proposed to remove the redundant constraints of the MIP problem in this paper. The policy improves the behavioral permissiveness of the resulting net and greatly enhances the structural simplicity of the supervisor. Theoretical analysis and experimental results verify the effectiveness of the proposed method.

#### 1. Introduction

Deadlocks [1] always appear in the operations of a flexible manufacturing system (FMS). Hence, deciding how to reduce the impact of deadlocks is a very tricky problem that we have to cope with. Digraphs, automata, and Petri nets are three major mathematical tools to deal with deadlock problems in resource allocation systems.

Digraphs are used to deal with the deadlock detection and avoidance in [2, 3]. Researchers [4, 5] adopt automata as model tools to dispose the deadlock problem while Petri nets [6] are applied to model and analyze FMS. The main Petri net strategies are deadlock detection and recovery [7, 8], deadlock avoidance [9–11], and deadlock prevention [12–19].

This paper focuses our attention on deadlock prevention problems. A Petri net based deadlock prevention approach utilizes an off-line computational mechanism to impose constraints on a system to prevent the system from reaching deadlock states. Monitors (control places) and their related arcs are used to achieve such purposes and collectively called a supervisor of the plant model.

The theory of regions, as a technique to design supervisors for a Petri net, is adopted in [13, 20, 21]. Generally, the theory can lead to an optimal supervisor [22–28] if it exists. However, the theory is based on a reachability graph, which may cause state explosion with a net size increasing.

McMillan and Probst propose the concept of unfolding nets in [29] to describe the behavior of an FMS. A prefix of an unfolding net is adequate to completely describe the properties of a net, which is a concise but efficient method compared with the theory of regions. However, deciding how to find a complete and simple prefix is still worth consideration.

Siphons are special sets of places of a Petri net, by controlling which one can effectively prevent deadlocks. Ezpeleta et al. [12] propose a policy by enumerating siphons and impose constraints for the siphons to solve deadlock prevention problems. However, it is a time-consuming task with nets scale expansion [30]. In addition, behavioral permissiveness and structural complexity are tough issues that we have to face. Li and Zhou [14] propose elementary siphon theory, where enumerated siphons are divided into two parts: elementary and dependent. Monitors are only needed for the elementary siphons as long as the dependent siphons are controllable, which greatly reduces the structural complexity. Moreover, the computational complexity is reduced and the behavioral permissiveness is enhanced in the subsequent research [15, 31–38].

Huang et al. [39] propose a two-stage deadlock prevention policy for System of Simple Sequential Processes with Resources (S^{3}PR), a class of Petri nets that was proposed in [12]. The policy explores SMS based on the MIP technique, developed by Chu and Xie [40] for structurally bounded nets. For S^{3}PR, at the first stage, by the MIP technique, maximal unmarked siphon is obtained first if there exist deadlocks. SMS can be derived from the maximal unmarked siphon and a corresponding constraint, imposed on the complementary set of the SMSs to prevent it from being unmarked, is obtained enforcing the constraint to the MIP problem to check the liveness of the plant net under the constraint. If there still exists a maximal unmarked siphon, repeat the above process till the plant net is live under the derived constraints. Thus, we can obtain one or more constraints and add corresponding monitors (including their related arcs) to the complementary sets of the SMSs. Hence, the resulting net obtained after the first stage is a net consisting of the plant net and the corresponding monitors. Control-induced siphons (composed by operation places, resource places, and the monitors) can possibly be generated due to the addition of the monitors. The second stage, similar to the first one, is still an iterative process in finding siphons and the difference is that the monitors of this stage are added with their output arcs pointed to source transitions, which makes the control-induced siphons controlled and no problematic siphons were generated. The policy can usually lead to a more permissive supervisor than that proposed in [12].

However, there exist the following defects in [39]. First, the SMS obtained after an iteration is nondeterministic due to the following two reasons. The first is that the solution (corresponds to a maximal unmarked siphon) of the MIP problem is not unique and the second is that we can find different SMSs from the same maximal unmarked siphon via different place selection sequences. Thus, the sequence of the generation of SMSs is uncertain. Sometimes, SMS can be controlled if the subsequent SMSs are controlled. Hence, adding a monitor for the SMS is redundant and makes the control structure complex.

Second, at the second stage in [39], the constraint, mentioned at Step 17 of Algorithm of [39] and used for exploring the condition of liveness in the considered MIP problem, is imposed on the complementary set of new generated SMSs (derived from a control-induced siphon) while the output arcs of the constraint corresponding monitor are pointed to source transitions. It causes the fact that the constraints obtained at the second stage are always more than the necessary monitors. However, the number of added monitors for SMSs is requested consistent with that of the obtained constraints in terms of the policy, which leads to the fact that redundant monitors are generated and the behavioral permissiveness is generally restricted.

This work improves [39] in terms of structural complexity and behavioral permissiveness by the following three points. First, for removing the redundant constraints, an algorithm is developed that checks the redundancy of a constraint by deciding whether the liveness is preserved after its removal. This operation markedly reduces the structural complexity. Second, a new type of constraints is constructed to replace the one that emerged at Step 17 of Algorithm in [39] to reduce structural complexity and enhance behavioral permissiveness. The generation of redundant monitors is avoided by imposing the new constraint on the complementary set of newly generated SMSs and the set of its upstream places (defined in Definition 14), which makes the constraint have the same effect with the monitors added at the second stage on preventing the newly generated SMS from being unmarked. Third, for each output arc of the monitors added at the second stage, it is led from the source transition step by step to release more legal states on condition that the liveness is preserved. In summary, the improvements largely enhance the performance of a supervisor for a plant net.

The rest of this paper is organized as follows. Preliminaries used in this paper are presented in the next section. In Section 3, we introduce a deadlock prevention policy that mainly contains two phases: siphon control phase and extended siphon control phase. The specific method is shaped to an algorithm in Section 4. By experimental analysis, the performance of the proposed method is shown in Section 5. Finally, Section 6 concludes this paper.

#### 2. Preliminaries

##### 2.1. Basics of Petri Nets

A Petri net is a four-tuple , where and are the sets of places and transitions, respectively. is called a flow relation, represented by arcs with arrows from transitions to places or from places to transitions. is a mapping that assigns a weight to an arc: if , where , (or , ), and . If , , the net is called an ordinary Petri net; otherwise, it is called a generalized Petri net.

A marking (also called a state) is a mapping from to . The number of tokens in place is denoted by . A place is marked at a marking if . denotes the sum of tokens of all places in ; that is, , where . is marked at if . is unmarked at if . is called a net system and is called an initial marking of .

Let be a node of . is called the preset of and is called the postset of . Similar notation extended to a set of nodes is as follows: given , , , , and .

A nonempty set is called a siphon if . is minimal if there is no siphon in as a proper subset. is strict if .

A transition is enabled at a marking if, , and denoted as . Firing yields a new marking that can be denoted by and is called an immediately reachable marking from . A marking is said to be reachable from if there exists a sequence of transitions and markings , and such that holds. The set of markings reachable from in is called the reachability set of Petri net and denoted as . The set of legal states of net is defined as follows: .

A transition is live at if, , , . is live if, , is live at . It is dead at if , . It is deadlock-free if , , .

A -vector is a column vector indexed by and a -vector is a column vector indexed by , where is the set of integers. The column vectors where every entry equals are denoted by . is a integer matrix with . is the transposed versions of vector . -vector is called a -invariant if and and is the support of . is minimal if its support is not contained in the support of any other and its components are mutually prime. -invariant is a -semiflow if its every element is nonnegative.

##### 2.2. S^{3}PR

In this subsection, we introduce a class of Petri nets, called S^{3}PR, first defined in [12], which stands for* Systems of Simple Sequential Processes with Resources* and can model real-life automated FMSs.

*Definition 1 (see [12]). *An ordinary Petri net is called a state machine if, , . It is strongly connected if, , there is a sequence of nodes , and such that , and , where .

*Definition 2 (see [12]). *A simple sequential process (S^{2}P) is a Petri net , where is the set of operation places, is the idle process place, is a strongly connected state machine, and the circuit of contains .

*Definition 3 (see [12]). *A simple sequential process with resources (S^{2}PR) is a Petri net such that (1)the subnet generated by is S^{2}P,(2) and , where is called the set of resource places,(3), , , , ,(4)(a) , and (b), , ,(5).

*Definition 4 (see [12]). *S^{3}PR is a system of S^{2}PR, defined as follows: (1)An S^{2}PR is an S^{3}PR.(2)Let , , be two S^{3}PR such that , , and . Then, combine and via into a net . is also an S^{3}PR, defined as follows: (1) , (2) , (3) , (4) , and (5) .

Transitions in are called* source transitions*, which represent the entry of raw materials when FMS is modeled with an S^{3}PR.

*Definition 5 (see [12]). *For , is called the set of holders of , which represent the operation places that use . Let be siphon and ; is called the* complementary set* of .

Theorem 6 (see [12]). *An S ^{3}PR is live if, , , .*

Let be the set of SMSs in an S^{3}PR. The above theorem indicates that an S^{3}PR is live if there is no siphon that can be emptied.

##### 2.3. MIP Technique

Let be an ordinary net with and let be the maximal unmarked siphon at ; that is, , . In the sequel, we introduce a technique, first proposed in [40], to find in by exploring the solution of a mixed integer programming (MIP) problem. , let and, , let .

Since is a siphon and, , , any with and any with should be removed from the solution. Furthermore, , implies and, , implies the truth of . This leads to

For a structurally bounded net, we havewhere denotes the structural bound of place . Therefore, the maximal unmarked siphon can be determined by the following MIP problem and there exist siphons unmarked in if :subject to constraints (1)-(2) and

Although MIP problems are NP-hard, it is shown in [40] that its computational efficiency is relatively insensitive to the initial marking and more efficient than state enumeration methods.

Theorem 7 (see [40]). *Let be an ordinary Petri net with . is live if .*

Theorem 7 is used to check S^{3}PR whether liveness is enforced or not. If equals the cardinality of the place set of , it implies that is live.

However, the classical MIP problem to determine a maximal unmarked siphon in [40] only applies to ordinary Petri nets. As for a generalized Petri net, deadlocks may occur due to insufficiently marked siphons. Hence, the new conditions for checking whether there exist a maximal unmarked siphon in a generalized Petri net with are presented in [41], where a new constraint (5) is used to replace constraint (2):

The maximal unmarked siphon of a generalized Petri net can be determined by the following MIP problem and there exist unmarked siphons if :subject to constraints (1) and (5) and

Theorem 8 (see [41]). *Let be a generalized Petri net with . is live if .*

For a generalized Petri net , if equals the cardinality of the place set of , we can conclude that is live.

#### 3. Siphon Control Approach

In general, the presented method mainly contains two phases: siphon control phase and extended siphon control phase. The two phases are similar in finding siphons and the difference between them is the fashion of adding monitors for the siphons.

First, we apply the MIP technique to a plant net to obtain a maximal unmarked siphon (if there exists one), derive a minimal siphon from the maximal one by the minimal siphon extraction algorithm in [42], and check liveness by solving an MIP problem of the plant net after enforcing a constraint imposed on the complementary set of the minimal siphons. Repeat the above process until the plant net is live under a set of constraints. After removing redundant constraints by a proposed algorithm, we add monitors to the complementary sets of the minimal siphons according to the remaining constraints. If in the resulting net there still exists a deadlock, we conduct the next phase.

At the second phase, a newly presented constraint, different from the one claimed at Step 17 of Algorithm in [39], is enforced to the MIP problem of the resulting net of the first phase for preventing the system from reaching deadlock states. After iterations, we obtain a set of constraints and implement the constraints by adding monitors with the output arcs (with weights) pointing to the source transitions to avoid the generation of new problematic siphons. Then the output arcs of the monitors are rearranged to obtain a more permissive supervisor.

##### 3.1. Siphon Control Phase

At this phase, for modeling a maximally permissive supervisor as much as possible, a monitor for an SMS is designed to be imposed on the complementary set of the SMSs.

*Definition 9 (see [39]). *Let be an SMS in an S^{3}PR . A monitor for is added to to prevent from being unmarked such that(1); ,(2); , ,(3),where and denote the weights of related arcs of and denotes the initial number of tokens in .

Theorem 10 (see [43]). *The addition of for minimally restricts the behavior of a plant net.*

Definition 9 shows the fashion of adding a monitor for an SMS at the first phase. In the sequel, we should identify SMSs that need to be controlled.

In this study, the MIP technique is applied to iteratively find SMSs to avoid a complete siphon enumeration. For an S^{3}PR , an SMS can be found in by the MIP technique if it is not live. A constraint is enforced to the MIP problem of , which implies that cannot be unmarked any more in the MIP problem while the constraint minimally restricts the behavior of the plant net, where is a variable of the MIP problem and denotes the number of tokens in and is the number of tokens in at the initial marking. If is live under the constraint, we just need to enforce the constraint by adding a corresponding monitor to and end the first phase. Otherwise, we need to iterate and will obtain a set of constraints in the MIP problem, under which can never reach deadlock states.

However, if the number of constraints is more than one, there may be the case that not all the constraints are necessary. As mentioned in Introduction, some constraints can be replaced by the combination of other constraints and therefore they are redundant. Here, we propose an algorithm to exclude redundant constraints and the remaining ones are necessary.

Algorithm 1 eliminates redundancy by excluding a constraint each time. If the liveness is preserved after removing the constraint, we can conclude that the constraint is redundant and should be removed. Otherwise, it should be considered as necessary.