Watched Propagation for
0-1 Integer Linear Constraints

Jo Devriendt

MIAO research group
Lund University, Sweden
& University of Copenhagen, Denmark

jodevriendt.com

Context: pseudo-Boolean solvers

  • Find an (optimal) solution to a 0-1 integer linear program, or prove that none exist
  • CDCL-like: depth-first search, learn 0-1 integer linear (IL) constraints
    • huge database of learned constraints

How to efficiently detect conflicts and propagations?

Efficiently detect
conflicts and propagations

For clauses (e.g., SAT solvers)

  • Counter approach
  • 2-watched propagation [pioneered by Chaff]

2-watched is clearly the most efficient

Efficiently detect
conflicts and propagations

For 0-1 IL constraints (e.g., PB solvers)

  • Counter approach [Galena, Sat4J]
  • Watched approach [Galena, Pueblo, Sat4J, RoundingSat]
    • lots of variations
  • Specialized clause & cardinality propagation [Galena, Sat4J]
    • 2-watched & k-watched propagation

Does watched propagation work best?

Contributions

New watched propagation algorithm

  • unique optimizations

Experimental results

  • New watched algorithm is more efficient than counter propagation ...
  • ... but when adding specialized clause & cardinality routines, difference is small

0-1 integer linear constraints

10l_1+5l_2+\sum_{i=3}^{100}{l_i} \geq 10
5x+4y+3\overline{z}+2\overline{u}+\overline{v} \geq 6
x+y+\overline{z}+\overline{u} \geq 2
x+y+\overline{z} \geq 1
\sum_{i=1}^{100}10l_i+2l_{101}+l_{102}+l_{103} \geq 52

Clause

Cardinality constraint

General PB constraint

\sum_i c_i l_i \geq d\\ \text{literals } l_i \text{, } \overline{l_i}=1-l_i \\ \text{coefficients } c_i \in \mathbb{N}^+ \\ \text{degree } d \in \mathbb{N} \\

Pseudo-Boolean (PB) normal form:

eg

Complicating factors

Clause Cardinality General constraint
coefficients 1  1 ?

Complicating factors

Clause Cardinality General constraint
coefficients 1  1 ?
# watches O(1), 2 O(n), d+1 O(n), variable

Complicating factors

Clause Cardinality General constraint
coefficients 1  1 ?
# watches O(1), 2 O(n), d+1 O(n), variable
propagation single single multiple

Complicating factors

Clause Cardinality General constraint
coefficients 1  1 ?
# watches O(1), 2 O(n), d+1 O(n), variable
propagation single single multiple
after propagation satisfied
satisfied may still be(come) conflicting

Core ideas of 0-1 IL
watched propagation

  • General:
    • slack of a constraint
    • conflict condition
    • propagation condition
  • Algorithmic:
    • watch slack invariant
    • watch set invariant

Slack under partial assignment

  • Partial variable assignment: set of pairwise disjoint literals ρ
  • Slack of a constraint C denotes best possible evaluation under ρ
C \equiv 5x+4y+3\overline{z}+2\overline{u}+\overline{v} \geq 6
\mathrm{slack}(C,\rho)\equiv \sum_{i \colon \overline{l_i} \not \in \rho} c_i -d
\mathrm{slack}(C,\{\overline{x},\overline{u},v\})=4+3+2-6=3

eg

Typesetting convention

\textcolor{grey}{5x}+4y+3\overline{z}+\boldsymbol{2\overline{u}}+\textcolor{grey}{\overline{v}} \geq 6 \\ \text{where } \rho = \{\overline{x},\overline{u},v\}

Conflict condition

\mathrm{slack}(C,\rho) < 0

C is conflicting iff

Propagation condition

\mathrm{slack}(C,\rho) < c_i
C \equiv \textcolor{grey}{5x}+4y+3\overline{z}+\boldsymbol{2\overline{u}}+\textcolor{grey}{\overline{v}} \geq 6
\mathrm{slack}(C,\{\overline{x},\overline{u},v\})=3
\text{since } \mathrm{slack}(C,\rho \cup \{\overline{l_i}\})<0

eg

C propagates     iff

l_i
\text{where } l_i, \overline{l_i} \not \in \rho

Propagation condition

\mathrm{slack}(C,\rho) < c_i
C \equiv \textcolor{grey}{5x}+4y+3\overline{z}+\boldsymbol{2\overline{u}}+\textcolor{grey}{\overline{v}} \geq 6
\mathrm{slack}(C,\{\overline{x},\overline{u},v\})=3<4 \\ \text{where } y \not \in \{\overline{x},\overline{u},v\}
\text{since } \mathrm{slack}(C,\rho \cup \{\overline{l_i}\})<0

eg

C propagates     iff

l_i
\text{where } l_i, \overline{l_i} \not \in \rho

Watch slack invariant

C \equiv \textcolor{grey}{\underline{5x}}+\underline{4y}+\underline{3\overline{z}}+\boldsymbol{2\overline{u}}+\textcolor{grey}{\overline{v}} \geq 6
\mathrm{watches}(C)=\{x,y,\overline{z}\}

eg

\mathrm{watchslack}(C,\rho)\equiv \sum_{i \colon l_i \in \mathrm{watches}(C) \text{ and } \overline{l_i} \not \in \rho} c_i -d

watches(C) is a subset of C's literals

Watch slack invariant:
the algorithm keeps track of the watch slack of a constraint

\mathrm{watchslack}(C,\{\overline{u},v\})=4+3-6=1

Watch slack invariant

\mathrm{watchslack}(C,\rho) \geq \mathrm{maxcoef}(C)

maxcoef(C) is C's largest coefficient

What happens if

if

\mathrm{slack}(C,\rho) \geq \mathrm{watchslack}(C,\rho)

then C is neither conflicting nor propagating
since

\mathrm{watchslack}(C,\rho) < \mathrm{maxcoef}(C)

?

Watch set invariant

hence

\mathrm{watchslack}(C,\rho) < \mathrm{maxcoef}(C) \\ \Rightarrow \\ \forall l \in C \setminus \mathrm{watches}(C) \colon \overline{l} \in \rho
\mathrm{watchslack}(C,\rho) < \mathrm{maxcoef}(C) \\ \Rightarrow \\ \mathrm{watchslack}(C,\rho) = \mathrm{slack(C,\rho)}

Particularities of proposed approach

  • Fixed decreasing-coefficient literal order
  • Store index of watched literal in watch lists
  • Keep falsified watches if watchslack(C,ρ)<maxcoef(C)
    • cheap watchslack update during backjumps
  • Important optimizations based on whether a backjump happened since last watch change for a constraint

Example

\underline{4x}+\underline{3y}+\underline{3z}+2u+2v+w \geq 5
\underline{4x}+\underline{3y}+\underline{3z}+2u+2v+\textcolor{grey}{w} \geq 5
\underline{4x}+\underline{3y}+\textcolor{grey}{3z}+\underline{2u}+2v+\textcolor{grey}{w} \geq 5
\rho
C
\textrm{watchslack}(C,\rho)
5
5
4
\{\}
\{\overline{w}\}
\{\overline{w},\overline{z}\}
\textcolor{grey}{\underline{4x}}+\underline{3y}+\textcolor{grey}{3z}+\underline{2u}+\underline{2v}+\textcolor{grey}{w} \geq 5
2
\{\overline{w},\overline{z},\overline{x}\}
\textcolor{grey}{\underline{4x}}+\boldsymbol{\underline{3y}}+\textcolor{grey}{3z}+\underline{2u}+\underline{2v}+\textcolor{grey}{w} \geq 5
2
\{\overline{w},\overline{z},\overline{x},y\}

propagation

\underline{4x}+\underline{3y}+{3z}+\underline{2u}+\underline{2v}+{w} \geq 5
6
\{\}

backjump to root

\underline{4x}+\underline{3y}+{3z}+\textcolor{grey}{2u}+\underline{2v}+{w} \geq 5
4
\{\overline{u}\}

...

Experimental evaluation

  • 'watch-opt' implementation in RoundingSat
  • Compare to
    • old RoundingSat watched propagation
    • counter implementation
    • with/without specialized clause and cardinality propagation (-cc)
  • Measure propagations/second on
    PB competition and MIPLIB benchmarks
    • limited to instances solved within 1s and 5000s by compared configurations

New algorithm improves on
old algorithm

propagations / second

Specialized routines don't change the picture much

propagations / second

Watched propagation is faster than counter ...

propagations / second

... but counter catches up when adding specialized clause & cardinality routines

propagations / second

Future work

  • Use a dynamic max coefficient instead of a static max coefficient
    • allows to reduce the amount of watched literals
  • Handle some constraints with counter propagation, others with watched
  • Determine the propagation order of constraints based on their strength

Conclusion

  • Investigated watched propagation for 0-1 IL constraints
  • Proposed a new watched propagatation variant
  • Effective in practice
  • Not yet clearly beating counter propagation

Thanks for watching!