ALGORITHM 6: M 0 CONSTRUCTION Input: M , n (number of tasks)
4.3 Complexity Analysis & Symbolic Computation using BDDusing BDD
4.3.2 Example for Symbolic Computation of Supervisor
Table 4.3: Comparison of number of states in supC(Lm(M0)): TDES vs BDD nodes
#Tasks[Range forEi: 10 to 25, Range forDi: 75 to 100]
2 10 15 20
#Processors TDES BDD TDES BDD TDES BDD TDES BDD
2 709 443 7,276 783 11,845 947 16,049 1,123
5 2,895 505 24,253 1,983 39,843 2,789 53,496 3,209 10 5,478 612 46,852 2,848 76,247 4,837 95,720 5,543
M0 that are not reached from the initial state q0. The resulting BDD χQs is same assupC(Lm(M0)) =Lm(M0)−Duc(L(T)−Lm(M0))Σ∗followed bytrim operation.
Table 4.3 presents the total number of TDES and BDD (implemented using CUDD [101]) states in the final supervisor. It can be observed that in general, the number of BDD nodes are much lower compared to the number of TDES states. Further, their differences widen with increase in tasks and/or processors.
4.3 Complexity Analysis & Symbolic Computation using BDD
BDD for the composite task execution model T using AND (∧) over individual task execution models and similarly, the computation of the BDD for the specification model H, 3. Computation of the BDD forM =T||H using ANDof the BDDs corresponding to T and H.
As these steps are straight forward [Miremadi et al. 2012], we start the demonstra- tion from Step 4. The BDD representation of M is shown in Figure 4.10. Here, each state is assigned with a unique 6-bit boolean vector and the corresponding decimal rep- resentation is shown within each state. For example, State 0 is encoded as h000000i.
Similarly, each event is assigned with a unique 4-bit boolean vector. For example, events a1,p1,tare assigned with boolean vectors h0000i,h0001iand h1011i, respectively. Each transition is represented by hs6s5s4s3s2s1 e4e3e2e1 s06s05s04s03s02s01i where, hs6s5s4s3s2s1i represents the source state,hs06s05s04s03s02s01irepresents the target state and he4e3e2e1irep- resents the event. For example, the transition from State 0 to State 1 on event a1 is represented by h000000 0000 000001i. To limit the figure size, only a few transitions have been shown explicitly using their boolean representations. Let the BDDs χQm and χM7→ represent the set of marked states Qm(={0,14}) and the transition relation ofM, respectively. Let us continue from Step 4 of the symbolic supervisor computation.
4a. Computation of BDD χQ0 representing all the states in χM7→ that are co-reachable to χQm: It uses PreImage(χQm, χM7→) to compute the set of states in M that in one transition can reach a state in χQm and it is repeated until the fix-point is reached. The Steps (i) to (v) given below explains the process of computing PreImage(χQm, χM7→).
i. Initialization: χQ0 := χQm, where χQm contains the set of marked states {0,14}.
ii. Swapping source and target state of a transition in χQ0: PreImage takes the set of marked states {0,14} and starts with State 0 which is represented as h000000 .... ...i (a . (dot) represents don’t care). The operation PreImage first assigns the value 000000 to the boolean variableshs06s05s04s03s02s01ithat are
used for encoding the target states, while the values of hs6s5s4s3s2s1i that are used for encoding the source states become don’t cares. So, the encoding of the marked state 0 becomesh... .... 000000i representing that the target state is 0.
iii. Conjunction of χQ0 and χM7→: The source and target states swapped version of BDD χQ0, is conjuncted with the BDD χM7→. This operation returns the set of transitions which contain the marked state 0 as a target state, i.e., {h001000 1011 000000i,h001001 1011 000000i,h100100 1011 000000i,h100101 1011 000000i, h100110 1011 000000i, h100111 1011 000000i, h101001 1011 000000i}.
iv. Extracting source states from the result of χQ0 ∧χM7→: Let us consider the transition h001000 1011 000000i representing h8, t,0i. From this transition, the source state is extracted usingexists, i.e.,∃E.ˆ Sˆ0.h001000 1011 000000i, where ˆE = he4, e3, e2, e1i and ˆS0 = hs06, s05, s04, s03, s02, s01i returns h001000 ....
...i which corresponds to State 8. In a similar manner, all the remaining source states will be obtained from the transition relation using∃E.ˆSˆ0.(χQ0∧ χM7→). This operation returns the following set of states: {h001000i,h001001i, h100100i,h100101i,h100110i,h100111i,h101001i}; the states are: {8,9,36,37, 38,39,41}.
Similarly, when the Steps (ii) to (iv) are applied for the marked state 14, the set of states{13,21,45}which can reach the marked state 14 through a single transition is obtained.
v. Continue until fix-point is reached: PreImage continues to iterate over the co-reachable states, until no more co-reachable states are found.
Finally, PreImage(χQm, χM7→)returns the BDD χQ0 representing the following set of states: {0,1,2,3, ..., 22,23,25, 26,27,28,34,35, ...,45}.
4b. Computation of BDD χblock representing blocking states in M: This can be done by computing the complement ofχQ0 against the universal set consisting of states
4.3 Complexity Analysis & Symbolic Computation using BDD
encoded from 0 to 63 (because 26 = 64). However, the numbers 0 to 53 only represent the valid states in M. Hence, the result of the complement will include invalid states from 54 to 63. Therefore, ¬χQ0 is conjuncted with the BDDχQ rep- resenting the states inM to discard the invalid states in¬χQ0. The resulting BDD χblock contains{29,30,31,32,33,46,47, ...,53}that represents the states leading to deadlock.
4c. Computation of BDD χQpi representing the subset of states in χblock having tran- sition with pi:
i. Compute the set of all transitions leading from states in χblock using (χM7→∧ χblock). This will return the following set of transitions: {h29, e1,2,33i,h29, c2,2, 30i, h30, t,31i,h31, e1,2,32i, h46, p2,47i,h47, c2,2,48i,h47, e1,2,51i, h51, t,52i, h52, c1,2,53i, h48, t,49i, h49, e1,2,50i}.
ii. Then, compute the BDD χpi7→ := (χM7→ ∧χblock) ∧χpi to filter out only the transitions on acceptance eventpi. It may be observed that there is only one transition emanating from the blocking states that contain acceptance event p2, i.e., h46, p2,47i. The resulting BDD χpi7→ represents the transition from State 46 to 47 on event p2, i.e., h101110 0111 101111i.
iii. From this transition, the BDD χQpi representing the source state is ex- tracted using exists, i.e., ∃E.ˆ Sˆ0.χpi7→, where ˆE = he4, e3, e2, e1i and ˆS0
=hs06, s05, s04, s03, s02, s01i returnsh101110i which corresponds to the state {46}.
4d. Computation of BDD χQai representing the subset of states in χM7→ having tran- sition with ai leading to χQpi:
i. Swap the source state in χQpi to target state: InχQp
2, the source state 46 has been changed to target state, i.e.,h... .... 101110i.
ii. Then, it is conjuncted withχM7→ and it results in the transitionh101010 0110 101110i which represents h42, a2,46i.
iii. Again, the resulting transition is conjuncted with χa2. Since, χa2 represents h...0110...i, the conjunction results inh101010 0110 101110iwhich is de- noted by the BDDχai7→. Here,h101010 0110 101110irepresents the transition from State 42 to 46 on event a2.
iv. From this transition, the BDDχQa
2 representing the source state is extracted using exists, i.e., ∃E.ˆ Sˆ0.χa27→, i.e., h101010i which corresponds to the state {42}.
4e. The rejection transitionr2is added from state 46 to 42 (i.e.,h101110 1001 101010i) and finally, it is added to the transition structure ofM by disjuncting it with the BDD χM7→. The resulting BDD is named as χM07→.
Re-computation of BDDs χQ0, χblock:
i. Re-compute the set of co-reachable states by invoking PreImage with χQm and χM7→0 . It returns the BDDχQ0 representing the following set of states: {0,1,2,3, ..., 22,23,25,26,27,28,34,35, ...,45,46}. It may be noted that state 46 has been in- cluded into the set of co-reachable states χQ0. This is because the addition of the rejection transition from State 46 to 42 makes state 46 to become co-reachable.
ii. Using this updatedχQ0, the BDDχblockis recomputed{29,30,31,32,33,47, ...,53}.
Since, state 46 has become co-reachable, it is not added to χblock.
5 Computation of BDDχQ00representing uncontrollable tails inχM7→0 : It usesPreImage-uc (χblock, χM7→0 ) to compute the states in M0 which can potentially lead to a dead- lock state via uncontrollable events and it is repeated until fix-point is reached.
i. Initialization: χQ00 :=χblock, whereχblockcontains{29,30,31,32,33,47, ...,53}.
ii. Swapping source and target state inχQ00: PreImage-uctakes the set of block- ing states {29,30,31, 32,33,47, ...,53} and starts with State 29 where it is represented ash011101 .... ...i(a . (dot) representsdon’t care). The opera- tionPreImage-ucfirst assigns the value 011101 to the target state, while the
4.3 Complexity Analysis & Symbolic Computation using BDD
source state becomes don’t care. So the encoding of state 29 becomes h...
....011101i, thus transforming it into a target state.
ii. Conjunction of χQ00 and χM7→0 : The source and target state swapped version of BDD χQ00, is conjuncted with the BDD χM7→0 . This operation returns the set of transitions which contain the state 29 as a target state, i.e., {h011100 1100 011101i} which represents the transition h28, f1,29i.
iii. Conjunction of (χQ00 ∧χM7→0 ) and χΣuc: The result of (χQ00 ∧χM7→0 ) is con- juncted with the BDDχΣuc to filter out the set of transitions containing the uncontrollable events. This operation retains the transition {h011100 1100 011101i}. This is because it contains the uncontrollable eventf1 (encoded as h1100i).
iv. Extracting source states from the result of(χQ00∧χM7→0 )∧χΣuc: From transition {h011100 1100 011101i}, the source state is extracted using exists, i.e.,
∃E.ˆ Sˆ0.χp27→, where ˆE = he4, e3, e2, e1i and ˆS0 = hs06, s05, s04, s03, s02, s01i returns h011100 .... ...i which corresponds to State 28. Similarly, the set of states which can reach the remaining states in χQ00 in one uncontrollable transition will be obtained.
v. Continue until fix-point is reached: PreImage-uc continues to iterate over the co-reachable states, until no more co-reachable states are found through uncontrollable transition.
Finally,PreImage-uc(χblock, χM7→0 )returns the BDDχQ00which contains{28,29,30, 31,32,33,47, ...,53}. It can be observed that χQ00 contains State 28 in addition to the states that are present in χQ0.
6 Compute the set of safe states Qs in M0: This can be obtained by removing the states that are present in χQ00 from M0. However, this will result in a scenario where some of the states in M0 are co-reachable to Qm, but not reachable from the initial state q0. Therefore, we use Image Restricted (χQ00, χq
0M0, χM7→0 ) to perform the restricted forward reachability search starting from the initial stateq0
of M0 which is represented by BDD χq
0M0. Here, the term restricted emphasizes that no state in χQ00 will be considered during the forward reachability search.
i. Initialization: Let χQs be the BDD representation of set of safe states Qs. InitializeχQs :=χq
0M0, where χq
0M0 contains {0}.
ii. Conjunction ofχQs andχM7→0 : χQs containsh000000.... ...irepresenting the initial state 0 ofM0 and it is conjuncted with the BDDχM7→0 . This operation returns the set of transitions which contain the state 0 as a source state, i.e., {h000000 0000 000001i}which represents the transition h0, a1,1i.
iii. Extracting target states from the result of (χQs ∧ χM7→0 ): From transition h000000 0000 000001i, the target state is extracted using exists, i.e., ∃E.ˆ S.(χˆ Qs∧χM7→0 ), where ˆE =he4, e3, e2, e1iand ˆS =hs6, s5, s4, s3, s2, s1ireturns h... ....000001i which corresponds to State 1.
iv. Conjunction of(χQs∧χM7→0 )and¬χQ00: This conjunction with the complement of χQ00 is performed to remove any state that is part of χQ00. Since, State 1 is not part of χQ00, it will be retained and added to the set of safe states χQs ={0,1}.
v. Continue until fix-point is reached: Image Restricted continues to iterate over the reachable states inχQs, until no more reachable states are found.
Finally, Image Restricted (χQ00, χq0M0, χM7→0 ) returns the BDD χQs representing the safe states inM0that are reachable from the initial state, i.e.,Qs={0,1, ...,27, 34, ...,37,42, ...,46}. This matches with thesupC(Lm(M0)) shown using thick lines in Figure 4.10.