def count_solutions(self, lits=[]): if lits: T = And(self.constraints + lits) else: T = And(self.constraints) return dsharp.compile(T.to_CNF(), executable='bin/dsharp').model_count()
def count_solutions(self, lits=[]): if lits: T = And(self.constraints + lits) else: T = And(self.constraints) if not T.satisfiable(): return 0 return dsharp.compile(T.to_CNF(), executable='bin/dsharp', smooth=True).model_count()