DSpace at VNU: Parallel combinatorial algorithms for multi-sets and their applications tài liệu, giáo án, bài giảng , lu...
International Journal of Software Engineering and Knowledge Engineering Vol 23, No (2013) 81À99 # c World Scienti¯c Publishing Company DOI: 10.1142/S0218194013400068 Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only PARALLEL COMBINATORIAL ALGORITHMS FOR MULTI-SETS AND THEIR APPLICATIONS HOANG CHI THANH Department of Computer Science VNU University of Science 334 - Nguyen Trai, Hanoi, Vietnam thanhhc@vnu.vn In this paper we extend some well-known notions of combinatorics on multi-sets such as iterative permutation, multi-subset, iterative combination and then construct new e±cient algorithms for generating all iterative permutations, multi-subsets and iterative combinations of a multi-set Applying the parallelizing method based on output decomposition we parallelize the algorithms Furthermore, we use these algorithms to solve an optimal problem of work arrangement and an extended knapsack one Keywords: Iterative combination; iterative permutation; multi-set; parallel algorithm Introduction The signi¯cant notions of combinatorics such as permutation, subset, arrangement, combination and partition etc are frequently used in many areas of computer science such as scheduling problems, system controls, data mining and networking [1, 3, 4, 6, 10, 12, 13, 16, 21] They become good tools to develop software and knowledge engineering The notion of set was extended to multi-set It is a set to which elements may belong more than once This extension sets up many new researches Multi-sets were employed in proving program correctness It is often used in information processing [7, 9, 15] and other problems The well-known notions of combinatorics are being transformed for multi-sets In this paper we ¯rst recall the notion of multi-set Then we extend the notion of permutation into iterative permutation, investigate its properties and construct an e±cient algorithm to generate all iterative permutations of a multi-set Applying the parallelizing technique based on the output decomposition presented in [8, 19, 20] we parallelize this algorithm To that, the sequence of desirable iterative permutations of a multi-set is divided into sub-sequences with \nearly" equal lengths by appropriate choice of pivots Using a common program (algorithm) with the corresponding 81 Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only 82 H C Thanh input and termination condition, processors will execute in parallel to generate iterative permutations of these sub-sequences Further, we apply the algorithm presented above for ¯nding the optimal solution of a work arrangement problem Analogously, we extend the notion of subset into multi-subset and combination into iterative combination Some new e±cient algorithms for generating all multisubsets, k-element multi-subsets and iterative k-combinations of a multi-set are constructed and parallelized Then we apply the algorithms to an extended knapsack problem The newly constructed algorithms are based on our inheritance principle and bounded sequences generation These algorithms take part in developing combinatorial computing, software technology and especially in knowledge engineering [5, 11] They refer to the building and development of knowledge-based systems The rest of this paper is organized as follows In Sec we recall the notion of multi-set Section presents the notion of iterative permutation and constructs a new e±cient algorithm based on lexicographical order for generating all iterative permutations of a multi-set and then parallelizes the algorithm Section is devoted to multi-subsets, an algorithm generating multi-subsets and its parallelism Section presents iterative combinations of a multi-set with generation algorithm Using algorithms presented above, two optimization problems are solved in Sec Finally, some directions for future research are proposed in the conclusions Multi-sets 2.1 De¯nition of multi-set Multi-set is an extended notion of standard set [9, 15] and is de¯ned as follows De¯nition A multi-set is an unordered collection of elements in which elements are allowed to be repeated For example, a set of values of all variables in a program, a marking of a net system [14] etc., are typical examples of multi-sets A multi-set is written as follows: X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ; where ki ! with i ¼ 1; 2; ; n: It means, there are k1 elements x1 , k2 elements x2 , … and kn elements xn in the multiset X Elements x1 ; x2 ; ; xn are called basic elements of the multi-set X, and k1 ; k2 ; ; kn as the multiplicity of the corresponding element The cardinality of a multi-set is the sum of multiplicities of all its basic elemens, n X jXj ¼ ki : i¼1 A multi-set is called regularif all of its element' multiplicities are the same Parallel Combinatorial Algorithms for Multi-Sets and Their Applications 83 2.2 Operations on multi-sets Let A ¼ ðt1 à x1 ; t2 à x2 ; ; tn xn ị and B ẳ q1 x1 ; q2 à x2 ; ; qn à xn Þ be two multi-sets 2.2.1 Multi-subsets De¯nition We say that A is a multi-subset of B i® the multiplicity of each element in A is not greater than the multiplicity of the element in B, i.e Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only A B , i ¼ 1; 2; ; n : ti qi : Thus, each multi-subset A ¼ ðt1 à x1 ; t2 à x2 ; ; tn à xn Þ of the multi-set X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ must satisfy: ti ki ; i ¼ 1; 2; ; n 2.2.2 Power multi-set De¯nition The power multi-set of a given multi-set X, denoted by ðXÞ, is the set of all multi-subsets of X 2.2.3 Union De¯nition The union of two multi-sets A and B, denoted by A [ B, is the multiset C ¼ ðp1 à x1 ; p2 à x2 ; ; pn xn ị, where pi ẳ maxti ; qi ị; i ẳ 1; 2; ; n 2.2.4 Intersection De¯nition The intersection of two multi-sets A and B, denoted by A \ B, is the multi-set D ¼ ðr1 à x1 ; r2 à x2 ; ; rn à xn Þ, where ri ẳ minti ; qi ị; i ẳ 1; 2; ; n 2.2.5 Di®erence De¯nition The di®erence of two multi-sets A and B, denoted by AnB, is the multi-set H ¼ ðs1 à x1 ; s2 à x2 ; ; sn xn ị, where si ẳ maxti qi ; 0ị; i ẳ 1; 2; ; n 2.2.6 Lattice of multi-subsets Including relation on multi-subsets of a given multi-set X is a partial ordering For every two multi-subsets A and B in ðXÞ we de¯ne their supremum (sup) and in¯mum (inf ) as follows De¯nition For every two multi-subsets A and B in ðXÞ, supA; Bị ẳ A [ B and infA; Bị ẳ A \ B: The power multi-set ðXÞ equipped two operations sup and inf becomes a distributed lattice 84 H C Thanh Iterative Permutations 3.1 Notion of iterative permutation We extend the notion of permutation of a multi-set as follows De¯nition An iterative permutation of a multi-set is a checklist of all its elements Consider the following example Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only Example Given a multi-set X ¼ ð2 à a; à b; à cÞ Iterative permutations of X are sorted by lexicographical order in Table It is easy to show that the number of all iterative permutations of a multi-set X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ is cl ¼ k1 !k2l!! kn ! , where l is the cardinality of X Table Iterative permutations of the multi-set X No Iterative permutations aabc aacb abac abca acab acba baac baca bcaa 10 caab 11 caba 12 cbaa 3.2 Iterative permutation generation algorithm Iterative permutation problem Given a multi-set X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ, with ki ! 1i ẳ 1; 2; ; nị Find all iterative permutations of X In other words, we have to construct an e±cient algorithm for generating all iterative permutations of this multi-set It is easy to see that bijection is not suitable to represent iterative permutation So we have to ¯nd another representation Identify the elements x1 1; x2 2; ; xn n Each iterative permutation of the multi-set X is represented by an integer sequence of the length l, consisting of k1 integers 1, k2 integers 2, … and kn integers n Now we ¯nd all these integer sequences Parallel Combinatorial Algorithms for Multi-Sets and Their Applications 85 Each integer sequence may be considered as a word on the alphabet f1; 2; ; ng So we sort these words increasingly by lexicographical order — The ¯rst word (the least) is 11 1ffl} 22 2ffl} |fflfflfflffl{zfflfflfflffl} nn n It is a non-decreasing |fflfflfflffl{zfflfflffl |fflfflfflffl{zfflfflffl k1 k2 kn sequence — The last word (the most) is |fflfflfflffl{zfflfflfflffl} nn n |fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1n Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1ffl} 11 1ffl} It is a non|fflfflfflffl{zfflfflffl kn k1 knÀ1 Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only increasing sequence and is indeed the reverse of the ¯rst one Starting with the ¯rst iterative permutation, our algorithm repeats a loop to ¯nd the remaining iterative permutations Assume that t ¼ a1 a2 alÀ1 al is an iterative permutation We have to ¯nd the iterative permutation t ¼ a 01 a 02 a 0lÀ1 a 0l next to t in the sorted sequence Because of lexicographic order, the iterative permutation t is inherited the longest left part possible of the iterative permutation t from the ¯rst component to the component indexed pÀ1; where the changing position p is the maximal index i, such that < aiỵ1 Thus: p ẳ maxfij1 i l ^ < aiỵ1 g (p) t a1 ap-1 ap ap+1 t’ a1 ap-1 a’p a’p+1 al a’l Fig Inheritance of iterative permutations It is easy to see that the sub-sequence hapỵ1 ; apỵ2 ; ; al i is a non-increasing sequence The changing part in the iterative permutation t from the position p to the last is determined as follows: 1) a 0p is the least among all elements in the subsequence hapỵ1 ; apỵ2 ; ; al i but greater than ap We swap ap for this element: ap $ minfai jp ỵ i l ^ > ap g Note that if there are several least elements we choose the element with the greatest index It ensures that after swapping the sub-sequence hapỵ1 ; apỵ2 ; ; al i still is a non-increasing sequence 2) Reverse the sub-sequence hapỵ1 ; apỵ2 ; ; al i The result is a non-decreasing sequence It is indeed the sub-sequence 0pỵ1 ; a 0pỵ2 ; ; a 0l i in the iterative permutation t Our algorithm terminates when the last iterative permutation was generated At that time, the changing position p is equal to We have Algorithm Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only 86 H C Thanh Complexity of the algorithm: — Instructions 2–3 input data with the complexity O(nÞ — Instructions 4–5 calculate the number of elements and assign the ¯rst iterative permutation with the complexity O(lÞ — Loop 7–14 computes and prints an interative permutation, where: Instruction prints an interative permutation with the complexity O(lÞ Loop locates the changing position p with the complexity O(lÞ Instructions 11–13 ¯nd the element a 0p and swap it for ap with the complexity O(lị Instruction 14 reverses the sub-sequence hapỵ1 ; apỵ2 ; ; al i with the complexity O(lÞ So the complexity of generating an iterative permutation is O(lÞ The total complexity of Algorithm is O(cl :lÞ 3.3 Parallel algorithm generating iterative permutations For the iterative permutation problem, we know the number of all desirable solutions and their arrangement in the sequence sorted by lexicographic order So we can split the sequence into sub-sequences and use a common program (algorithm) in a parallel computing environment to ¯nd concurrently the sub-sequences Therefore, Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only Parallel Combinatorial Algorithms for Multi-Sets and Their Applications 87 Fig The model of the parallel computing organization to ¯nd the problem's solutions the amount of time required for ¯nding all desirable solutions will be drastically decreased by the number of sub-sequences To perform the above parallel computing we split the sequence of all desirable solutions into sub-sequences The number of sub-sequences depends on the number of calculating processors Let us split the sequence of all solutions of the problem into m sub-sequences (m ! 2) The model of the parallel computing organization to ¯nd the problem's all solutions is illustrated as in Fig This model is an illustration of the following Condition/Event system [14, 17]: Fig The Condition/Event system representing the above parallel computing model It is clear that events e1 ; e2 ; ; em can be executed concurrently in this system In order to make the parallel computing organization realistic and optimal, the sub-sequences of solutions should be satis¯ed for the following two criteria: (1) It is easy to determine the input and the termination condition for the computing process of each sub-sequence (2) The di®erence of lengths of the sub-sequences is the less, the better Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only 88 H C Thanh Of course, Input is indeed the input of the problem and last termination condition is the termination condition of the algorithm The ¯rst criterion ensures that the splitting of solutions sequence is realistic In many cases, we can use (a part of) the input of the computing process for the next sub-sequence as the termination condition of the computing process for the previous sub-sequence The second criterion implements the balance of computing to processors Then the parallel computing processes become optimal Applying the parallelizing technique presented above we parallelize Algorithm To so, we split the sequence of all desirable iterative permutations of a multi-set into m sub-sequences (m ! 2), such that lengths of the subsequences are \nearly" equal The number m depends on the number of processors the computing system devotes to computing Each sub-sequence will be generated by one computing process executed on one processor So input and termination condition for each computing process must be already determined This parallelizing method is an illustration of the output decomposition technique in parallel computing [8, 19, 20] For simplicity of presentation we perform with m ¼ With greater values of m one can analogously: Assume that n ! This assumption makes our splitting realistic We split the sequence of all sorted diserable iterative permutations into sub-sequences with \nearly" equal lengths by appropriate choice of the two following basic elements: ( )! q X l r ¼ max 1; max q ki and i¼1 ( )! q X l s ẳ max r ỵ 1; max q : k iẳrỵ1 i The rst pivot chosen is the rst iterative permutation of a block, whose ¯rst element is r þ It is: r þ |fflfflffl 11ffl{zfflfflffl 1ffl} 22 2ffl} rr r r| ỵ 1r ỵ{z r ỵ 1} r|{z} ỵ 2r þ 2r þ nn n : |{z |{z} |{z} k1 k2 kr krỵ11 krỵ2 kn It becomes the input of the second computing process The second pivot chosen is the ¯rst iterative permutation of a block, whose rst element is s ỵ It is: s þ |fflfflffl 11ffl{zfflfflffl 1ffl} 22 2ffl} ss s s| ỵ 1s ỵ{z s þ 1ffl} s|fflfflfflfflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflfflfflfflffl} þ 2s þ 2s þ nn n : |fflfflfflffl{zfflfflffl |fflfflffl{zfflfflffl} |fflfflfflffl{zfflfflfflffl} k1 k2 ks ksỵ11 ksỵ2 kn and it becomes the input of the third computing process The last iterative permutation of the ¯rst sub-sequence is indeed the last in a block, whose ¯rst element is r Parallel Combinatorial Algorithms for Multi-Sets and Their Applications 89 Then it is the following iterative permutation: r |fflfflfflffl{zfflfflfflffl} nn n |fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1n Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1ffl} r| ỵ 1r ỵ{z r ỵ 1} kn kn1 krỵ1 rr r r|fflfflfflfflfflfflfflfflfflfflfflfflfflfflffl À 1r Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl r À 1ffl} 11 1ffl} : |fflfflfflffl{zfflfflffl |fflfflffl{zfflfflffl} Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only krÀ1 k1 krÀ1 So the termination for the rst computing process is: Aẵ1 ẳ r ^ p ¼ The last iterative permutation of the ¯rst sub-sequence is indeed the last in a block, whose ¯rst element is s It is just the following iterative permutation: s |fflfflfflffl{zfflfflfflffl} nn n |fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1n Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1ffl} s| ỵ 1s ỵ{z s þ 1ffl} kn knÀ1 ksþ1  ss s s|fflfflfflfflfflfflfflfflfflfflfflfflfflfflffl À 1s Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl s À 1ffl} 11 1ffl} : |fflfflfflffl{zfflfflffl |fflfflffl{zfflfflffl} ksÀ1 k1 ksÀ1 Thus, the termination for the second computing process is: Aẵ1 ẳ s ^ p ¼ The sequence of all iterative permutations of the multi-set X is divided into three sub-sequences as in Table These three sub-sequences are generated concurrently by three parallel computing processes, with the corresponding input and termination condition, executed Table Three sub-sequences of iterative permutation of the multi-set X Subsequence Iterative permutations 2ffl} ii ffli} nn n 11ffl{zfflfflffl 1ffl} 22 |fflfflfflffl{zfflfflffl |fflfflffl |fflfflffl.{zfflffl |fflfflfflffl{zfflfflfflffl} k1 k2 ki kn ÁÁÁ r nn n |fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1n Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n 1} | r ỵ 1r þffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl r þ 1ffl} |fflfflffl{zfflfflffl} rr r |fflfflfflfflfflfflfflfflfflfflfflfflfflfflffl r À 1r Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl r À 1ffl} |fflfflffl 11{z 1} |{z} kn kn1 kr1 krỵ1 k1 kr1 r ỵ 11 1} |fflfflffl 22ffl{zfflfflffl 2ffl} rr r | r ỵ 1r ỵ{z r ỵ 1} |{z} r ỵ 2r þ 2r þ nn n |fflfflfflffl{zfflfflffl |{z} |{z} k1 k2 krỵ11 kr kn krỵ2 s nn n |fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1n Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1ffl} | s ỵ 1s ỵ{z s ỵ 1} ss s | s À 1s Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl s À 1ffl} 11 1ffl} |fflfflfflffl{zfflfflffl |fflfflfflffl{zfflfflfflffl} |{z} kn kn1 ks1 ksỵ1 k1 ks1 s ỵ |fflfflffl 11ffl{zfflfflffl 1ffl} |fflfflffl 22ffl{zfflfflffl 2ffl} ss s | s ỵ 1s ỵ{z s ỵ 1} |{z} s ỵ 2s ỵ 2s ỵ nn n |fflfflffl{zfflfflffl} |fflfflfflffl{zfflfflfflffl} k1 k2 ksỵ11 ks ksỵ2 nn n | n À 1n Àffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl n À 1ffl} |fflffl iiffl.{zfflffl ffli} |fflfflffl 11ffl{zfflfflffl 1ffl} |fflfflfflffl{zfflfflfflffl} kn knÀ1 ki k1 kn Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only 90 H C Thanh concurrently on three processors P1 , P2 and P3 as follows: Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only Parallel Combinatorial Algorithms for Multi-Sets and Their Applications 91 So the time for generating all iterative permutations of a multi-set reduces to onethird Multi-Subset Problem As mentioned above, each multi-subset A ¼ ðt1 à x1 ; t2 à x2 ; ; tn xn ị of the multiset X ẳ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ must satisfy: ti ki ; i ¼ 1; 2; ; n So we have the following problem Problem: Given a multi-set X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ Find all multi-subsets of X Q The number of all multi-subsets of the multi-set X is niẳ1 ki ỵ 1ị A multi-subset A ¼ ðt1 à x1 ; t2 à x2 ; ; tn à xn Þ may be represented by the integer sequence ht1 t2 tn i 4.1 Bounded sequence algorithm generating multi-subsets In order to solve the multi-subset problem we recall the bounded sequence problem presented in [18] as follows: Given two integer sequences of the length n; s ¼ hs1 s2 sn i and g ¼ hg1 g2 gn i, such that s g Find all integer sequences t ¼ ht1 t2 tn i with the length of n, satisfying s t g 92 H C Thanh Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only The multi-subset problem may be derived to the bounded sequence problem with two boundary sequences s ¼ h00 0i and g ¼ hk1 k2 kn i Applying the algorithm generating bounded sequences presented in [18] we have the following short algorithm for the multi-subset problem Complexity of the algorithm: Loop ¯nds the changing position i with the complexity OðnÞ So the complexity Q of Algorithm is Oðn: ni¼1 ki ỵ 1ịị 4.2 Parallel algorithm generating multi-subsets Applying the parallelizing technique presented above, we split the sequence of all multi-subsets into m sub-sequences Assume that m k1 ỵ We divide the integer segment [0, k1 ] into m \nearly equal" sub-segments Let denote p ẳ k1 ỵ 1ị div m and q ẳ k1 ỵ 1ị mod m The processor jðj ¼ 1; 2; ; mÞ ¯nds all multi-subsets, where the multiplicity t1 belongs to the sub-segment j Hence, we assign new values for S[1] and G[1] as follows: & ðj À 1Þ Á ðp ỵ 1ị; if j q Sẵ1 ẳ q ỵ j 1ị p; otherwise and & Gẵ1 ẳ Sẵ1 þ p; if j q : S½1 þ p À 1; otherwise The algorithm for the processor jðj ¼ 1; 2; ; mÞ is the following Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only Parallel Combinatorial Algorithms for Multi-Sets and Their Applications 93 The complexity of Algorithm The length of a sub-sequence of multi-subsets computedÀ by the processor Á j is near Q Qn n to m1 niẳ1 ki ỵ 1ị So the complexity of Algorithm is O m k ỵ 1ị iẳ1 i Iterative Combinations Let X be a multi-set and k be a non-negative integer We extend the notion of combination on multi-sets as follows De¯nition An iterative k-combination of the multi-set X is a selection of k elements from the multi-set X Thus, each iterative k-combination of the multi-set X is indeed a k-element multisubset of X Iterative combination problem Given a multi-set X Find all iterative k-combinations of the multi-set X The problem may be derived to ¯nding all k-element multi-subsets of X Assume that X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ, where ki ! with i ¼ 1; 2; ; n An k-element multi-subset of X; A ¼ ðt1 à x1 ; t2 à x2 ; ; tn à xn Þ must satisfy the following system of linear in-equations: & ti ki ; i ¼ 1; 2; ; n : 1ị t1 ỵ t2 þ Á Á Á þ tn ¼ k Denote ck as the number of all k-element multi-subsets of X nỵk1 As shown in [12], if k1 ẳ k2 ¼ Á Á Á ¼ kn ¼ k then ck ¼ k 94 H C Thanh Int J Soft Eng Knowl Eng 2013.23:81-99 Downloaded from www.worldscientific.com by QUEEN'S UNIVERSITY on 10/08/14 For personal use only In the general case, for any multiplicity ki > k we may replace ki by k but ck will not be changed So without loss of generality, we can assume that: ki k with i ¼ 1; 2; ; n In this case we solve the system of in-equations (1) to ¯nd all iterative k-combinations of X But solving (1) is not easy Thus, we have to detect other methods Theorem The number of all iterative k-combinations of the multi-set X ¼ ðk1 à x1 ; k2 à x2 ; ; kn à xn Þ is: X n nỵk1 n ỵ k ki À ck ¼ À k k À ki iẳ1 X n ỵ k ki kj ỵ 1ị n ỵ k k k i j i ki ; ði ¼ 1; 2; 3; ; nÞ The set of all multi-subsets in Z, which are not k-element S multi-subset of X, is ni¼1 Zi Applying the inclusion-exclusion principle for sets [12], we have: [ n n [ ck ¼ Z À Zi ¼ jZj À Zi i¼1 i¼1 ! n X X nÀ1 ¼ jZj À jZi j jZi \ Zj j ỵ ỵ ðÀ1Þ jZ1 \ Z2 \ Á Á Á \ Zn j : i¼1 i