3

Can we transform a CNF to ILP without introducing new variables?

My question can be seen as a follow up to Express boolean logic operations in zero-one integer linear programming (ILP) as the solution proposed in that post introduces additional variables.

Also, my current understanding is that each 0 value in the truth table is represented by one linear inequality. This means that if my boolean function is of 16 input variables and balanced, there will be 2^15 linear inequalities so is there a way to reduce the number of inequalities?

Moati
  • 33
  • 3
  • @DavidRicherby well, I know that each clause can be represented by one linear inequality, for example, (x v y v ¬Z) can be represented as x + y + (1-z) >= 1 but I'm stuck in the adding of the clauses, how this should be done? for instance, (x v y v ¬z) ^ (¬x v y v ¬Z)? There is another post that describes how Boolean expressions can be transformed into linear inequalities but it adds more variables which I would like to avoid in my problem. – Moati Feb 17 '17 at 18:34
  • 1
    Perhaps you should explain what you want more clearly. Edit your question to include a more elaborate explanation of what you want. – Yuval Filmus Feb 20 '17 at 21:47
  • I can't understand what you are looking for. I don't understand what "I'd like to represent f within the linear inequalities (not just the input variables)" means. As far as how to encode the constraints when f evaluates 0, people have already given you hints on how to do that. Study the NP-completeness of zero-one integer programming. Reduce CircuitSAT to zero-one integer programming -- this reduction is covered in standard resources. – D.W. Feb 21 '17 at 18:36
  • @D.W. let me give you a concrete example. let's assume that the function is the xor of (x,y,z) then, f = (x v y v z) ^ (x v ¬y v ¬z) ^ (¬x v y v ¬z) ^ (¬x v ¬y v z). From the standard resources, the linear inequalities are as follows: x + y + z >= 1, x + (1-y) + (1-z) >= 1, (1-x) + y + (1-z) >= 1, (1-x) + (1-y) + z >= 1. So they are represented by the input variables x, y, z. In my problem, I'd like f to be part of the linear inequalities as well. Let me rephrase my question as follows: is there a way to represent a truth table of a Boolean function as a set of linear inequalities? – Moati Feb 21 '17 at 18:51
  • I don't know what it means for "f to be part of the linear inequalities as well". Can you try defining what that means systematically, in terms of concepts we do know? Or perhaps you should try to find a simple example, where you can show us an example of an answer that you would be happy with and an answer that you would not be happy with. To answer the rephrased question: Yes, you can represent the truth table of a Boolean function as a set of linear inequalities, and other people have repeatedly told you how: study the reduction from SAT to zero-one integer programming. – D.W. Feb 21 '17 at 21:22
  • @D.W. other people have repeatedly told you how: study the reduction from SAT to zero-one integer programming ==> isn't that what I wrote in my above comment? For the XOR of 3 variables: the linear inequalities that I wrote above are the constraints for f to be 1 and in MILP there is the trick of "if-then" constraints so to include the f in the linear inequalities it would be something like x + y + z + M(1-f) >= 1, ....(1-x) + (1-y) + z + M(1-f) >= 1, where is M is a big integer. If f is 1, the constraints are enforced and if f = 0, they are relaxed but is this the right approach? – Moati Feb 21 '17 at 21:45
  • @D.W. I found out that it is you who asked and answered a similar question in Express boolean logic operations in zero-one integer linear programming (ILP). So my question is then can this be done without introducing additional variables? Also, can it be done without introducing a linear inequality for each 0 element in the truth table – Moati Feb 22 '17 at 17:47
  • OK. If that's your question, I encourage you to edit the question up top so that is what it asks (instead of asking something else). We want questions to be self-contained and stand on their own, so people don't have to read the comments to understand what you are asking. – D.W. Feb 22 '17 at 17:48
  • @D.W. I rephrased it completely so please let me know if it is clear enough or not yet. Please keep in mind that the comments I received helped me to shape my question. Thanks – Moati Feb 22 '17 at 17:59

1 Answers1

1

No. Usually (for most functions / CNF formulas) you'll need additional variables. Linear inequalities form a convex space. If the set of solutions such that $f(x)=1$ is not convex, you'll need additional variables.

The exact number of additional variables and inequalities required depends on the function / on the CNF formula.

D.W.
  • 159,275
  • 20
  • 227
  • 470
  • my current approach is that I introduce one linear inequality for each row in the truth table such that f(x)=0 so can you give me a non-trivial example where multiple rows are expressed in one linear inequality? would it be based solely on observations or there would be a systematic way to do it? Thanks – Moati Feb 22 '17 at 18:28
  • I found that there is an algorithm called Quine-McCluskey that would give the minimal sum of products and I presume there is a standard approach to transform from sum of products to product of sums – Moati Feb 22 '17 at 22:28