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.
 
 
 
 

38 lines
1.0 KiB

#!/usr/bin/env python3
from util.kSAT import kSAT
from util import SATquboResult
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--instance", help="instance file, has to be in DIMACS format", type=str)
parser.add_argument("-r", "--result", help="WMIS qubo result file", type=str)
args = parser.parse_args()
instancePath = args.instance
if instancePath == None:
instancePath = str(input("Instance file: "))
resultFile = args.result
if resultFile == None:
resultFile = str(input("WMIS qubo result file: "))
__verify(instancePath, resultFile)
def __verify(instancePath, resultFile):
sat = kSAT()
sat.readDIMACS(instancePath)
assignments = SATquboResult.readAssignmentsFromFile(resultFile)
evaluations = sat.evaluate(assignments)
for i in range(len(assignments)):
print(assignments[i], evaluations[i])
if __name__ == "__main__":
main()