CDCL SAT Solving and �Applications to Optimization Problems
Alexander Nadel, Intel & Technion, Israel
February 18, 2024
Technion, Haifa, Israel�
Up-to-date version of a talk first given at �Satisfiability: Theory, Practice, and Beyond Workshop, Simons Institute, UC Berkeley, USA on April 17, 2023�Video Recording of the 2023 Talk @ Berkeley
1
PEG PDS DDI
1/11
Agenda
PEG PDS DDI
2/11
Introduction
SAT: determine if a Boolean formula in Conjunctive Normal Form (CNF) satisfiable
The original NP-Complete problem: the famous Cook-Levin theorem (early 70s)
SAT has exponential complexity unless P = NP -- whether or not P = NP is frequently called the most important outstanding question in CS
SAT is an unresolved mystery
Yet, SAT solvers are scalable widely used tools, how come?!
3
2/18/2024
F = (a ∨ b) ∧ (¬a ∨ ¬b ∨ c)
clause #1
clause #2
Literals
PEG PDS DDI
3/11
SAT Fundamentals: Backtrack Search
The baseline algorithm in modern SAT solvers is backtrack search
Called DPLL or DLL
Davis, Martin; Logemann, George; Loveland, Donald: "A Machine Program for Theorem Proving". Communications of the ACM. 5 (7): 394–397. (1961).
Davis, Martin; Putnam, Hilary: A computing procedure for quantification theory. Journal of the ACM 7 (1960)
4
2/18/2024
PEG PDS DDI
4/11
From Enumeration to DPLL
5
2/18/2024
Apply the unit clause rule till fixed-point aka Boolean Constraint Propagation (BCP)
0
1
0
Carry out backtrack search.
Stop when a model is found
0
The unassigned literal c1 must be implied
F = (a ∨ b) ∧ (¬a ∨ ¬b ∨ c)
clause #1
clause #2
Literals
a
b
b
c
c
c
c
0
1
0
0
0
0
0
0
1
1
1
1
1
1
a
b
b
c
c
c
0
1
0
0
0
0
0
1
1
1
1
1
a
b
c
Stop when a clause turns UNSAT
c2
c1
c3
c2
c1
c3
Falsified literal:
Satisfied literal:
Unassigned literal:
A unit clause -- one unassigned, rest falsified:
1
a
b
c
0
0
The unit clause rule: the unassigned literal in a unit clause must be 1
Implied in parent clause #1:
PEG PDS DDI
5/11
The Mystery of SAT Solver Scalability
DPLL could handle formulas with <2,000 clauses
Modern SAT solvers cope with industrial instances of 100,000,000’s clauses
The introduction of Conflict-Driven-Clause-Learning (CDCL) or, simply, �Conflict-driven Solving was the birth of modern highly-scalable SAT solving
Learn from conflicts to drive & prune backtrack search
6
2/18/2024
a
b
b
c
c
c
c
0
1
0
0
0
0
0
0
1
1
1
1
1
1
PEG PDS DDI
6/11
CDCL: the Intuitive Principles
Learning and pruning
Locality
Well-engineered data structures
Beyond CDCL
7
2/18/2024
PEG PDS DDI
7/11
Today’s Focus for the 1st Part of the Talk
In-depth dive into the “core of the core”
PEG PDS DDI
8/11
Conflict-driven SAT Solving: Seminal Work
1996: GRASP by Joao P. Marques-Silva and Karem A. Sakallah
João P. Marques Silva, Karem A. Sakallah: GRASP - a new search algorithm for satisfiability. ICCAD 1996: 220-227��2001: Chaff by Matthew W. Moskewicz, Conor F. Madigan, Ying Zhao, Lintao Zhang and Sharad Malik
Matthew W. Moskewicz, Conor F. Madigan, Ying Zhao, Lintao Zhang, Sharad Malik: Chaff: Engineering an Efficient SAT Solver. DAC 2001: 530-535
PEG PDS DDI
9/11
Boolean Constraint Propagation (BCP) Essentials
BCP consumes 80-90% of SAT run-time
What?
How?
c2
c1
c3
c2
c1
c3
c2
c1
c3
Falsified literal:
Satisfied literal:
Unassigned literal:
PEG PDS DDI
10/11
Efficient Data Structure for BCP
Hantao Zhang: SATO: An Efficient Propositional Prover. CADE 1997: 272-275
Sörensson, N., Eén, N.: MiniSAT 2.1 and MiniSAT++ 1.0 - SAT race Editions. SAT, Competitive Event Booklet (2008) (caching one literal)� Geoffrey Chu, Aaron Harwood, Peter J. Stuckey: Cache Conscious Data Structures for Boolean Satisfiability Solvers. J. Satisf. Boolean Model. Comput. 6(1-3): 99-120 (2009) (caching one literal & inlining binary clauses)
2/18/2024
c4
c5
c7
c2
c1
c3
c6
Falsified literal:
Satisfied literal:
Unassigned literal:
Unknown literal:
Non-falsified literal:
Non-satisfied literal:
c4
c5
c7
c3
c2
c6
c1
PEG PDS DDI
11/11
Conflict Analysis Loop in Chaff
Right-hand side: the conflict
Left-hand side: the reason, including the rightmost Unique Implication Point (UIP) of the last level
f@5(C5)
Decision Level 4
f@1(C7)
c@3
¬f@3(C6)
C1= ¬a ∨ f ∨ g
C2= ¬a ∨ f ∨ ¬g
C3= ¬c ∨ ¬f ∨ g
C4= ¬b ∨ ¬f ∨ ¬g
C5= ¬e ∨ f
a@1
b@2
c@3
d@4
e@5
g@5
¬g@5
f@5
e@5
c@3
b@2
1UIP
C6 = ¬f ∨ ¬c ∨ ¬b
a@1
b@2
C3
C3
C4
C5
C4
g@3
¬g@3
a@1
¬f@3
C1
C1
C2
C2
1UIP
C7 = f ∨ ¬a
a@1
c@3
b@2
NCB to 3
NCB to 1
Decision Level 1
Decision Level 2
Decision Level 3
Decision Level 5
Decision variable/literal
Implication graph
g@5(C3)
g@3(C1)
PEG PDS DDI
12/11
Conflict Analysis Loop in GRASP
b@2
a@1
g@3
a@1
b@2
c@3
d@4
e@5
f@5(C5)
g@5
¬g@5
f@5
e@5
c@3
1UIP
C6 = ¬f ∨ ¬c ∨ ¬b
C3
C3
C4
C5
C4
2UIP 🡪 1UIP
C7 = ¬e ∨ f
¬f@3(C6)
a@1
b@2
c@3
d@4
f@1(C8)
a@1
¬f@3
C1
C1
C2
C2
1UIP
c@3
b@2
2UIP🡪1UIP
C1= ¬a ∨ f ∨ g
C2= ¬a ∨ f ∨ ¬g
C3= ¬c ∨ ¬f ∨ g
C4= ¬b ∨ ¬f ∨ ¬g
C5= ¬e ∨ f
b@2
C9 = ¬c ∨ ¬b ∨ ¬f
C8 = f ∨ ¬a
CB to 4
¬g@3
Backtrack to conflict level 3
CB to 2
In GRASP, f is a special kind of a “flipped” decision variable at level 5, but GRASP learns as if ¬f were implied at level 3
g@5(C3)
g@3(C1)
¬g@1(C4)
¬c@1(C3)
PEG PDS DDI
13/11
Up-to-date Conflict Analysis Loop Algorithm �Covers GRASP & Chaff & Modern Solvers
PEG PDS DDI
14/11
Conflict Analysis Loop Evolvement
Maple_LCM_Dist_ChronoBT (MapleCB): Chronological Backtracking (CB) strikes back
Alexander Nadel, Vadim Ryvchin: Chronological Backtracking. SAT 2018: 111-121
Cadical’19: custom (score-based) backtracking
Sibylle Möhle, Armin Biere: Backing Backtracking. SAT 2019: 250-266
CB & BCP integration: implemented, but not discussed
1996
GRASP
2001
Chaff
2018
Maple_LCM_Dist_ChronoBT
2019
Cadical’19
Chaff’s alg. (one 1UIP cls. & NCB) is the state-of-the-art
PEG PDS DDI
15/11
Integrating CB and BCP
Example of a necessary adjustment
Useful invariants are still violated even with the adjustments:
Intel® SAT Solver (IntelSAT): lowest implication & lowest conflict ensured!
Alexander Nadel: Introducing Intel® SAT Solver. SAT 2022.
Alexander Nadel, “Introducing Intel® SAT Solver” [video], MIAO Seminars. February 2023.
@30
c2
@20
c1
@30
@1
@20
@1
@1
@20
@1
@30
Falsified literal:
Unassigned literal:
@10
@20
@10
Satisfied literal:
@1
@30
@1
@30
@1
@20
@1
@20
PEG PDS DDI
16/11
Intel® SAT Solver (IntelSAT)
An open-source CDCL solver written from scratch in C++20
License: MIT (free)
Public repository: https://github.com/alexander-nadel/intel_sat_solver
Tuned towards incremental applications with mostly SAT queries
17
2/18/2024
PEG PDS DDI
17/11
Optimization in SAT
OptSAT(F, ψ): given a propositional formula F in CNF and a Pseudo-Boolean objective function ψ, return a model to F which minimizes ψ
18
2/18/2024
Example: F = (a + b) (a + ¬c) (¬a + c)
F has 3 models:
a | b | c | ψ |
0 | 0 | 0 | 2.3 |
0 | 0 | 1 | 3.5 |
0 | 1 | 0 | 8 |
0 | 1 | 1 | 100.1 |
1 | 0 | 0 | 96.3 |
1 | 0 | 1 | 75 |
1 | 1 | 0 | 1.35 |
1 | 1 | 1 | 20.4 |
PEG PDS DDI
18/11
Optimization in SAT
OptSAT(F, ψ): given a propositional formula F in CNF and a Pseudo-Boolean objective function ψ, return a model to F which minimizes ψ
19
2/18/2024
Example: F = (a + b) (a + ¬c) (¬a + c)
F has 3 models:
a | b | c | ψ |
0 | 0 | 0 | 2.3 |
0 | 0 | 1 | 3.5 |
0 | 1 | 0 | 8 |
0 | 1 | 1 | 100.1 |
1 | 0 | 0 | 96.3 |
1 | 0 | 1 | 75 |
1 | 1 | 0 | 1.35 |
1 | 1 | 1 | 20.4 |
Best model
PEG PDS DDI
19/11
Solving OptSAT(F, ψ) Instances in Real-life
Is ψ is a linear PB function: ψ = wn-1*tn-1 + … + w1*t1 + … + w0*t0?
20
2/18/2024
Yes
No
MaxSAT: a rich well-established field!
Scarce research
Our contribution
PEG PDS DDI
20/11
Polosat: Black-Box Optimization in SAT
Polosat: minimize a black-function ψ(V), given F(V) -- incomplete
How to use Polosat:
No need to bit-blast ψ into clauses: calculate ψ in the callback instead!
In practice:
PEG PDS DDI
21/11
Polosat Algorithm: Simulate Local Search with SAT
Polosat (CNF F(V), black-box objective function ψ(V), observables B ⊆ V)
No model can be rediscovered by construction
Making Polosat work in practice:
22
2/18/2024
PEG PDS DDI
22/11
Polosat Cont.
Polosat is an incomplete algorithm
Polosat can be integrated into a high-level complete algorithm by �replacing SAT queries to Polosat queries
Next -- applying Polosat to boost:
PEG PDS DDI
23/11
Cell Placement without Optimization: Input
24
2/18/2024
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | |
| | | |
| | | |
| | | |
| |
| |
|
|
|
|
|
0
8
8
The grid where to place the cells
The cells to be placed
c1
c2
c3
c4
c5
| |
| |
| |
| |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
0
8
8
| | | |
|
|
|
|
|
| |
| |
| | | |
| | | |
| | | |
| |
| |
| |
| |
Cell Placement w/o Opt.: Output
PEG PDS DDI
24/11
Cell Placement Input
25
2/18/2024
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
n1 | | | |
| | | |
| | | |
n2 | | | |
n1 | |
n2 | n3 |
n1 |
|
|
|
|
0
8
8
The grid where to place the cells
The cells to be placed
c1
c2
c3
c4
c5
N nets: n1={c1,c3,c5}; n2={c2,c3}; nN=3={c3,c4}
n3 | |
| |
| |
| |
Industrial practice: additional constraints!
PEG PDS DDI
25/11
Cell Placement Input
26
2/18/2024
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
n1 | | | |
| | | |
| | | |
n2 | | | |
n1 | |
n2 | n3 |
n1 |
|
|
|
|
0
8
8
The grid where to place the cells
The cells to be placed
c1
c2
c3
c4
c5
N nets: n1={c1,c3,c5}; n2={c2,c3}; nN=3={c3,c4}
n3 | |
| |
| |
| |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
0
8
8
n1 | | | |
n1 |
|
|
|
|
n1 | |
n2 | n3 |
| | | |
| | | |
n2 | | | |
n3 | |
| |
| |
| |
Cell Placement with Opt. Output
B1
B2
B3
Industrial practice: additional constraints!
PEG PDS DDI
26/11
Cell Placement 🡪 BV/SAT : Constraints
27
2/18/2024
i
j
i
i
j
i
j
j
i
To find a solution: ensure there is no overlap between each pair of cells
and all the cells are placed inside the grid (skipped here)
PEG PDS DDI
27/11
Solving Placement with Optimization Modulo Bitvectors (OBV)
28
2/18/2024
A BV variable for the net size for each net:
i
1
2
3
4
5
1
2
3
4
5
The OBV target T = n1+n2+…+nN
OBV goal: minimize T
PEG PDS DDI
28/11
Solving OBV(F,T) with SAT-based Linear Search
29
2/18/2024
PEG PDS DDI
29/11
Polosat for Placement
Integration: Polosat invocations replace SAT invocations inside linear search
Observables B = all the bits of {n1, n2, …, nN}; ψ is monotone in B
A BV variable for the net size for each net:
1
2
3
4
5
1
2
3
4
5
The OBV target T = n1+n2+…+nN
PEG PDS DDI
30/11
Experimental Results: Industrial Cell Placement Benchmarks (our TACAS’21 paper)
31
2/18/2024
PEG PDS DDI
31/11
32
2/18/2024
PEG PDS DDI
32/11
Polosat for MaxSAT: our FMCAD’20 Paper
Integrated into the anytime MaxSAT solver TT-Open-WBO-Inc
Integration: replaced SAT invocations by Polosat invocations
Used adaptive strategy to stop Polosat forever, when it gets too slow
33
2/18/2024
PEG PDS DDI
33/11
Polosat for MaxSAT: Results
34
2/18/2024
Benchmarks: 297 MSE’19 benchmarks in weighted, incomplete categories
Timeout: 1800 sec.
Score: [0, 1]: 1 is the best
Solvers:
Polosat
NoComb: A Polosat variation
NoCC: A Polosat variation
TT-Open-WBO-Inc: MSE’19 winner
NoAdapt: No adaptive strategy
Loandra: MSE’19 runner-up
Main Observation:
Polosat substantially improves TT-Open-WBO-Inc!
PEG PDS DDI
34/11
Polosat: Status
Enabler for solving industrial optimization problems at Intel
Default in state-of-the-art anytime MaxSAT solvers
Recently shown to boost Pseudo-Boolean (PB) Optimization
Markus Iser , Jeremias Berg, Matti Järvisalo:�Oracle-Based Local Search for Pseudo-Boolean Optimization. ECAI 2023: 1124-1131
PEG PDS DDI
35/11
Solving Complex (Non-Linear) Optimization Problems is an Opportunity for the SAT Community!
Currently, SAT-based verification comprises SAT’s heaviest industrial usage
But what about industrial optimization problems?
Alternative: mixed-integer nonlinear programming (MINP)
A SAT-based solution is already productized @ Intel for placement and scheduling!
PEG PDS DDI
36/11
Backup
PEG PDS DDI
37/11
SAT Application Examples
38
2/18/2024
SAT@
PEG PDS DDI
38/11
IntelSAT Concepts
Incremental Lazy Backtracking (ILB)
Reimplication: new core SAT algorithm
Trail implemented as doubly-linked list (rather than stack) to facilitate CB & reimplication
New heuristics (query-driven tuning, subsumption-based flipped clause filtering, incr. score reboot)
No heavy algorithms, such as, inprocessing and vivification
39
2/18/2024
PEG PDS DDI
39/11
Solving Complex Optimization Problems with SAT: �Ideas for Future Research
Classic (non-SAT-based) local search
Dedicated algorithms for sub-classes of optimization functions
Going beyond SAT and Pseudo-Boolean constraints
Finding more applications
PEG PDS DDI
40/11