Upload
adrian-mason
View
233
Download
0
Tags:
Embed Size (px)
Citation preview
““Predicting Learnt Predicting Learnt Clauses Quality in Clauses Quality in
Modern SAT Solvers”Modern SAT Solvers”&&
“Blocked Clause “Blocked Clause Elimination”Elimination”
Ateeq SharfuddinAteeq Sharfuddin
CS 297: Championship AlgorithmsCS 297: Championship Algorithms
TopicsTopics
1.1. Audemard, G. and Simon, L. Audemard, G. and Simon, L. “Predicting Learnt Clauses Quality “Predicting Learnt Clauses Quality in Modern SAT Solvers.”in Modern SAT Solvers.”
2.2. Järvisalo, M. et al. “Blocked Clause Järvisalo, M. et al. “Blocked Clause Elimination.”Elimination.”
Basic SAT BackgroundBasic SAT Background
Given a Boolean variable Given a Boolean variable xx, there are two , there are two literals:literals:
xx ((a positive literal)a positive literal)
-x-x (a negative literal)(a negative literal)
A A clauseclause is a disjunction of literals: is a disjunction of literals:-x-x + + yy
A CNF formula is a conjunction of clauses:A CNF formula is a conjunction of clauses:((--xx + + yy) () (a a ++ xx + + -b)-b)
Audemard and Simon’s Audemard and Simon’s paper (1)paper (1)
Specific to Conflict Directed Clause Specific to Conflict Directed Clause Learning (CDCL) solvers.Learning (CDCL) solvers.
Describes results of experiments Describes results of experiments exploiting a phenomenon in CDCL solvers exploiting a phenomenon in CDCL solvers (on industrial problems).(on industrial problems).
Describes a static measure to quantify Describes a static measure to quantify “learnt clause” usefulness.“learnt clause” usefulness.
Introduces this measure to CDCL solvers.Introduces this measure to CDCL solvers. Compares performance of the GLUCOSE Compares performance of the GLUCOSE
solvers with other current state-of-art solvers with other current state-of-art solvers.solvers.
Conflict Directed Clause Conflict Directed Clause Learning (CDCL)Learning (CDCL)
Basic Idea:Basic Idea: When backtracking, add new clauses When backtracking, add new clauses
corresponding to causes of failure of corresponding to causes of failure of the search.the search.
A typical branch of a CDCL solver: a A typical branch of a CDCL solver: a sequence of decisions followed by sequence of decisions followed by propagations, repeated until a propagations, repeated until a conflict is reached [1].conflict is reached [1].
Modern SAT Solvers (1)Modern SAT Solvers (1) Not much new development since:Not much new development since:
zChaff (2001), an efficient implementation of DPLLzChaff (2001), an efficient implementation of DPLL MINISAT (2005)MINISAT (2005)
Most solvers are essentially a rehash of zChaff, Most solvers are essentially a rehash of zChaff, with data structure tricks and a few minor with data structure tricks and a few minor improvements likeimprovements like Phase caching (Pipatsrisawat et al. 2007)Phase caching (Pipatsrisawat et al. 2007) Luby restarts (Huang, 2007)Luby restarts (Huang, 2007)
Modern SAT solvers focus on reaching conflicts Modern SAT solvers focus on reaching conflicts as soon as possible:as soon as possible: Boolean Constraint PropagationBoolean Constraint Propagation (BCP) (BCP) Variable State Independent Decaying SumVariable State Independent Decaying Sum (VSIDS) (VSIDS)
heuristics.heuristics.
Boolean Constraint Boolean Constraint PropagationPropagation
The iterative process of setting all The iterative process of setting all unit literals the value unit literals the value truetrue until until encountering an empty clause or no encountering an empty clause or no unit clause remains in the formula.unit clause remains in the formula.
““Heart” of modern SAT solvers [1].Heart” of modern SAT solvers [1].
Variable State Independent Variable State Independent Decaying Sum (VSIDS) Decaying Sum (VSIDS)
heuristicsheuristics Favors variables that are used recently Favors variables that are used recently
and used often.and used often. Used in conflict analysis and Used in conflict analysis and
determining future learnt clause determining future learnt clause usefulness.usefulness.
Solvers tend to let the maximum number Solvers tend to let the maximum number of learnt clauses grow exponentially, as of learnt clauses grow exponentially, as deleting a useful clause can have deleting a useful clause can have dramatic effect on performance.dramatic effect on performance.
Audemard and Simon’s Audemard and Simon’s First ExperimentFirst Experiment
Ran MINISAT on a selection of benchmarks from last SAT Ran MINISAT on a selection of benchmarks from last SAT contests and races.contests and races.
Each time a conflict Each time a conflict xxcc is reached for a benchmark, store is reached for a benchmark, store decision level decision level yyll..
Limit the search to two million conflicts.Limit the search to two million conflicts. Compute a simple least-square linear regression Compute a simple least-square linear regression
(characteristic line, formula: (characteristic line, formula: yy = = mx mx + + bb) on the set of ) on the set of points (points (xxcc, , yyll).).
If If mm is negative, decision levels decrease during the is negative, decision levels decrease during the search.search.
If If mm is negative, when the solver will finish the search can is negative, when the solver will finish the search can be trivially “predicted.”be trivially “predicted.”
If the solver follows the characteristic line, the solver will If the solver follows the characteristic line, the solver will finish when this line intersects the finish when this line intersects the xx-axis.-axis.
This point is called the “look-back justification” point and This point is called the “look-back justification” point and has coordinates (-has coordinates (-bb//mm, 0)., 0).
Table 1: Decision Level Table 1: Decision Level DecreaseDecrease
Series #Benchs % Decr. −b/m(> 0) Reduc.
een 8 62% 1.1e3 1762%goldb 11 100% 1.4e6 93%grieu 7 71% 1.3e6 −hoons 5 100% 7.2e4 123%ibm-2002 7 71% 4.6e4 28%ibm-2004 13 92% 1.9e5 52%manol-pipe 55 91% 1.9e5 64%miz 13 0% − −schup 5 80% 4.8e5 32%simon 10 90% 1.1e6 50%vange 3 66% 4.0e5 6%velev 54 92% 1.5e5 81%all 199 83% 3.2e5 68%
# of benchmarks in series
% of benchmarks that exhibit a decreasing of decision levels
Median values of xc
Always increasing
HypothesesHypotheses
1.1. The solver follows a linear The solver follows a linear decreasing of its decision levels decreasing of its decision levels (this was found to be false).(this was found to be false).
2.2. Finding a contradiction or a Finding a contradiction or a solution gives the same solution gives the same look-back look-back justificationjustification
3.3. The solution (or contradiction) is The solution (or contradiction) is not found by chance at any point of not found by chance at any point of the computation.the computation.
Experimental ResultsExperimental Results The phenomenon seems to hold true for almost all The phenomenon seems to hold true for almost all
industrial problems.industrial problems. The phenomenon does hold for the “mizh” series The phenomenon does hold for the “mizh” series
of industrial problems, which encode of industrial problems, which encode cryptographic problems (100% increasing for this cryptographic problems (100% increasing for this series).series).
Strong relationship between Strong relationship between look-back look-back justificationjustification and effective number of conflicts and effective number of conflicts needed to solve the problem: bounded between needed to solve the problem: bounded between 0.90 and 8.33 times the real number of conflicts 0.90 and 8.33 times the real number of conflicts needed to solve the problem.needed to solve the problem.
In most cases, the justification is 1.37 times the In most cases, the justification is 1.37 times the effective number of conflicts.effective number of conflicts.
CDCL solvers enforce the decision level to CDCL solvers enforce the decision level to decrease along the line.decrease along the line.
Justification vs ConflictsJustification vs Conflicts
Historical justification of needed conflicts vs effective # of conflicts reached
Conclusions from First Conclusions from First ExperimentExperiment
Results indicates that CDCL solvers do not Results indicates that CDCL solvers do not come to the solution come to the solution suddenlysuddenly..
On SAT instances, the solver does not On SAT instances, the solver does not correctly correctly guess guess a value for a literal, but a value for a literal, but learns that the opposite value leads to a learns that the opposite value leads to a contradiction.contradiction.
If the part of the learning schema that If the part of the learning schema that enforces this decreasing can be identified:enforces this decreasing can be identified: Perhaps speed-up the decreasingPerhaps speed-up the decreasing Perhaps identify in advance the clauses that Perhaps identify in advance the clauses that
play this part and protect them against clause play this part and protect them against clause deletion.deletion.
Measuring Learnt Clause Measuring Learnt Clause QualityQuality
All literals from the same level are All literals from the same level are called “blocks” of literals.called “blocks” of literals.
There is a chance they are linked There is a chance they are linked with each other by direct with each other by direct dependencies.dependencies.
The learning schema should add The learning schema should add links between these independent links between these independent blocks of literals.blocks of literals.
Literals Blocking Literals Blocking DistanceDistance
Given a clause Given a clause CC and a partition of its literals and a partition of its literals into into nn subsets according to the current subsets according to the current assignment such that the literals are partitioned assignment such that the literals are partitioned with respect to their decision level, the LBD of with respect to their decision level, the LBD of CC is exactly is exactly nn..
LBD for each learnt clause is stored – this is LBD for each learnt clause is stored – this is static.static.
““Glue Clauses” Glue Clauses” learnt clauses of LBD 2learnt clauses of LBD 2 Only contain one variable of the last decision level Only contain one variable of the last decision level
(First Unique Implication Point).(First Unique Implication Point). This variable will be “glued” with the block of literals This variable will be “glued” with the block of literals
propagated above.propagated above.
Unique Implication PointUnique Implication Point
A vertex in the implication graph A vertex in the implication graph that dominates both vertices that dominates both vertices corresponding to the literals of the corresponding to the literals of the conflicting variable.conflicting variable.
Experiment on LBDExperiment on LBD
Run MINISAT on the set of SAT-Run MINISAT on the set of SAT-Race 06 benchmarks.Race 06 benchmarks.
For each learnt clause, measure the For each learnt clause, measure the number of times “it” (glue clause) number of times “it” (glue clause) was useful in unit-propagation and was useful in unit-propagation and conflict analysis.conflict analysis.
LBD Experiment Result LBD Experiment Result
Conclusions of LBD Conclusions of LBD ExperimentExperiment
40% of the unit propagation on learnt 40% of the unit propagation on learnt clauses are done on glue clausesclauses are done on glue clauses
Whereas 20% are done on clauses of Whereas 20% are done on clauses of size 2.size 2.
Half of the learnt clauses used in the Half of the learnt clauses used in the resolution mechanism during all resolution mechanism during all conflict analysis have LBD < 6.conflict analysis have LBD < 6.
Whereas clauses of size smaller than Whereas clauses of size smaller than 13 are needed for the same result.13 are needed for the same result.
Aggressive clauses Aggressive clauses deletiondeletion
CDCL solvers performance is tied to CDCL solvers performance is tied to clause database management.clause database management. Keeping too many clauses will decrease the Keeping too many clauses will decrease the
BCP efficiency.BCP efficiency. Cleaning too many will break the overall Cleaning too many will break the overall
learning benefit.learning benefit. Good learnt clauses are identified by Good learnt clauses are identified by
VSIDS heuristics.VSIDS heuristics. Solvers often let clauses set grow exponentially Solvers often let clauses set grow exponentially
to prevent good clauses from being deleted.to prevent good clauses from being deleted. This scheme deteriorates on hard instances, This scheme deteriorates on hard instances,
making some hard instances even harder to making some hard instances even harder to solve.solve.
Aggressive cleaning Aggressive cleaning strategystrategy
No matter the size of the initial No matter the size of the initial formula, remove half of the learnt formula, remove half of the learnt clauses (asserting clauses are kept) clauses (asserting clauses are kept) every 20,000 + 500every 20,000 + 500xx conflicts, conflicts, where where xx is the number of times this is the number of times this deletion was previously performed.deletion was previously performed.
MINISAT with different MINISAT with different deletion strategiesdeletion strategies
#N (sat-unsat) #avg time
MINISAT 70 (35 – 35) 209MINISAT +ag 74 (41 – 33) 194MINISAT +lbd 79 (47 – 32) 145MINISAT +ag+lbd 82 (45 – 37) 175
(200 benchmarks from SAT Race 2006, time out of 1000 seconds)
GLUCOSEGLUCOSE The ideas described in previous slides The ideas described in previous slides
were embedded into MINISAT with Luby were embedded into MINISAT with Luby restarts strategy with phase savings.restarts strategy with phase savings.
This solver is called “GLUCOSE” for its This solver is called “GLUCOSE” for its ability to detect and keep “Glue Clauses.”ability to detect and keep “Glue Clauses.”
Two tricks were added:Two tricks were added: Each time a learnt clause is used in unit-Each time a learnt clause is used in unit-
propagation, a new LBD score is computed propagation, a new LBD score is computed and updated.and updated.
Increase the score of variables of the learnt Increase the score of variables of the learnt clause that were propagated by a glue clause.clause that were propagated by a glue clause.
Table comparing performances against Table comparing performances against other SAT solvers.other SAT solvers.
PerformancePerformance
DataData
Solver #N (SAT-UNSAT) #U #BZCHAFF 01 84 (47 – 37) 0 13ZCHAFF 04 80 (39 – 41) 0 5MINISAT+ 136 (66 – 74) 0 15MINISAT 132 (53 – 79) 1 16PICOSAT 153 (75 – 78) 1 26RSAT 139 (63 – 75) 1 14GLUCOSE 176 (75 – 101) 22
68
#U: number of times where the solver is the only one to solve an instance#B: number of times where the solver is the fastest solver
Blocked Clause Blocked Clause EliminationElimination
Conceived by Matti Järvisalo, Armin Biere, Conceived by Matti Järvisalo, Armin Biere, Marijn Heule.Marijn Heule.
Studies the effectiveness of BCE on standard Studies the effectiveness of BCE on standard CNF encodings of circuitsCNF encodings of circuits
Achieves the same level of simplifications as a Achieves the same level of simplifications as a combination of :combination of : CNF encodings CNF encodings
Tseitin CNF encoding for circuitsTseitin CNF encoding for circuits Plaisted-Greenbaum encodingPlaisted-Greenbaum encoding
Circuit-Level simplificationsCircuit-Level simplifications cone of influencecone of influence non-shared input eliminationnon-shared input elimination monotone input reductionmonotone input reduction
Blocking Literal / ClauseBlocking Literal / Clause
A literal A literal xx in a clause in a clause CC of a CNF of a CNF F F blocks blocks CC if for every clause if for every clause CC’’ F F withwith --x x CC’, the resolvent (’, the resolvent (CC \ { \ {xx}) }) ∪ (C’ \ {-∪ (C’ \ {-xx}) obtained from resolving }) obtained from resolving CC and and CC’ on ’ on xx is a tautology. is a tautology.
A clause is blocked if it has a literal A clause is blocked if it has a literal that blocks it.that blocks it.
ExampleExample
Given CNF Given CNF FF: (: (aa + + bb) () (aa - b- b - - cc)(-)(-aa + + cc))
Clauses: Clauses: CC11 = { = {aa, , bb}, }, CC22 = { = {aa, -, -bb, -, -cc}, }, CC33 = {- = {-aa, , cc}.}.
Literal Literal aa does not block does not block CC11 since { since {bb}∪{}∪{cc} is not a } is not a tautology.tautology.
Literal Literal bb does not block does not block CC11 since { since {aa}∪{}∪{aa, -, -cc} is not a } is not a tautology.tautology.
Literal Literal aa blocks blocks CC22 since {- since {-bb, -, -cc}∪{}∪{cc} is a tautology.} is a tautology. Literal -Literal -cc blocks blocks CC22 since { since {aa, -, -bb}∪{-}∪{-aa} is a tautology.} is a tautology. Literal Literal cc blocks blocks CC33 since as is { since as is {aa,-,-bb} ∪{-} ∪{-aa} is a } is a
tautology.tautology.
BCE (continued)BCE (continued)
Removal of an arbitrary blocked clause Removal of an arbitrary blocked clause by BCE still preserves satisfiability.by BCE still preserves satisfiability.
A literal A literal xx cannot block any clause if cannot block any clause if the CNF contains the unit clause {-the CNF contains the unit clause {-xx}.}.
If clause If clause CC in CNF in CNF FF is blocked, any is blocked, any clause clause CC’ ’ FF where where CC’ ≠ ’ ≠ CC that is that is blocked in blocked in FF is also blocked in is also blocked in FF\{\{CC}.}.
Pure Literal Elimination by Pure Literal Elimination by BCEBCE
Given a CNF Given a CNF FF, a literal , a literal xx occurring occurring in in FF is pure if - is pure if -xx does not occur in does not occur in FF..
Pure Literal Elimination (PL): While Pure Literal Elimination (PL): While there is a pure literal there is a pure literal xx in in FF, remove , remove all clauses containing all clauses containing xx from from FF..
BCE is at least as effective as PL: A BCE is at least as effective as PL: A pure literal blocks all clauses which pure literal blocks all clauses which contain it by definition.contain it by definition.
ExperimentsExperiments Evaluated how much reduction can be Evaluated how much reduction can be
achieved using BCE with VE and various achieved using BCE with VE and various circuit encoding techniques.circuit encoding techniques.
Reduction measured in the size of the Reduction measured in the size of the CNF before and after preprocessing, and CNF before and after preprocessing, and gain in the number of instances solved.gain in the number of instances solved.
292 CNFs from SAT 2009 application 292 CNFs from SAT 2009 application track.track.
Time limit of 900 seconds.Time limit of 900 seconds. Used PrecoSAT v236 and PicoSAT v918.Used PrecoSAT v236 and PicoSAT v918.
ResultsResults
Umm, results… inconclusive.Umm, results… inconclusive. Reducing the size of a CNF by Reducing the size of a CNF by
preprocessing does not necessarily preprocessing does not necessarily lead to faster running times.lead to faster running times.
Running preprocessing until Running preprocessing until completion takes a considerable completion takes a considerable portion of the 90 seconds limit.portion of the 90 seconds limit.
ResultsResults
S = SAT’09 competition, A = structural SAT track, H = HWMCC’08, B = bit-blasted bit-vector problems from SMT-Lib, T = S = SAT’09 competition, A = structural SAT track, H = HWMCC’08, B = bit-blasted bit-vector problems from SMT-Lib, T = Tseitin, P = Plaisted-Greenbaum, M = Minicirc, N = NiceDAG, U = unknown for S, t = time in seconds spent in one Tseitin, P = Plaisted-Greenbaum, M = Minicirc, N = NiceDAG, U = unknown for S, t = time in seconds spent in one encoding/preprocessing phase, V = sum of number of variables (in millions), C = sum of number of clauses in millions, encoding/preprocessing phase, V = sum of number of variables (in millions), C = sum of number of clauses in millions, b = BCE, e = VE.b = BCE, e = VE.