Пример #1
0
	def write(self, index, numVars, cnf, numTwoClauses):
		print("Writing: " + str(self.out + "_" + str(index)))
		f = open(self.out + "_" + str(index), 'wb')
		header, clauses = makeDimacsCNF(numVars, cnf)
		f.write('c ' + str(numTwoClauses) + "\n")
		f.write(header + "\n")
		for c in clauses:
			for l in c:
				f.write(str(l) + " ")
			f.write("0 \n")
Пример #2
0
def writeCNF(g, fname, numVars, cnf):
	filename = str(fname) + ".pickle"
	pickle.dump(g, open(filename, 'w')) # save the pickled version
	filename = str(fname) + ".out.txt"
	print >> sys.stderr, filename
	f = open(filename, 'wb')
	header, clauses = makeDimacsCNF(numVars, cnf)
	for c in clauses:
		for l in c:
			f.write(str(l) + " ")
		f.write("0 \n")
Пример #3
0
 def write(self, index, numVars, cnf, numTwoClauses):
     filename = self.out + "_" + str(index) + ".pickle"
     self.graph.dump(filename)
     print >>sys.stderr, str(self.out + "_" + str(index))
     f = open(self.out + "_" + str(index), "wb")
     header, clauses = makeDimacsCNF(numVars, cnf)
     f.write("c " + str(numTwoClauses) + "\n")
     f.write(header + "\n")
     for c in clauses:
         for l in c:
             f.write(str(l) + " ")
         f.write("0 \n")