In my Boolean logic problem, I have a set of variables (encoded as integers) over 10,000 in length (from 10 to 100k). Each variable has its set of constraints, i.e. other variables from the same set contradicting it. Contradictions are mutual, i.e.
(1 & -2) | (2 & -1)
The task is to maximize the number of mutually satisfying variables. In SAT terms, it should be formulated as:
MAXIMIZE {
(1 & -2 & -3 ...) |
(2 & -1 & -4 ...) |
...
}
This expression is intuitively in DNF format, but SAT solvers work with CNF expressions, so transformation is necessary.
I want to:
- solve the expression with a SAT solver (I use the PySAT toolkit), which implies translating it to the CNF form, at the same time avoiding exponential growing of clauses (need to apply Tseitin transformations / cardinality constraints -- but just don't know how);
- maximize the number of truthful clauses in the expression, i.e. solve a 'max-SAT' problem, with maximum number of satisfying variables
Please help me formulate a valid CNF (referencing how it can be done in a Python SAT solver or just the raw expression).