randomSAT: fixed random sat generation; satlabcxx: fixed *2bson converters

This commit is contained in:
Tom
2019-04-05 13:07:38 +02:00
parent 0ed2b27b99
commit 9a8c908eae
6 changed files with 13 additions and 10 deletions

View File

@@ -24,6 +24,9 @@ def generateRandomKSAT(numberOfClauses,
clauses[clauseIndex].append(varIndex + 1)
for i in range(len(clauses)):
clauses[i].sort()
#fill in the missing bindings
for clauseIndex, clause in enumerate(clauses):
tmpClause = []
@@ -45,7 +48,7 @@ def generateRandomKSAT(numberOfClauses,
for i in range(len(tmpClause)):
tmpClause[i] *= random.choice([-1, 1])
tmpClause = list(np.sort(tmpClause))
tmpClause.sort()
if tmpClause not in clauses:
clauseIsUnique = True