Beispiel #1
0
  def Cadidate_gen(self, F_k1):
    '''
    @F_k1 : <Collection>
    @member of F_k1 : <Collection>

    merge members and generate new combinations using members of F_k1
    and remove collections which has member that is not involved in F_k1
    '''
    F_k1 = List_to_Collection(F_k1)
    #print 'F_k1 = List_to_Collection', F_k1
    collections = Collection()
    #merge two collection
    for i, member in enumerate(F_k1):
      member = List_to_Collection(member)
      for j in range(i+1, len(F_k1)):
        #merge member with any other collection
        new_member = List_to_Collection(
                      member.no_repeat_merge(F_k1[j])
                      )
        is_success = True
        #test whether any sub-collection is a member of F_k1
        for m in new_member.sub_collection():
          if not collection.boolean( F_k1.find(m)):
            is_success = False
            break
        if is_success: 
          if not collection.boolean(
              collections.find(new_member)
            ): collections.append(new_member)
    return collections
Beispiel #2
0
 def init_pass(self):
   '''
   init C and F
   '''
   #init C and trans C to a list of single member list
   #print 'init_pass: self._list', self._list
   temlist = Collection()
   for m in self._list:
     for i in m:
       if not collection.boolean(
           self._list.find_outside(temlist, i)):
         temlist.append(i)
   #print 'init_pass: temlist', temlist
   temlist.sort()
   for i in temlist: self.C.append([i])