def readMinisatResult(path): result = {"assignments": [], "satisfiable": False} resultFile = open(path) line = resultFile.readline() if line.strip() == "SAT": result["satisfiable"] = True result["assignments"] = __parseVarAssignments(resultFile.readline()) resultFile.close() return result def __parseVarAssignments(line): assignmentStrings = line.split() trailer = assignmentStrings.pop() assignments = [] if trailer == "0": for assignmentStr in assignmentStrings: assignment = True if int(assignmentStr) > 0 else False assignments.append(assignment) else: print("Bad format of assignment string:\n %s", line) return assignments