def createClause(self, result, antecedent, comment=None, isInput=False): self.comment(comment) result = resolver.cleanClause(result) if result == resolver.tautologyId: return result if result == -resolver.tautologyId: result = [] self.clauseCount += 1 antecedent = list(antecedent) if not self.doLrat: antecedent.sort() middle = [ord('a')] if self.doBinary else [] rest = result + [0] + antecedent + [0] ilist = [self.clauseCount] + middle + rest if self.doBinary: if isInput and self.doLrat: pass else: bytes = stream.CompressArray(ilist).bytes self.file.write(bytes) else: slist = [str(i) for i in ilist] istring = " ".join(slist) if isInput and self.doLrat: self.comment(istring) else: self.file.write(istring + '\n') self.clauseDict[self.clauseCount] = result return self.clauseCount
def deleteClauses(self, clauseList): if not self.doLrat: return middle = [ord('d')] if self.doBinary else ['d'] rest = clauseList + [0] ilist = [self.clauseCount] + middle + rest if self.doBinary: bytes = stream.CompressArray(ilist).bytes self.file.write(bytes) else: slist = [str(i) for i in ilist] istring = " ".join(slist) self.file.write(istring + '\n')