You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
824 B

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