1

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).

s0mbre
  • 361
  • 2
  • 14

1 Answers1

0

If I understand your problem correctly, I don't think an ordinary SAT solver is going to help you. In essence, the DNF form is the solution to a SAT problem: each clause trivially makes an assignment that makes the statement true. Your problem sounds like more of a "maximal set cover", which, yes, you can probably force a SAT solver to do that for you, but it's probably not the easiest approach. (I personally love GNU Mathprog for stuff like this. Then fork out for Gurobi if the problem is too big).

Have you considered a greedy approach? Is it actually important you have a true maximum? I vaguely recall hearing about using exactly this formulation to find decent solutions to a maximal cover problem.

  • Thanks for your feedback! Could you give me an inkling how to get about this problem using GTLK or Gurobi or... Just using my example variables or any of your own. – s0mbre Aug 13 '22 at 11:33