def __init__(self, formula, relevant_io=None): if relevant_io is None: relevant_io = {} for value in relevant_io.values(): value.childs = [] self.relevant_io = relevant_io self.clauses, self.names, self.reverse = formula.to_cnf().to_clauses() self.clauses, self.partial, self.free = simplify_clauses(self.clauses) self.rebuild_assignment()
def simplify(self): clauses = self.clauses + \ assignment_to_clauses(self.assignment, self.names) self.clauses, self.partial, self.free = simplify_clauses(clauses) self.reset_assignment()