Conflict-driven cutting-plane learning
The devil is in the details
Jo Devriendt
jodevriendt.com
Acknowledgment:
MIAO group at Lund/Copenhagen
slides: slides.com/jod/cdcpl-devil
How to solve?
"Generate-and-test" search tree...
...maybe we get lucky with good heuristics?
- variables
- values
- find a variable-value assignment that satisfies a number of constraints
Combinatorial search
Combinatorial search
Suppose the problem is UNSATisfiable:
- heuristics don't help
- strong pruning (propagation) helps, but often kicks in only after deciding on many variables
How to derive that no candidate solution satisfies all constraints?
Proof construction
To show UNSAT of above constraints,
just add all of them together.
No need to search over candidate solutions!
Dual reasoning
besides searching over variable-value assignments,
search over constraint combinations
Preliminaries
- Boolean variables: take value \(0\) or \(1\)
- Negated variables: $$\overline{x}=1-x \text{ or } \overline{x}+x=1$$
- variable or its negation is a literal
- Linear inequalities (positive coefficients): $$x+2\overline{y}+3z \geq 4$$
- Propositional clause: $$x \vee \overline{y} \vee z$$ is equivalent to $$x+\overline{y}+z \geq 1$$
\(z\)
\(\overline{z}\)
Naive SAT solver
- Depth-first search
- Unit propagation:
propagate single non-falsified literal in clause
\(x\)
\(y\)
\(\overline{y}\)
\(\overline{z}\)
\(z\)
Naive SAT solver
- Depth-first search
- Unit propagation:
propagate single non-falsified literal in clause
\(x\)
\(y\)
\(z\)
\(\overline{z}\)
\(\overline{x}\)
\(y\)
\(\overline{y}\)
Naive SAT solver
- Depth-first search
- Unit propagation:
propagate single non-falsified literal in clause
\(\overline{y}\)
\(\overline{z}\)
\(z\)
\(x\)
\(y\)
\(z\)
\(\overline{z}\)
Preliminaries
Decision literals
Search trail: the current assignment, as a list of literals in chronological order, paired with their decision status
Reason constraint
d | d | p |
Conflict constraint
Propagated literal
\(\overline{x}\)
\(y\)
\(\overline{y}\)
\(\overline{y}\)
\(\overline{z}\)
\(z\)
\(x\)
\(y\)
\(z\)
\(\overline{z}\)
Conflict-driven clause learning
- Depth-first search
- Unit propagation:
propagate last non-falsified variable in clause - Clause learning:
- from each conflict, get the conflict clause
- iterate backwards over the trail
- add the reason to the conflict
- stop when the conflict clause propagates at a previous decision point, add the current conflict as a learned clause
- backtrack to the propagating decision point, continue search
Conflict-driven clause learning
\(x\)
\(y\)
\(z\)
\(\overline{z}\)
- from each conflict, get the conflict clause
- iterate backwards over the trail
- add the reason to the conflict
- stop when the conflict clause propagates at a previous decision point, add the current conflict as a learned clause
- backtrack to the propagating decision point, continue search
\(\overline{y}\)
\(\overline{z}\)
\(x\)
\(\overline{x}\)
Conflict-driven clause learning
- from each conflict, get the conflict clause
- iterate backwards over the trail
- add the reason to the conflict
- stop when the conflict clause propagates at a previous decision point, add the current conflict as a learned clause
- backtrack to the propagating decision point, continue search
Crucial invariants
- addition eliminates propagated literal from conflict
- at every step, conflict is falsified by trail
(contains only false literals)
"add" the clauses
Resolution rule
In case of double literals:
Divide lhs and rhs by 2, ceil:
\(\overline{y}\)
\(\overline{z}\)
\(x\)
\(\overline{x}\)
Conflict-driven clause learning
- every "addition" is an application of resolution rule
- all learned clauses form a resolution proof
Automatic proof construction (dual reasoning) during search!
Conflict-driven clause learning
Crucial invariants
- addition eliminates propagated literal from conflict
- at every step, conflict is falsified by trail
Mid-presentation summary
- from search conflicts, derive constraints
- apply resolution rule to conflict clause and reason clauses
- build resolution proofs
Can we do better?
- Resolution is not only proof system
- Field of proof complexity
- given an unsatisfiable formula, what is the shortest proof possible?
- Resolution is the weakest of all proof systems!
- there exist simple formulas where smallest resolution proof is exponential [H85]
- other proof systems are polynomial
- lower bound to solve time!
- E.g., cutting plane (CP) proof system
Cutting plane proofs
Rules:
- Boolean axiom
- Addition
- Multiplication
- Division
- Trivial inconsistency:
Can simulate resolution rule
Conflict-driven cutting-plane learning
Can we construct cutting plane proof during search, similar to resolution via CDCL?
- add reason constraints to conflict constraint
- eliminating propagated variables
- keeping constraint falsified by trail
- add learned constraint to continue search
Let's see...
- Input: 0-1 linear constraints
- Depth-first search
- with decisions and propagated literals as a trail
Conflict-driven cutting-plane learning
d | d | d |
Slack
Given a trail, the slack of the constraint is the difference between the lhs and the rhs (assuming unknown literals as true)
slack =
2+2+0-3 =
1
- slack<0 means constraint is conflicting
- all unknown literals with coefficient greater than slack propagate to true
Conflict-driven cutting-plane learning
Problem
constraints
slack
trail
Conflict-driven cutting-plane learning
Problem
constraints
slack
trail
Conflict-driven cutting-plane learning
Problem
constraints
slack
trail
- add reason constraint to conflict
- use division/multiplication to eliminate propagated literal
- keep constraint conflicting (slack<0)
Slack is sub-additive: slack of summed constraints is at most sum of slacks
Can we get the reason constraint to slack 0 with the coefficient of the propagated variable identical to the conflict coefficient?
Conflict-driven cutting-plane learning
round-to-one [NE18]
constraints
slack
trail
- adding variable axioms \(x \geq 0\) for falsified literal \(x\) does not change slack
- adding variable axioms \(\overline{x} \geq 0\) for non-falsified literal \(x\) does not change slack
- dividing by a common divisor \(d\) of all coefficients yields \(\lfloor\frac{slack}{d}\rfloor\)
- slack is always lower than propagating coefficient
Divide by propagating coefficient, after ensuring all coefficients are divisible
Conflict-driven cutting-plane learning
round-to-one [NE18]
constraints
slack
trail
Divide by propagating coefficient, after ensuring all coefficients are divisible
1) non-falsified: add \(\overline{x}\geq 0\)
2) falsified: add \(y \geq 0\)
divisor
3) divide by 2
4) multiply with conflict coefficient
5) add to conflict
Conflict-driven cutting-plane learning
constraints
slack
trail
1) non-falsified: add \(\overline{x}\geq 0\)
2) falsified: add \(y \geq 0\)
divisor
3) divide by 2
4) multiply with conflict coefficient
5) add to conflict
Building cutting plane proofs!
Conflict-driven cutting-plane learning
round-to-one [NE18]
Divide by propagating coefficient, after ensuring all coefficients are divisible, then multiply by conflict coefficient.
Rest of search routine: roughly same as CDCL
Efficient implementation: gitlab.com/JoD/exact
Applications
- Find unsatisfiability
- prove optimality of solution
- find intersection of all solutions
- prove logical consequence
- Currently used to generate explanations for constraint programs with CPMpy (faster than Google OR-tools)
- Used as backend solver for IDP-like system
- Verification of bit-level multiplier circuits [LBDEN20]
- Formal verification of clausal decomposition of constraints with VeriPB
- Can perform well when linear relaxation of problem is bad - improved a MIPLIB instance
What now?
Round-to-one is not the final answer
- Divisors different from propagating coefficient?
- yes, all divisors greater than slack should work
- How many axioms to add?
- [EN18] adds maximal amount, but rather as little as needed?
- Manipulate conflict instead of propagating constraint?
- definitely possible!
- Other sensible ways of transforming constraint?
- yes, e.g., saturation rule and mixed-integer-rounding cut
strictly stronger than regular division!
Way more degrees of freedom than in CDCL ...
... thesis topic :)
What does Exact do?
Efficient implementation: gitlab.com/JoD/exact
- Multiply reason constraint with conflict coefficient
- If propagating coefficient suffices as divisor, use that
- Else, try to find multiple of propagating coefficient that yields a divisor of conflict coefficient
- Else, round to one
- Use axiom addition sparingly
- Except when reducing small coefficients as long as \(\lceil\frac{rhs}{divisor}\rceil\) remains unchanged.
Thanks for listening!
Questions?
[H85] The intractibility of resolution - Haken
[CCT87] On the complexity of cutting-plane proofs - Cook, Coullard, Turán
[MS96] GRASP - a new search algorithm for satisfiability - Marques-Silva, Sakallah
[BS97] Using CSP lookback techniques to solve real-world SAT instances - Bayardo, Schrag
[MMZZM01] Chaff: Engineering an efficient SAT solver - Moskewicz, Madigan, Zhao, Zhang, Malik
[CK05] A fast pseudo-Boolean constraint solver - Chai, Kuehlmann
[SS06] Pueblo: A hybrid pseudo-Boolean SAT solver - Sheini, Sakallah
[LP10] The Sat4j library, release 2.2 - Le Berre, Parrain
[EN18] Divide and conquer: Towards faster pseudo-boolean solving - Elffers, Nordström
[D20] Watched Propagation for 0-1 Integer Linear Constraints - Devriendt
[DGN20] Learn to Relax: Integrating 0-1 Integer Linear Programming with Pseudo-Boolean Conflict-Driven Search - Devriendt, Gleixner, Nordström
[SDNS20] Theoretical and Experimental Results for Planning with Learned Binarized NeuralNetwork Transition Models - Say, Devriendt, Nordström, Stuckey
[LBDEN20] Verifying Properties of Bit-vector Multiplication Using Cutting Planes Reasoning - Liew, Beame, Devriendt, Elffers, Nordström
RoundingSat
[LBDEN20]
- Verification of various bit-level multiplier circuits
- All instances are unsatisfiable
Conflict-driven cutting-plane learning
By Jo Devriendt
Conflict-driven cutting-plane learning
- 270