Unformatted text preview: GRASP—A New Search Algorithm for Satisﬁability João P. Marques Silva
Karem A. Sakallah
CSETR29296
April 10, 1996 THE UNIVERSITY OF MICHIGAN
C omputer Science and Engineering Division
Department of Electrical Engineering and Computer Science
Ann Arbor, Michigan 481092122
USA GRASP—A New Search Algorithm for Satisﬁability
João P. Marques Silva
Karem A. Sakallah
Advanced Computer Architecture Laboratory
Department of Electrical Engineering and Computer Science
University of Michigan
Ann Arbor, Michigan 481092122
April 10, 1996 Abstract
This report introduces GRASP (Generic seaRch Algorithm for the Satisﬁability Problem), an integrated algorithmic framework for SAT that uniﬁes several previously proposed searchpruning techniques and facilitates identiﬁcation of additional
ones. GRASP is premised on the inevitability of conﬂicts during search and its most distinguishing feature is the augmentation
of basic backtracking search with a powerful conﬂict analysis procedure. Analyzing conﬂicts to determine their causes enables
GRASP to backtrack nonchronologically to earlier levels in the search tree, potentially pruning large portions of the search
space. In addition, by “recording” the causes of conﬂicts, GRASP can recognize and preempt the occurrence of similar conﬂicts later on in the search. Finally, straightforward bookkeeping of the causality chains leading up to conﬂicts allows GRASP
to identify assignments that are necessary for a solution to be found. Experimental results obtained from a large number of
benchmarks, including many from the ﬁeld of test pattern generation, indicate that application of the proposed conﬂict analysis techniques to SAT algorithms can be extremely effective for a large number of representative classes of SAT instances. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 1 1 Introduction
The Boolean satisﬁability problem (SAT) appears in many contexts in the ﬁeld of computeraided design of integrated circuits including automatic test pattern generation (ATPG), timing analysis, delay fault testing, and logic veriﬁcation, to name
just a few. Though wellresearched and widely investigated, it remains the focus of continuing interest because efﬁcient techniques for its solution can have great impact. SAT belongs to the class of NPcomplete problems whose algorithmic solutions
are currently believed to have exponential worst case complexity [11]. Over the years, many algorithmic solutions have been
proposed for SAT, the most well known being the different variations of the DavisPutnam procedure [5]. The best known version of this procedure is based on a backtracking search algorithm that, at each node in the search tree, elects an assignment
and prunes subsequent search by iteratively applying the unit clause and the pure literal rules [30]. Iterated application of the
unit clause rule is commonly referred to as Boolean Constraint Propagation (BCP) [30] or as derivation of implications in the
electronic CAD literature [1].
Most of the recently proposed improvements to the basic DavisPutnam procedure [2, 9, 10, 17, 28, 30] can be distinguished based on their decision making heuristics or their use of preprocessing or relaxation techniques. Common to all these
approaches, however, is the chronological nature of backtracking. Only in [19] is a nonchronological backtracking procedure
outlined for solving SAT, but it is only sketched and no experimental results are presented. Nevertheless, nonchronological
backtracking techniques have been extensively studied and applied to different areas of Artiﬁcial Intelligence, particularly
Truth Maintenance Systems (TMS) [7, 27], Constraint Satisfaction Problems (CSP) [6, 12, 13, 21] and Automated Deduction
[3], in some cases with very promising experimental results [6, 13].
Interest in the direct application of SAT algorithms to electronic design automation (EDA) problems has been on the rise
recently [4, 17, 20, 28]. In addition, improvements to the traditional structural (path sensitization) algorithms for some EDA
problems, such as ATPG, include searchpruning techniques that are also applicable to SAT algorithms in general [14, 16, 25].
This report introduces GRASP (Generic seaRch Algorithm for the Satisﬁability Problem), an integrated algorithmic
framework for SAT that uniﬁes several previously proposed searchpruning techniques and facilitates identiﬁcation of additional ones. GRASP is premised on the inevitability of conﬂicts during search and its most distinguishing feature is the augmentation of basic backtracking search with a powerful conﬂict analysis procedure. Analyzing conﬂicts to determine their
causes enables GRASP to backtrack nonchronologically to earlier levels in the search tree, potentially pruning large portions
of the search space. In addition, by “recording” the causes of conﬂicts, GRASP can recognize and preempt the occurrence of
similar conﬂicts later on in the search. Finally, straightforward bookkeeping of the causality chains leading up to conﬂicts
allows GRASP to identify assignments that are necessary for a solution to be found. Experimental results obtained from a
large number of benchmarks [8] indicate that application of the proposed conﬂict analysis techniques to SAT algorithms can
be extremely effective for a large number of representative classes of SAT instances.
Several features distinguish the conﬂict analysis procedure in GRASP from others used in TMSs and CSPs. First, conﬂict
analysis in GRASP is tightly coupled with BCP and the causes of conﬂicts need not necessarily correspond to decision assignments. Second, clauses can be added to the original set of clauses, and the number and size of added clauses is usercontrolled.
This is in explicit contrast with nogood recording techniques developed for TMSs and CSPs. Third, GRASP employs techniques to prune the search by analyzing the implication structure generated by BCP. Exploiting the “anatomy” of conﬂicts in
this manner has no equivalent in other areas. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 2 Some of the proposed techniques have also been applied in structural ATPG algorithms [14, 18, 26]. The GRASP framework, however, permits a uniﬁed representation of all known searchpruning methods and introduces several others. The basic
SAT algorithm in GRASP is also customizable to take advantage of applicationspeciﬁc characteristics to achieve additional
efﬁciencies [24, 25]. Finally, the framework is organized to allow easy adaptation of other algorithmic techniques, such as
those in [4, 16], whose operation is orthogonal to those described here.
The remainder of this report is organized in four sections. In Section 2, we introduce the basics of backtracking search,
particularly our implementation of BCP, and describe the overall architecture of GRASP. This is followed, in Section 3, by a
detailed discussion of the procedures for conﬂict analysis and how they are implemented. Extensive experimental results on a
wide range of benchmarks, including many from the ﬁeld of ATPG, are presented and analyzed in Section 4. In particular,
GRASP is shown to outperform two recent stateoftheart SAT algorithms [9, 28] on most, but not all, benchmarks. The report
concludes in Section 5 with some suggestions for further research. 2 Backtrack Search for CNF Satisﬁability
2.1 Basic Deﬁnitions and Notation
A conjunctive normal form (CNF) formula
on n binary variables x 1, …, x n is the conjunction (AND) of m clauses
, …, m each of which is the disjunction (OR) of one or more literals, where a literal is the occurrence of a variable or its
1
complement. A formula denotes a unique nvariable Boolean function f ( x 1, …, x n ) and each of its clauses corresponds to
an implicate of f [15, p. 288]. Clearly, a function f can be represented by many equivalent CNF formulas. A formula is complete if it consists of the entire set of prime implicates for the corresponding function. In general, a complete formula will have
an exponential number of clauses. We will refer to a CNF formula as a clause database and use “formula,” “CNF formula,”
and “clause database” interchangeably. The satisﬁability problem (SAT) is concerned with ﬁnding an assignment to the arguments of f ( x 1, …, x n ) that makes the function equal to 1 or proving that the function is equal to the constant 0.
n A backtracking search algorithm for SAT is implemented by a search process that implicitly traverses the space of 2
possible binary assignments to the problem variables. During the search, a variable whose binary value has already been determined is considered to be assigned; otherwise it is unassigned with an implicit value of X { 0, 1 } . A truth assignment for
a formula is a set of assigned variables and their corresponding binary values. It will be convenient to represent such assign{ ( x 1, 0 ), ( x 7, 1 ), ( x 13, 0 ) } . Alternatively, assignments can be denoted
ments as sets of variable/value pairs; for example A
{ x 1 0, x 7 1, x 13 0 } . Sometimes it is convenient to indicate that a variable x is assigned without specifying
as A
its actual value. In such cases, we will use the notation ( x ) to denote the binary value assigned to x. An assignment A is comn ; otherwise it is partial. Evaluating a formula
plete if A
for a given a truth assignment A yields three possible out1 and we say that
0 in which case
comes: A
is satisﬁed and refer to A as a satisfying assignment; A
is
X indicating that the value of
unsatisﬁed and A is referred to as an unsatisfying assignment; and A
cannot be
resolved by the assignment. This last case can only happen when A is a partial assignment. An assignment partitions the
clauses of
into three sets: satisﬁed clauses (evaluating to 1); unsatisﬁed clauses (evaluating to 0); and unresolved clauses
(evaluating to X). The unassigned literals of a clause are referred to as its free literals. A clause is said to be unit if the number
of its free literals is one. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 3 2.2 Formula Satisﬁability
Formula satisﬁability is concerned with determining if a given formula
is satisﬁable and with identifying a satisfying
assignment for it. Starting from an empty truth assignment, a backtrack search algorithm traverses the space of truth assignments implicitly and organizes the search for a satisfying assignment by maintaining a decision tree. Each node in the decision
tree speciﬁes an elective assignment to an unassigned variable; such assignments are referred to as decision assignments. A
decision level is associated with each decision assignment to denote its depth in the decision tree; the ﬁrst decision assignment
at the root of the tree is at decision level 1. The search process iterates through the steps of:
1. Extending the current assignment by making a decision assignment to an unassigned variable. This decision
process is the basic mechanism for exploring new regions of the search space. The search terminates successfully
if all clauses become satisfied; it terminates unsuccessfully if some clauses remain unsatisfied and all possible
assignments have been exhausted.
2. Extending the current assignment by following the logical consequences of the assignments made thus far. The
additional assignments derived by this deduction process are referred to as implication assignments or, more
simply, implications. The deduction process may also lead to the identification of one or more unsatisfied
clauses implying that the current assignment is not a satisfying assignment. Such an occurrence is referred to as
a conflict and the associated unsatisfying assignment is called a conflicting assignment.
3. Undoing the current assignment, if it is conflicting, so that another assignment can be tried. This backtracking
process is the basic mechanism for retreating from regions of the search space that do not correspond to
satisfying assignments.
The decision level at which a given variable x is either electively assigned or forcibly implied will be denoted by ( x ) . When
relevant to the context, the assignment notation introduced earlier may be extended to indicate the decision level at which the
v @ d would be read as “x becomes equal to v at decision level d.”
assignment occurred. Thus, x
The average complexity of the above search process depends on how decisions, deductions, and backtracking are made. It
also depends on the formula itself. The implications that can derived from a given partial assignment depend on the set of
available clauses. In general, a formula consisting of more clauses will enable more implications to be derived and will reduce
the number of backtracks due to conﬂicts. The limiting case is the complete formula that contains all prime implicates. For
such a formula no conﬂicts can arise since all logical implications for a partial assignment can be derived. This, however, may
not lead to shorter execution times since the size of such a formula may be exponential.
2.3 Function Satisﬁability
Given an initial formula many search systems attempt to augment it with additional implicates to increase the deductive
power during the search process. This is usually referred to as “learning” [22] and can be performed either as a preprocessing
step (static learning) or during the search (dynamic learning)1.
Our approach can be classiﬁed as a dynamic learning search mechanism based on diagnosing the causes of conﬂicts. It
considers the occurrence of a conﬂict, which is unavoidable for an unsatisﬁable instance unless the formula is complete, as an 1. Learning as deﬁned in [17, 22] only yields implicates of size 2 (i.e. nonlocal implications) but the concept can be readily
extended to implicates of arbitrary size. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 4 opportunity to “learn from the mistake that led to the conﬂict” and introduces additional implicates to the clause database only
when it stumbles. Conﬂict diagnosis produces three distinct pieces of information that can help speed up the search:
1. New implicates that did not exist in the clause database and that can be identified with the occurrence of the
conflict. These clauses may be added to the clause database to avert future occurrence of the same conflict and
represent a form of conflictbased equivalence (CBE).
2. An indication of whether the conflict was ultimately due to the most recent decision assignment or to an earlier
decision assignment.
a. If that assignment was the most recent (i.e. at the current decision level), the opposite assignment (if it has
not been tried) is immediately implied as a necessary consequence of the conflict; we refer to this as a
failuredriven assertion (FDA).
b. If the conflict resulted from an earlier decision assignment (at a lower decision level), the search can
backtrack to the corresponding level in the decision tree since the subtree rooted at that level corresponds
to assignments that will yield the same conflict. The ability to identify a backtracking level that is much
earlier than the current decision level is a form of nonchronological backtracking that we refer to as
conflictdirected backtracking (CDB), and has the potential of significantly reducing the amount of
search.
These conﬂict diagnosis techniques are discussed further in Section 3.
2.4 Structure of the Search Process
The basic mechanism for deriving implications from a given clause database is Boolean constraint propagation (BCP) [9,
1 . For any satisfying assignment to ,
( x ¬y ) and assume y
30]. Consider a formula containing the clause
1 implies x
1 due to . In general, given a unit clause ( l 1 … l k )
requires that x be equal to 1, and we say that y
1 since this represents the only possibility for the clause to be satisﬁed. If
of with free literal l j , consistency requires l j
lj
x , then the assignment x
1 is required; if l j
¬ x then x
0 is required. Such assignments are referred to as
logical implications (implications, for short) and correspond to the application of the unit clause rule proposed by M. Davis
and H. Putnam [5]. BCP refers to the iterated application of this rule to a clause database until the set of unit clauses becomes
empty or one or more clauses become unsatisﬁed.
( l 1 … l k ) . The antecedent assignment of x,
Let the assignment of a variable x be implied due to a clause
denoted as A ( x ) , is deﬁned as the set of assignments to variables other than x with literals in . Intuitively, A ( x ) designates
those variable assignments that are directly responsible for implying the assignment of x due to . For example, the anteced( x y ¬z ) are, respectively, A ( x )
{ y 0, z 1 } ,
ent assignments of x, y and z due to the clause
A( y)
{x
0, z 1 } , and A ( z )
{x
0, y 0 } . Note that the antecedent assignment of a decision variable is
empty.
The sequence of implications generated by BCP is captured by a directed implication graph I deﬁned as follows (see
Figure 21):
1. Each vertex in I corresponds to a variable assignment x ( x) . CSETR29296: GRASP—A New Search Algorithm for Satisfiability Current Truth Assignment: { x9 0 @ 1, x 10 Current Decision Assignment: { x1 5 [email protected]} 1 ( ¬x 1
( ¬x 1 x3 3 ( ¬x 2 ¬x 3 4 ( ¬x 4 x5 x 10 ) 5 ( ¬x 4 x6 x 11 ) 0 @ 3, x 12 1 @ 2, x 13 [email protected]} x2 ) 2 0 @ 3, x 11 6 ( ¬x 5 7 ( x1 x7 8 ( x1
( ¬x 7 x4 ) 6
6 3
2 [email protected] x6 2 x9 Clause Database conﬂict 5 x3 ¬ x 13 ) κ [email protected] x4 ¬ x 12 ) ¬x 8 3 [email protected] ¬x 6 ) [email protected] x5
4 1 x1 [email protected]
4 [email protected] x2 x8 ) 9 x 10 x9 ) [email protected] 5 [email protected] x 11 [email protected] Implication Graph I for Current Decision Assignment Figure 21: Example of clause database and partial implication graph
2. The predecessors of vertex x
( x ) in I are the antecedent assignments A ( x ) corresponding to the unit clause
that led to the implication of x. The directed edges from the vertices in A ( x ) to vertex x
( x ) are all
labeled with . Vertices that have no predecessors correspond to decision assignments.
3. Special conflict vertices are added to I to indicate the occurrence of conflicts. The predecessors of a conflict
vertex correspond to variable assignments that force a clause to become unsatisfied and are viewed as the
antecedent assignment A ( ) . The directed edges from the vertices in A ( ) to are all labeled with .
The decision level of an implied variable x is related to those of its antecedent variables according to:
( x) max { (y) ( y, ( y ) ) A( x) } (2.1) 2.5 Search Algorithm Template
The general structure of the GRASP search algorithm is shown in Figure 22. We assume that an initial clause database
and an initial assignment A, at decision level 0, are given. This initial assignment, which may be empty, may be viewed as an
additional problem constraint and causes the search to be restricted to a subcube of the ndimensional Boolean space. As the
search proceeds, both and A are modiﬁed. The recursive search procedure consists of four major operations:
1. Decide(), which chooses a decision assignment at each stage of the search process. Decision procedures are
commonly based on heuristic knowledge. For the results given in Section 4, the following greedy heuristic is
used: CSETR29296: GRASP—A New Search Algorithm for Satisfiability // Global variables: Clause database
Partial variable assignment A
FAILURE or SUCCESS
Backtracking decision level //
// Return value:
// Auxiliary variables:
//
GRASP()
{
return ((Search (0,
} ) != SUCCESS) // Input argument:
// Output argument:
// Return value:
// ? FAILURE : SUCCESS); Current decision level d
Backtracking decision level
CONFLICT or SUCCESS Search (d, & )
{
if (Decide (d) == SUCCESS)
return SUCCESS;
while (TRUE) {
if (Deduce (d) != CONFLICT) {
if (Search (d + 1,
) == SUCCESS) return SUCCESS;
else if (
!= d) { Erase(); return CONFLICT;}
}
if (Diagnose (d,
) == CONFLICT) {Erase(); return CONFLICT;}
Erase();
}
}
Figure 22: Description of GRASP
At each node in the decision tree evaluate the number of clauses directly satisfied by each assignment to each
variable. Choose the variable and the assignment that directly satisfies the largest number of clauses.
Other decision making procedures have been implemented in the GRASP algorithmic framework, particularly
those described in [9]. For these heuristics, preference is given to assignments that simplify the clauses the most,
and can lead to more implications due to BCP. This is in explicit contrast with our heuristic which always
attempts to satisfy the largest number of clauses.
2. Deduce(), which implements BCP and (implicitly) maintains the resulting implication graph. The pseudocode for this procedure is shown in Figure 23.
3. Diagnose(), which identifies the causes of conflicts and can augment the clause database with additional
implicates. Realization of different conflict diagnosis procedures is the subject of Section 3.
4. Erase(), which deletes the assignments at the current decision level. 6 CSETR29296: GRASP—A New Search Algorithm for Satisfiability // Global variables:
// Input argument:
// Return value:
// 7 Implication graph I
Current decision level d
CONFLICT or SUCCESS Deduce (d)
{
while (unit clauses in
or clauses unsatisfied) {
if (exists unsatisfied clause
){
add conflict vertex
to I;
record A ( ) ;
return CONFLICT;
}
x or l
if (exists unit clause
with free literal l
record A ( x ) ;
δ(x) = d;
1 if l
x or x
0 if l
¬x ;
set x
}
}
return SUCCESS;
} ¬x ) { Figure 23: Description of the deduction engine
We refer to Decide(), Deduce() and Diagnose() as the Decision, Deduction and Diagnosis engines, respectively. Different realizations of these engines lead to different SAT algorithms. For example, the DavisPutnam procedure can be emulated with the above algorithm by deﬁning a decision engine, requiring the deduction engine to implement BCP and the pure
literal rule, and organizing the diagnosis engine to implement chronological backtracking. 3 Conﬂict Analysis Procedures
When a conﬂict arises during BCP, the structure of the implication sequence converging on a conﬂict vertex is analyzed
to determine those (unsatisfying) variable assignments that are directly responsible for the conﬂict. The conjunction of these
conﬂicting assignments is an implicant that represents a sufﬁcient condition for the conﬂict to arise. Negation of this implicant,
therefore, yields an implicate of the Boolean function f (whose satisﬁability we seek) that does not exist in the clause database
. This new implicate2, referred to as a conﬂictinduced clause, provides the primary mechanism for implementing failuredriven assertions, nonchronological conﬂictdirected backtracking, and conﬂictbased equivalence (see Section 2.3).
We denote the conﬂicting assignment associated with a conﬂict vertex by A C ( ) and the associated conﬂictinduced
clause by C ( ) . The conﬂicting assignment is determined by a backward traversal of the implication graph starting at .
Besides the decision assignment at the current decision level, only those assignments that occurred at previous decision levels
2. Conditions similar to these implicates are referred to as “nogoods” in TMS [7, 27] and in some algorithms for CSP [21]. Nevertheless, the basic mechanism for creating conﬂictinduced clauses differs. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 8 are included in A C ( ) . This is justiﬁed by the fact that the decision assignment at the current decision level is directly responsible for all implied assignments at that level. Thus, along with assignments from previous levels, the decision assignment at
the current decision level is a sufﬁcient condition for the conﬂict. To facilitate the computation of A C ( ) we partition the antecedent assignments of as well as those for variables assigned at the current decision level into two sets. Let x denote either
or a variable that is assigned at the current decision level. The partition of A ( x ) is then given by:
{ ( y, (y) )
{ ( y, (y) ) ( x)
( x) ( x) }
( x) } A( x) (y)
A( x) (y) (3.1) For example, referring to the implication graph of Figure 21, ( x 6 )
{ x 11
mination of the conﬂicting assignment A C ( ) can now be expressed as:
AC ( ) 0 @ 3 } and ( x6 ) { x4 1 @ 6 } . Deter (3.2) causesof( ) where causesof(·) is deﬁned by: causesof( x) ( x, ( x ) ) ( x)
( y, if A ( x )
( y)) ( x) causesof(y) otherwise (3.3) The conﬂictinduced clause corresponding to A C ( ) is now determined according to:
C( ) ( x, ( x ) ) AC ( ) x ( x) (3.4) 0 1 1 @ 6, x 9 0 @ 1, x 10 where, for a binary variable x, x
x and x
¬ x . Application of (3.1)(3.4) to the conﬂict depicted in Figure 21 yields the
following conﬂicting assignment and conﬂictinduced clause at decision level 6:
AC ( )
C( ) { x1
( ¬x 1 x9 x 10 x 11 ) 0 @ 3, x 11 [email protected]} (3.5) 3.1 Standard Conﬂict Diagnosis Engine
The identiﬁcation of a conﬂictinduced clause C ( ) enables the derivation of further implications that help prune the
search. Immediate implications of C ( ) include asserting the current decision variable to its opposite value and determining
a backtracking level for the search process. Such immediate implications do not require that C ( ) be added to the clause
database. Augmenting the clause database with C ( ) , however, has the potential of identifying future implications that are
not derivable without C ( ) . In particular, adding C ( ) to the clause database insures that the search engine will not regenerate the conﬂicting assignment that led to the current conﬂict.
3.1.1 FailureDriven Assertions
If C ( ) involves the current decision variable, erasing the implication sequence at the current decision level makes
C ( ) a unit clause and causes the immediate implication of the decision variable to its opposite value. We refer to such CSETR29296: GRASP—A New Search Algorithm for Satisfiability x9 [email protected] x8 9 decision
level
3 1 @6 8 x 13 9 x 10 x1 [email protected] [email protected] [email protected] 9 5 9
7 x 11 x7 [email protected]
7 x 12 antecedent assignment of x1
due to C ( ) in (3.5) 1 @6
x1
1 [email protected] (a) Conﬂicting implication sequence 6
0 (b) Decision tree Figure 31: Implication sequence and backtracking due to asserting x 1 0 assignments as failuredriven assertions (FDAs) to emphasize that they are implications of conﬂicts and not decision assignments. We note further that their derivation is automatically handled by our BCPbased deduction engine and does not require
special processing. This is in contrast with most searchbased SAT algorithms that treat a second branch at the current decision
level as another decision assignment. Using our running example (see Figure 21) as an illustration, we note that after erasing
the conﬂicting implication sequence at level 6, the conﬂictinduced clause C ( ) in (3.5) becomes a unit clause with ¬ x 1 as
its free literal. This immediately implies the assignment x 1
0 and x 1 is said to be asserted.
3.1.2 ConﬂictDirected Backtracking
If all the literals in C ( ) correspond to variables that were assigned at decision levels that are lower than the current
decision level, we can immediately conclude that the search process needs to backtrack. This situation can only take place
when the conﬂict in question is produced as a direct consequence of diagnosing a previous conﬂict and is illustrated in
Figure 31 (a) for our working example. The implication sequence generated after asserting x 1
0 due to conﬂict leads to
another conﬂict
. The conﬂicting assignment and conﬂictinduced clause associated with this new conﬂict are easily determined to be
AC ( ) { x9 0 @ 1, x 10 C( ) ( x9 x 10 x 11 0 @ 3, x 11
¬ x 12 0 @ 3, x 12 1 @2, x 13 [email protected]} ¬ x 13 ) (3.6) and clearly show that the assignments that led to this second conﬂict were all made prior to the current decision level.
In such cases, it is easy to show that no satisfying assignments can be found until the search process backtracks to the
highest decision level at which assignments in A C ( ) were made. Denoting this backtrack level by , it is simply calculated
according to:
max { ( x) ( x, ( x) ) AC ( )} (3.7) When
d 1 , where d is the current decision level, the search process backtracks chronologically to the immediately
preceding decision level. When
d 1 , however, the search process may backtrack nonchronologically by jumping back
over several levels in the decision tree. It is worth noting that all truth assignments that are made after decision level
will CSETR29296: GRASP—A New Search Algorithm for Satisfiability 10 // Global variables:
Implication graph I
//
Clause database
// Input variable:
Current decision level d
// Output variable:
Backtracking decision level
// Return value:
CONFLICT or SUCCESS
//
Diagnose (d, & )
{
// Using (3.4)
C ( ) = Create_Conflict_Induced_Clause();
Update_Clause_Database ( C ( ) );
= Compute_Max_Level();
// Using (3.7)
if (βL != d) {
add new conflict vertex
to I;
record A ( ) ;
return CONFLICT;
}
return SUCCESS;
}
Figure 32: Description of the standard diagnosis engine
force the justidentiﬁed conﬂictinduced clause C ( ) to be unsatisﬁed. A search engine that backtracks chronologically
may, thus, waste a signiﬁcant amount of time exploring a useless region of the search space only to discover after much effort
that the region does not contain any satisfying assignments. In contrast, the GRASP search engine jumps directly from the current decision level back to decision level . At that point, C ( ) is used to either derive a FDA at decision level or to calculate a new backtracking decision level.
For our example, after occurrence of the second conﬂict the backtrack decision level is calculated, from (3.6), to be 3.
Backtracking to decision level 3, the deduction engine creates a conﬂict vertex corresponding to C ( ) . Diagnosis of this
conﬂict leads to a FDA of the decision variable at level 3 (see Figure 31 (b)).
The pseudocode for the diagnosis engine in GRASP is shown in Figure 32 and illustrates the main features of standard
conﬂict diagnosis described above. The GRASP search algorithm described in this report is sound and complete. General
proofs of this claim can be found in [13, 26].
3.2 Variations on the Standard Diagnosis Engine
The standard conﬂict diagnosis, described in the previous section, suffers from two drawbacks. First, conﬂict analysis
introduces signiﬁcant overhead which, for some instances of SAT, can lead to large run times. Second, the size of the clause
database grows with the number of backtracks; in the worst case such growth can be exponential in the number of variables.
The ﬁrst drawback is inherent to the algorithmic framework we propose. Fortunately, the experimental results presented in
Section 4 clearly suggest that, for speciﬁc instances of SAT, the performance gains far outweigh the procedure’s additional
overhead. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 11 One solution to the second drawback is a simple modiﬁcation to the conﬂict diagnosis engine that guarantees the worst
case growth of the clause database to be polynomial in the number of variables. The main idea is to be selective in the choice
of clauses to add to the clause database. Assume that we are given an integer parameter k. Conﬂictinduced clauses whose size
(number of literals) is no greater than k are marked green and handled as described earlier by the standard diagnosis engine.
Conﬂictinduced clauses of size greater than k are marked red and kept around only while they are unit clauses. Implementation of this scheme requires a simple modiﬁcation to procedure Erase(), which must now delete red clauses with more than
one free literal, and to the diagnosis engine, which must attach a color tag to each conﬂictinduced clause. With this modiﬁcation the worst case growth becomes a kthorder polynomial in the number of variables.
Further enhancements to the conﬂict diagnosis engine involve generating stronger implicates (containing fewer literals) by
more careful analysis of the structure of the implication graph. Such implicates correspond to the dominators [29] of the conﬂict vertex . These dominators, referred to as unique implication points (UIPs), can be identiﬁed in linear time with a single
traversal of the implication graph. 4 Experimental Results
In this section we present experimental results for GRASP. Several benchmarks are used and GRASP is compared with
other stateoftheart and publicly available SAT programs. In particular, we compare GRASP with TEGUS [28] and POSIT
[9]. TEGUS is included in SIS [23]. It was adapted to read CNF formulas and augmented to continue searching when all its
default options were exhausted3. No changes were required with POSIT.
GRASP and POSIT are implemented in the C++ programming language, whereas TEGUS is implemented in the C programming language. All programs were compiled with GCC 2.7.2 and run on a SUN SPARC 5/85 machine with 64 MByte of
RAM. In order to evaluate the three programs, two different sets of benchmarks were tested:
• The UCSC benchmarks, available from [8], that include instances of SAT commonly encountered in test pattern
generation of combinational switching circuits for bridging and stuckat faults.
• The DIMACS challenge benchmarks, also available from [8], that include instances of SAT from several authors
and from different application areas.
While GRASP has a large number of conﬁguration options, for the experimental results given below, it was conﬁgured to
use the decision engine described in Section 2.5, to allow the generation of clauses based on UIPs, and to limit the size of
clauses added to the clause database to 20 or fewer literals. All SAT programs were run with a CPU time limit of 10,000 seconds (about three hours).
For the tables of results the following deﬁnitions apply. A benchmark suite is partitioned into classes of related benchmarks. In each class, #M denotes the total number of class members; #S denotes the number of class members for which the
program terminated in less than 10,000 CPU seconds; and Time denotes the total CPU time, in seconds, taken to process all
members of the class. 3. Otherwise TEGUS would abort almost all benchmark examples. CSETR29296: GRASP—A New Search Algorithm for Satisfiability Benchmark
Class 12 GRASP TEGUS POSIT #M
#S Time #S Time #S Time BF0432 21 21 47.6 19 53,852 21 55.8 BF1355 149 149 125.7 53 993,915 64 946,127 BF2670 53 53 68.3 25 295,410 53 2,971 SSA0432 7 7 1.1 7 1,593 7 0.2 SSA2670 12 12 51.5 0 120,000 12 2,826 SSA6288 3 3 0.2 3 17.5 3 0.0 SSA7552 80 80 19.8 80 3,406 80 60.0 Table 41: Results on the UCSC Benchmarks
4.1 UCSC Benchmark Results
The results obtained for the UCSC benchmarks are shown in Table 41. The BF and SSA benchmark classes denote,
respectively, CNF formulas for bridging and stuckat faults4. These results are separated into benchmark classes according to
the given benchmark circuit (which are taken from the ISCAS’85 benchmark circuits). GRASP performs much better than any
other program on these benchmarks. The other two algorithms abort an extremely large number of problem instances, whereas
GRASP aborts none. Furthermore, both the CPU times and the number of decisions of GRASP are extremely small when
compared with the results of other programs. These benchmarks are characterized by extremely sparse CNF formulas for
which BCPbased conﬂict analysis works particularly well. The performance difference between GRASP and TEGUS, a very
efﬁcient ATPG tool, illustrates the power of the searchpruning techniques included in GRASP.
Despite the extremely good results of GRASP when compared with the other algorithms, some caution is required.
GRASP performs well in separate instances of SAT without knowledge of the circuit structure. In ATPG systems the structure
of the circuit is known and can be used to improve efﬁciency. This is what is done with TEGUS when applied to ATPG [28].
Given the greater overhead of GRASP, TEGUS is likely to perform better on a larger number of easy faults. However, GRASP
is ideal for the hard faults, for which TEGUS applies learning techniques and iterates over several decision making orderings.
As a result the optimum organization for ATPG is expected to be a combination of TEGUS for the simple faults, followed by
GRASP for the hard faults.
4.1.1 Database Growth Versus CPU Time
It is interesting to evaluate how the growth of the clause database affects the amount of search and the CPU time. For this
purpose the UCSC benchmark suites are used. The same decision making procedure is used and GRASP is run allowing
clauses of size at most 0, 5, 10, 15, 20, 30, 40, 60, 80 and 100 to be added to the clause database in each experiment. The CPU
time and the number of backtracks for the SSA and BF benchmarks are shown in Figure 41.
As the maximum size of added clauses grows, the number of backtracks decreases and the CPU time decreases accordingly. Eventually, this tendency is reversed, and even though the number of backtracks continues to decrease, the CPU time
begins to increase. We can thus conclude that adding larger clauses leads to additional overhead for conducting the search pro 4. These CNF formulas were developed at the University of California, Santa Cruz. CSETR29296: GRASP—A New Search Algorithm for Satisfiability 13 1.0E+06 1.0E+04
Backtracks
CPU Time 1.0E+05
1.0E+03
1.0E+04
1.0E+02 CPU Time, Secs Number of Backtracks SSA Benchmarks 1.0E+03 1.0E+02
0 5 10 15 20 30 40 60 80 1.0E+01
100 Maximum Size of Added Clauses
1.0E+06 1.0E+04
Backtracks Number of Backtracks 1.0E+05
1.0E+03
1.0E+04 1.0E+03
0 5 10 15 20 30 40 60 80 CPU Time, Secs CPU Time BF Benchmarks 1.0E+02
100 Maximum Size of Added Clauses Figure 41: UCSC benchmarks with different growths of the clause database cess and hence it eventually costs more than what it saves in terms of backtracks. These results also suggest that it may possible to experimentally identifying optimal growth rates for different classes of problem instances. For example, for the SSA and
BF benchmarks the optimal bound is near 30.
4.2 DIMACS Benchmark Results
Finally, we illustrate the application of GRASP to other benchmarks, not directly related with EDA applications. For this
purpose the DIMACS benchmarks are used [8]. The results of running GRASP and the other algorithms are shown in Table 42 and again are separated into classes of benchmarks. GRASP performs better than any of the other programs for the AIM100, CSETR29296: GRASP—A New Search Algorithm for Satisfiability Benchmark
Class 14 GRASP TEGUS POSIT #M
#S Time #S Time #S Time AIM100 24 24 1.8 24 107.9 24 1,290 AIM200 24 24 10.8 23 14,059 13 117,991 4 4 7.2 2 26,654 2 20,037 BF
DUBOIS 13 13 34.4 5 90,333 7 77,189 II32 17 17 7.0 17 1,231 17 650.1 PRET 8 8 18.2 4 42,579 4 40,691 SSA 8 8 6.5 6 20,230 8 85.3 AIM50 24 24 0.4 24 2.2 24 0.4 II8 14 14 23.4 14 11.8 14 2.3 JNH 50 50 21.3 50 6,055 50 0.8 PAR8 10 10 0.4 10 1.5 10 0.1 PAR16 10 10 9,844 10 9,983 10 72.1 II16 10 9 10,311 10 269.6 9 10,120 H 7 5 27,184 4 32,942 6 11,540 F 3 0 30,000 0 30,000 0 30,000 4 0 40,000 0 40,000 0 40,000 10 0 100,000 0 100,000 0 100,000 G
PAR32 Table 42: Results on the DIMACS Benchmarks
AIM200, BF, DUBOIS, PRET and SSA benchmark classes, whereas POSIT performs better than GRASP for the II8, JNH,
PAR8 and PAR16 benchmarks. It can be concluded that for benchmarks where GRASP performs better the other programs
either take a very long time to ﬁnd a solution or are unable to ﬁnd a solution in less than 10, 000 seconds. We have also
observed that benchmarks for which POSIT performs better than GRASP are also handled by GRASP with a similar amount
of search; only the overhead inherent to GRASP becomes apparent. TEGUS and POSIT each perform better on different
classes of instances. In general, however, POSIT seems to be slightly more efﬁcient than TEGUS.
It is also interesting to measure how well conﬂict analysis works in practice. For this purpose statistics regarding some
DIMACS benchmarks are shown in Table 43, where #B denotes the number of backtracks, #NCB denotes the number of nonchronological backtracks, Largest jump is the size of the largest nonchronological backtrack, #UIP indicates the number of
unique implication points found, % of Growth denotes the variation in size of the clause database, and Time is the CPU time
in seconds. For these examples several conclusions can be drawn. First, the number of nonchronological backtracks can be a
signiﬁcant percentage of the total number of backtracks. Second, the jumps in the decision tree can save a large amount of
search work. As can be observed, in some cases the jumps taken potentially save searching millions of nodes in the decision
tree. Third, the growth of the clause database is not necessarily large. Fourth, UIPs do occur in practice and for some benchmarks a reasonable number is found given the number of backtracks. Finally, for most of these examples conﬂict analysis
causes GRASP to be much more efﬁcient than POSIT. Nevertheless, POSIT and TEGUS can be more efﬁcient in speciﬁc
benchmarks, as the examples of the last three rows indicate. TEGUS performs particularly well on these instances because
they are satisﬁable and because TEGUS iterates several decision orderings. Hence, for these instances, iterating different decision making orderings is likely to lead to a solution. CSETR29296: GRASP—A New Search Algorithm for Satisfiability Benchmark #B #NCB Largest
jump 15 % of
Growth #UIP GRASP
Time TEGUS
Time POSIT
Time aim2002_0yes12 109 50 13 25 152.63 0.38 2.80 7,990.71 aim2002_0yes13 74 35 16 15 99.67 0.31 0.64 aim2002_0no1 29 20 12 5 22.9 0.13 69.93 aim2002_0no2 39 20 37 4 43.6 0.19 87.53 > 10,000
> 10,000
> 10,000 bf0432007 335 124 17 32 47.99 5.18 6,648.68 11.79 bf1355075 40 20 24 2 6.50 1.25 4.83 bf1355638 11 7 8 4 1.11 0.32 > 10,000 > 10,000
> 10,000 bf2670001 16 8 22 2 3.02 0.40 > 10,000 25.64 dubois30 233 72 16 21 465.83 0.68 > 10,000 dubois50 485 175 26 51 631.92 2.80 > 10,000 dubois100 1438 639 67 150 1033.54 26.22 > 10,000 > 10,000
> 10,000
> 10,000 pret60_40 147 98 17 8 407.08 0.41 652.30 175.49 pret60_60 131 83 16 10 353.54 0.35 639.27 173.12 pret150_25 428 313 38 35 588.17 4.84 > 10,000 pret150_75 388 257 49 20 446.75 3.85 > 10,000 > 10,000
> 10,000 ssa0432003 37 6 5 1 30.80 0.15 221.71 0.01 ssa2670130 130 45 34 10 17.26 2.07 > 10,000 14.23 ssa2670141 377 97 16 28 65.71 3.42 > 10,000 70.82 ii16a1 110 19 13 0 0.03 13.61 5.99 > 10,000 ii16b2 2664 120 9 39 63.46 175.85 6.94 16.38 ii16b1 88325 2588 41 624 131.94 > 10,000 21.65 16.73 Table 43: Statistics of Running GRASP on Representative DIMACS Benchmarks 5 Conclusions and Research Directions
This report introduces a procedure for conﬂict analysis in satisﬁability algorithms and describes a conﬁgurable algorithmic framework for solving SAT. Experimental results indicate that conﬂict analysis and its byproducts, nonchronological
backtracking and identiﬁcation of equivalent conﬂicting conditions, can contribute decisively for efﬁciently solving a large
number of classes of instances of SAT. As a result, the proposed SAT algorithm is shown to be more efﬁcient than other stateoftheart algorithms for a large number of SAT instances.
The natural evolution of this research work is to apply GRASP to different EDA applications, in particular test pattern
generation, timing analysis, delay fault testing and logic veriﬁcation, among others. Despite being a fast SAT algorithm,
GRASP introduces noticeable overhead that can become a liability for some of these applications. Consequently, besides the
algorithmic organization of GRASP, special attention must be paid to the implementation details. One envisioned compromise CSETR29296: GRASP—A New Search Algorithm for Satisfiability 16 is to use GRASP as the second choice SAT algorithm for the hard instances of SAT whenever other simpler, but with less overhead, algorithms fail to ﬁnd a solution in a small amount of CPU time.
Future research work will emphasize heuristic control of the rate of growth of the clause database. Another area for
improving GRASP is related with the deduction engine. Improvements to the BCPbased deduction engine are described in
[26] and consist of different forms of probing the CNF formula for creating new clauses. This approach naturally adapts and
extends other deduction procedures, e.g. recursive learning [16] and transitive closure [4], since it completes the clause database with additional implicates, in addition to being able to identify as many necessary assignments.
The actual practical usefulness of improved deduction engines needs to be experimentally validated. Finally, we propose
to undertake a comprehensive experimental characterization of the instances of SAT for which conﬂict analysis provides signiﬁcant performance gains. Acknowledgments
This work was supported in part by NSF under grant MIP9404632. References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18] M. Abramovici, M. A. Breuer and A. D. Friedman, Digital Systems Testing and Testable Design, Computer Science Press, 1990.
C. E. Blair, R. G. Jeroslow and J. K. Lowe, “Some Results and Experiments in Programming Techniques for Propositional Logic,”
Computers and Operations Research, vol. 13, no. 5, pp. 633645, 1986.
M. Bruynooghe, “Analysis of Dependencies to Improve the Behaviour of Logic Programs,” in Proceedings of the 5th Conference on
Automated Deduction, pp. 293305, 1980.
S. T. Chakradhar, V. D. Agrawal and S. G. Rothweiler, “A Transitive Closure Algorithm for Test Generation,” IEEE Transactions on
ComputerAided Design, vol. 12, no. 7, pp. 10151028, July 1993.
M. Davis and H. Putnam, “A Computing Procedure for Quantiﬁcation Theory,” Journal of the Association for Computing Machinery,
vol. 7, pp. 201215, 1960.
R. Dechter, “Enhancement Schemes for Constraint Processing: Backjumping, Learning, and Cutset Decomposition,” Artiﬁcial Intelligence, vol. 41, pp. 273312, 1989/90.
J. de Kleer, “An AssumptionBased TMS,” Artiﬁcial Intelligence, vol. 28, pp. 127162, 1986.
DIMACS Challenge benchmarks in ftp://Dimacs.Rutgers.EDU/pub/challenge/sat/benchmarks/cnf. UCSC benchmarks in /pub/challenge/sat/contributed/UCSC.
J. W. Freeman, Improvements to Propositional Satisﬁability Search Algorithms, Ph.D. Dissertation, Department of Computer and
Information Science, University of Pennsylvania, May 1995.
G. Gallo and G. Urbani, “Algorithms for Testing the Satisﬁability of Propositional Formulae,” Journal of Logic Programming, vol. 7,
pp. 4561, 1989.
M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NPCompleteness, W. H. Freeman and Company, 1979.
J. Gaschnig, Performance Measurement and Analysis of Certain Search Algorithms, Ph.D. Dissertation, Department of Computer Science, CarnegieMellon University, CMUCS79124, May 1979.
M. L. Ginsberg, “Dynamic Backtracking,” Journal of Artiﬁcial Intelligence Research, vol. 1, pp. 2546, August 1993.
J. Giraldi and M. L. Bushnell, “Search State Equivalence for Redundancy Identiﬁcation and Test Generation,” in Proceedings of the
International Test Conference, pp. 184193, 1991.
J. P. Hayes, Introduction to Digital Logic Design, AddisonWesley, 1993.
W. Kunz and D. K. Pradhan, “Recursive Learning: An Attractive Alternative to the Decision Tree for Test Generation in Digital Circuits,” in Proceedings of the International Test Conference, pp. 816825, 1992.
T. Larrabee, Efﬁcient Generation of Test Patterns Using Boolean Satisﬁability, Ph.D. Dissertation, Department of Computer Science,
Stanford University, STANCS901302, February 1990.
S. Mallela and S. Wu, “A Sequential Circuit Test Generation System,” in Proceedings of the International Test Conference, pp. 5761,
1985. CSETR29296: GRASP—A New Search Algorithm for Satisfiability
[19]
[20] [21]
[22]
[23]
[24]
[25]
[26]
[27]
[28] [29]
[30] 17 D. A. McAllester, “An Outlook on Truth Maintenance,” AI Memo 551, MIT AI Laboratory, August 1980.
P. C. McGeer, A. Saldanha, P. R. Stephan, R. K. Brayton and A. L. SangiovanniVincentelli, “Timing Analysis and DelayFault Test
Generation Using Path Recursive Functions,” in Proceedings of the International Conference on ComputerAided Design, pp. 180183, 1991.
T. Schiex and G. Verfaillie, “Nogood Recording for Static and Dynamic Constraint Satisfaction Problems,” in Proceedings of the
International Conference on Tools with Artiﬁcial Intelligence, pp. 4855, 1993.
M. H. Schulz and E. Auth, “Improved Deterministic Test Pattern Generation with Applications to Redundancy Identiﬁcation,” IEEE
Transactions on ComputerAided Design, vol. 8, no. 7, pp. 811816, July 1989.
E. M. Sentovich et. al, “SIS: An Environment to Sequential Circuit Synthesis,” Memorandum no. UCB/ERL M92/41, Department of
Electrical Engineering and Computer Sciences, University of California at Berkeley, May 1992.
J. P. M. Silva and K. A. Sakallah, “Efﬁcient and Robust Test GenerationBased Timing Analysis,” in Proc. IEEE International Symposium on Circuits and Systems (ISCAS), pp. 303306, June 1994, London, England.
J. P. M. Silva and K. A. Sakallah, “Dynamic SearchSpace Pruning Techniques in Path Sensitization,” in Proc. IEEE/ACM Design
Automation Conference (DAC), pp. 705711, June 1994, San Diego, California.
J. P. M. Silva, Search Algorithms for Satisﬁability Problems in Combinational Switching Circuits, Ph.D. Dissertation, Department of
Electrical Engineering and Computer Science, University of Michigan, May 1995.
R. M. Stallman and G. J. Sussman, “Forward Reasoning and DependencyDirected Backtracking in a System for ComputerAided
Circuit Analysis,” Artiﬁcial Intelligence, vol. 9, pp. 135196, October 1977.
P. R. Stephan, R. K. Brayton and A. L. SangiovanniVincentelli, “Combinational Test Generation Using Satisﬁability,” Memorandum
no. UCB/ERL M92/112, Department of Electrical Engineering and Computer Sciences, University of California at Berkeley, October
1992.
R. E. Tarjan, “Finding Dominators in Directed Graphs,” SIAM Journal on Computing, vol. 3, no. 1, pp. 6289, March 1974.
R. Zabih and D. A. McAllester, “A Rearrangement Search Strategy for Determining Propositional Satisﬁability,” in Proceedings of the
National Conference on Artiﬁcial Intelligence, pp. 155160, 1988. ...
View
Full
Document
This note was uploaded on 02/29/2012 for the course CS 15453 taught by Professor Edmundm.clarke during the Spring '09 term at Carnegie Mellon.
 Spring '09
 EdmundM.Clarke
 Computer Science

Click to edit the document details