Generating diverse solutions in sat
This presentation is the property of its rightful owner.
Sponsored Links
1 / 67

Generating Diverse Solutions in SAT PowerPoint PPT Presentation


  • 110 Views
  • Uploaded on
  • Presentation posted in: General

Generating Diverse Solutions in SAT. Alexander Nadel, Intel Israel IBM; Haifa, Israel October 31, 2011. Agenda. Introduction Analysis Polarity-based Algorithms Variable-based Algorithms Local Algorithms Global Algorithms Conclusion. Diverse k Set in SAT.

Download Presentation

Generating Diverse Solutions in SAT

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Generating diverse solutions in sat

Generating Diverse Solutions in SAT

Alexander Nadel, Intel Israel

IBM; Haifa, Israel

October 31, 2011


Agenda

Agenda

  • Introduction

  • Analysis

  • Polarity-based Algorithms

  • Variable-based Algorithms

    • Local Algorithms

    • Global Algorithms

  • Conclusion


Diverse k set in sat

DiversekSet in SAT

  • Given a propositional formula in CNF, generate a number of solutions that are as diverse as possible

    • A solution is a satisfying assignment

    • The threshold on the number of solutions is provided by the user


Diverse k set brief history

DiversekSet: Brief History

  • DiversekSet in CSP is studied since 2005

    • See the paper for references

  • DiversekSet in SAT

    • The first work is our FMCAD’10 paper on semi-formal FPV

      • Semi-formal FPV finds bugs in hardware that cannot be identified by other methods

      • DiversekSet is the prime reasoning engine

    • The problem has a number of additional applications at Intel

    • This work is thefirst full-blown paper


Algorithms for diverse k set in sat in a glance

Algorithms for DiversekSet in SAT in a Glance

  • The idea:

    • Adapt a modern CDCL SAT solver for DiversekSet

    • Make minimal changes to remain efficient

  • Compact algorithms:

    • Invoke the SAT solver once to generate all the solutions

    • Restart after a solution is generated

  • This work:

    • Diversity is achieved by modifying polarity and variable selection heuristics


Agenda1

Agenda

  • Introduction

  • Analysis

  • Polarity-based Algorithms

  • Variable-based Algorithms

    • Local Algorithms

    • Global Algorithms

  • Conclusion


Diversification quality as the average hamming distance

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2


Diversification quality as the average hamming distance1

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2


Diversification quality as the average hamming distance2

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2

1


Diversification quality as the average hamming distance3

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2

1

2


Diversification quality as the average hamming distance4

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2

1

2

1


Diversification quality as the average hamming distance5

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2

1

2

1

3


Diversification quality as the average hamming distance6

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2

1

2

1

3

Hamming Distance

Variables

Solutions


Diversification quality as the average hamming distance7

Diversification Quality as the Average Hamming Distance

  • Quality: the average Hamming distance between the solutions, normalized to [0…1]

Hamming distances matrix

a b c

10 0 0

21 1 0

30 1 1

41 0 0

2

2

1

2

1

3


Quality via variable contribution

Quality via Variable Contribution

  • We formulate an alternative definition forthe same notion ofquality:

    • Induces quality-efficient polarity and variable selection strategies by:

      • Allowing one to estimate the contribution of each variable to quality online

      • Inducing methods to improve the quality online


Variable quality

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 0

Start counting…

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Variable quality for a

Different: update Sa!


Variable quality1

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 1

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality2

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 1

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Equal: do not update Sa


Variable quality3

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 1

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality4

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 2

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality5

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 2

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality6

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 3

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality7

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 3

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Equal: do not update Sa


Variable quality8

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 3

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality9

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 4

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Different: update Sa!


Variable quality10

Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 4

a b c

10 0 0

21 1 0

30 1 1

41 0 0


A simple way to calculate variable quality

A Simple Way to Calculate Variable Quality

  • Variable Quality: the number of different pairs, that is {0,1} or {1,0}, amongst distinct pairs of values assigned to the variable

Sa = 4

a b c

10 0 0

21 1 0

30 1 1

41 0 0

Sv= pv nv

Number of 1’s assigned to v

Number of 0’s assigned to v


Quality via variable quality

Quality via Variable Quality

  • Quality: the average variable quality, normalized to [0…1]:


Why the definitions are identical

Why the Definitions are Identical?

  • Both definitions of quality sum up the number of different pairs of values assigned to variables


Why the definitions are identical1

Why the Definitions are Identical?

  • Hamming distance-based definition

    • Counts the number of different pairs per each pair of rows

a b c

10 0 0

21 1 0

30 1 1

41 0 0


Why the definitions are identical2

Why the Definitions are Identical?

  • Variable quality-based definition

    • Counts the number of different pairs per variable, that iscolumn by column

a b c

10 0 0

21 1 0

30 1 1

41 0 0


Quality via variable quality1

Quality via Variable Quality

  • Quality: the average variable quality, normalized to [0…1]:

  • This definition induces DiversekSetalgorithms that improve quality online, e.g.:

    • Polarity-based algorithm:

      • For a decision variable, pick a polarity that maximizes variable quality after the assignment

        • The current partial assignment is taken into account as a solution when calculating quality online

      • A simple way to keep track of which polarity maximizes variable quality is provided next


Variable potential

Variable Potential

  • Variable Potential: difference between the number of 1’s and 0’s assigned to a variable:

v = pv- nv


Variable potential1

Variable Potential

  • Variable Potential: difference between the number of 1’s and 0’s assigned to a variable:

a b c

10 0 0

21 1 0

30 1 1

41 0 0

 0 0 -2

v = pv- nv


Relation between potential and quality

Relation between Potential and Quality

  • The closer variable potential to 0 the higher variable quality

    • v = pv– nv= pv– (m – pv)= 2pv – m

    • Sv= pv nv= pv (m – pv) = mpv – pv2


Relation between potential and quality1

Relation between Potential and Quality

  • The closer variable potential to 0 the higher variable quality

    • Sv= pv nv= pv (m – pv) = mpv – pv2

    • v = pv– nv= pv– (m – pv)= 2pv – m

v = 0; Svis max


Relation between potential and quality2

Relation between Potential and Quality

  • The closer variable potential to 0 the higher variable quality

    • Sv= pv nv= pv (m – pv) = mpv – pv2

    • v = pv– nv= pv– (m – pv)= 2pv – m

Absolute potential moves away from 0; Variable quality drops


Agenda2

Agenda

  • Introduction

  • Analysis

  • Polarity-based Algorithms

  • Variable-based Algorithms

    • Local Algorithms

    • Global Algorithms

  • Conclusion


Pguide a dedicated compact polarity based algorithm

pGuide: a Dedicated Compact Polarity-based Algorithm

  • Compactness:

    • The SAT solver is invoked once

    • The solver restarts upon new solution

  • Only the polarity selection heuristic is modified

  • pGuide’s polarity selection heuristic:

    • If the potential is positive, pick 0

    • If the potential is negative, pick 1

    • If the potential is 0, pick a random value

  • Properties:

    • Always prefers the value that yields better quality (if such exists)

      • The potential is closer to 0  variable quality improves  overall quality improves

    • Yields the best possible quality given a tautological formula

      • Can be easily proven by induction on the number of solutions


Prand a randomized compact polarity based algorithm

pRand : a Randomized Compact Polarity-based Algorithm

  • Chooses the polarity randomly

  • Unlike pGuide, might choose a polarity which yields worse quality that the second polarity


Pguide vs prand on tautological formulas

pGuide vs. pRand on Tautological Formulas

  • pGuide picks values r0,r0’, r1,r1’, r2,r2’, … for every variable

  • pRand picks random values

  • For 2 solutions:

    • The quality is:

      • 1 for pGuide: {0, 1} or {1,0}

      • 0.5 for pRand: {0, 0} or {0, 1} or {1,0} or {1, 1} with equal probability


Pguide vs prand on tautological formulas1

pGuide vs. pRand on Tautological Formulas

Even m

pGuide

Odd m

pRand:


Quality comparison between pguide and prand

Quality Comparison between pGuide and pRand


Our experimental setup

Our Experimental Setup

  • 66 instances from semi-formal FPV

    • Stats:

      • Variables: 213,047 to 910,868

      • Clauses: 738,862 to 3,251,382

    • All the instances are available by email

  • Machines:

    • Intel Xeon

      • 4Ghz CPU frequency

      • 32Gb memory


Quality comparison between pguide and prand1

Quality Comparison between pGuide and pRand

  • pGuide is clearly preferable to pRand, especially for a small number of solutions

  • There is a resemblance between the quality function on tautological and real-life formulas

  • The quality for real-life formulas is significantly lower

  • How one can improve the quality on real-life formulas?


Pbcpguide a bcp aware compact polarity based algorithm

pBCPGuide: a BCP-aware Compact Polarity-based Algorithm

  • The idea: take constraints into account by considering the impact of Boolean Constraint Propagation (BCP)

  • For a newly selected decision variable:

    • For each polarity   {0,1}

      • Pick 

      • Propagate with BCP

      • Write down the quality Q

      • Undo

    • Pick the polarity with larger Q

  • It is sufficient to measure the delta in the absolute value of the variable potentials for step (3): the lower delta the better quality


Pbcpguide more

pBCPGuide: More

  • Plain pBCPGuide is too costly in terms of performance

    • Performs BCP 2 or 3 times per decision

  • Optimizations:

    • Continue with the second polarity if it yields better quality (instead of undoing) to save a BCP

    • The first polarity should be the inferior one in terms of the impact on variable quality of the decision variable

      • To increase the chances that the second polarity yields better quality, in which case only 2 BCPs are required

  • pBCPGuide_T

    • Use pBCPGuide until T conflicts are encountered from the moment when either:

      • The search is started

      • A new solution is discovered

    • Switch to pGuide after the threshold is reached


Polarity based algorithms empirical comparison summary

Polarity-based Algorithms: Empirical Comparison Summary

  • pGuide is preferable to pRandin terms of both quality and run-time

  • pBCPGuide_T is preferable to pGuide in terms of quality, but pays fee in terms of performance

  • T regulates the trade-off between quality and run-time

  • pBCPGuide_100 seems to achieve an attractive balance between run-time and quality


Agenda3

Agenda

  • Introduction

  • Analysis

  • Polarity-based Algorithms

  • Variable-based Algorithms

    • Local Algorithms

    • Global Algorithms

  • Conclusion


Variable based algorithms

Variable-based Algorithms

  • The idea: change the variable ordering to improve the quality

  • Trade-off between run-time and quality:

    • The better quality the worse run-time

    • We provide ways to control the trade-off

  • Our variable-based algorithms are built on top of polarity-based algorithms


Background cbh decision heuristic

Background: CBH Decision Heuristic

  • All the clauses are organized in a list

    • Both initial and conflict clauses

  • The next decision variable is picked from the top-most unsatisfied clause

    • VSIDS is used to decide which variable to pick

  • Upon conflict, the following clauses are placed in the top:

    • The new conflict clause, followed by

    • Clauses that participated in its resolution generation


Classification of variable based methods

Classification of Variable-based Methods

  • Local vs. Global

    • With respect to the default variable ordering

  • Guided vs. Randomized

    • Guiding the solver away from previous solutions vs. using randomization over variables

    • pGuide vs. pBCPGuide_100

    • The underlying polarity-based algorithm


Classification of variable based methods1

Classification of Variable-based Methods

pBCPGuide_100

Guided

pGuide

Random.

Local

Global


Agenda4

Agenda

  • Introduction

  • Analysis

  • Polarity-based Algorithms

  • Variable-based Algorithms

    • Local Algorithms

    • Global Algorithms

  • Conclusion


Generating diverse solutions in sat

  • Pick variable with the highest absolute value of potential from the top-most non-satisfied clause

    • Guided: the higher absolute potential the better quality after the assignment

    • Local: makes only minimal modification to the default decision heuristic

      • Picks the variable from the same clause as the original CBH, but does not follow VSIDS within that clause

    • pGuide: uses pGuide for polarity selection

Local

Global

pBCPGuide_100

Guided

pGuide

Random.


Generating diverse solutions in sat

  • Pick variable at random from the top-most non-satisfied clause

    • Randomized: picks the variable at random

    • Local: picks the variable from the same clause as the original CBH, but does not follow VSIDS within that clause

    • pGuide: use pGuide for polarity selection

pBCPGuide_100

Guided

pGuide

Random.

Local

Global


Generating diverse solutions in sat

pBCPGuide_100

pBCPGuide_100

  • How to integrate pBCPGuide_T?

    • Run BCP for each polarity for a number of variables and pick the best?

      • Too expensive!

    • Use pBCPGuide_T as the polarity selection heuristic?

      • Yields a slight deterioration in quality as compared to plain pBCPGuide_T!

    • The solution: run plain pBCPGuide_T until the threshold, then switch to a variable-based strategy+pGuide

Local

Global

Guided

pGuide

Random.


Generating diverse solutions in sat

  • Local guided variable-based vs. plain polarity-based

    • Moderate improvement in quality for marginal run-time fee

  • Guided vs. randomized variable-based

    • The guided method yields faster run-time and better quality for a small number of solutions

    • The randomized method yields better quality for a large number of solutions

    • Breaking dependencies pays off, when the problem is well-explored


Agenda5

Agenda

  • Introduction

  • Analysis

  • Polarity-based Algorithms

  • Variable-based Algorithms

    • Local Algorithms

    • Global Algorithms

  • Conclusion


Generating diverse solutions in sat

pBCPGuide_100

pBCPGuide_100

  • Global methods: trade run-time for quality by getting away from the default decision heuristic

Guided

pGuide

Random.

Local

Global


Generating diverse solutions in sat

pBCPGuide_100

pBCPGuide_100

  • Pick the variable with the highest potential from N top-most clauses, including satisfied clauses

    • Guided: the higher potential the better quality after the assignment

    • Global: makes substantial modification to the default decision heuristic

  • Tie-breaking strategies target better performance by trying to get closer to the original CBH:

    • Prefer clauses closer to the top-most non-satisfied clauses

    • Prefer variables with higher VSIDS scores

Guided

pGuide

Random.

Local

Global


Generating diverse solutions in sat

pBCPGuide_100

pBCPGuide_100

  • Pick an unassigned variable at random in T% of the cases

    • Randomized: the variable choice in randomized

    • Global: makes substantial modification to the default decision heuristic

Guided

pGuide

Random.

Local

Global


Global variable based strategies results summary

Global Variable-based Strategies: Results Summary

  • Local vs. Global

    • Run-time: local came the best

    • Quality: global won

  • Guided vs. Randomized

    • Run-time: guided came the best

    • Quality: guided won for a low number of solutions; randomized won for a high number of solutions

  • Trade-off between quality and run-time:

    • Thresholds can be used for regulating the trade-off between quality and run-time for global strategies:

      • Numbers of clauses to consider for guided strategies

      • Percent of randomized decisions for randomized strategies


Recommended strategies

Recommended Strategies


Conclusion

Conclusion

  • DiversekSet in SAT: generate a user-given number of diverse solutions

    • Used in a number of prominent FV flows at Intel

  • Compact algorithms:

    • The SAT solver is invoked once

    • The solver restarts upon new solution

  • pGuide-- the fundamental polarity-based algorithm:

    • Only polarity selection strategy is modified

    • The goal is to balance the number of 1’s and 0’s assigned to each variable in the solutions

    • Yields optimal diversification quality given a tautological formula

  • On real-world formulas quality can be improved by taking BCP into account and adapting the variable ordering

  • One can trade run-time for quality

    • We demonstrated how to control the trade-off


Generating diverse solutions in sat

Thanks!


  • Login