# -*- coding: utf-8 -*- """ Created on Tue Oct 20 02:19:35 2015 @author: dante version: 1.0 """ import sys # Needed for exit() function and arguments import QCPHelper as qcph # Needed for property clauses and other functions ''' Read in command line arguments ''' (inF, outF) = qcph.checkArg(sys.argv, "MainACD") ''' Read QCP instance ''' data = qcph.readFile(inF) qcpLen = len(data) ''' Generate CNF formula ''' clauses = qcph.cnfACD(data, qcpLen) ''' Write the CNF formula to a file ''' qcph.writeToFile(clauses, qcpLen, outF)
''' Pre-stored orders of QCP instances ''' instanceOrder = [10, 16, 20, 24, 30, 32, 49] ''' Generate three CNF formulas for each of the QCP instances ''' for x in range(0, 7): for j in range(1, 5): clauses = [] # Stores all clauses of a given QCP instance qcpFile = "../instances/q_" + str(instanceOrder[x]) + "_0" + str(j) + ".qcp" data = qcph.readFile(qcpFile) # QCP instance qcpLen = len(data) # Order of the QCP instance outputFileName = "../CNF/ACD/q_" + str(instanceOrder[x]) + "_0" + str(j) + "_ACD.cnf" clauses = qcph.cnfACD(data, qcpLen) qcph.writeToFile(clauses, qcpLen, outputFileName) outputFileName = "../CNF/ABCD/q_" + str(instanceOrder[x]) + "_0" + str(j) + "_ABCD.cnf" clauses = qcph.cnfABCD(data, qcpLen) qcph.writeToFile(clauses, qcpLen, outputFileName) outputFileName = "../CNF/BEF/q_" + str(instanceOrder[x]) + "_0" + str(j) + "_BEF.cnf" clauses = qcph.cnfBEF(data, qcpLen) qcph.writeToFile(clauses, qcpLen, outputFileName)