Beispiel #1
0
 def add_bddSupport(self, bdd, support):
     ps = self.ddmanager.Support(bdd)
     psA = repycudd.IntArray(self.converter.numvars)
     self.ddmanager.BddToCubeArray(ps, psA)
     for i in range(len(psA)):
         if psA[i] == 0 or psA[i] == 1:
             var = self.converter.idx2var[i]
             support.add(var)
Beispiel #2
0
 def bdd2atoms(self, bdd, atomset=None):
     psA = repycudd.IntArray(self.converter.numvars)
     self.ddmanager.BddToCubeArray(bdd, psA)
     atoms = []
     atomval = {}
     for i in range(len(psA)):
         if psA[i] == 0 or psA[i] == 1:
             var = self.converter.idx2var[i]
             if var in self.converter.var2atom:
                 atom = self.converter.var2atom[var]
                 #                     print("%d -> %s" % (i, atom))
                 if atomset != None and atom not in atomset:
                     continue
                 if psA[i] == 0:
                     atomval[atom] = 0
                     atom = Not(atom)
                 else:
                     atomval[atom] = 1
                 atoms.append(atom)
     return (And(atoms), atomval)
Beispiel #3
0
 def cube_from_var_list(self, var_list):
     indices = repycudd.IntArray(len(var_list))
     for i, v in enumerate(var_list):
         indices[i] = self.var2node[v].NodeReadIndex()
     cube = self.ddmanager.IndicesToCube(indices, len(var_list))
     return cube
Beispiel #4
0
def pylist_to_intarray(lst):
    res = repycudd.IntArray(len(lst))
    for i, x in enumerate(lst):
        res[i] = x
    return res