On Computing Minimum Size Prime Implicants

Similar documents
Satisfiability-Based Algorithms for 0-1 Integer Programming

Search Pruning Conditions for Boolean Optimization

Search Pruning Conditions for Boolean Optimization

Conditions for Non-Chronological Backtracking in Boolean Optimization

On Applying Cutting Planes in DLL-Based Algorithms for Pseudo-Boolean Optimization

An Experimental Evaluation of Conflict Diagnosis and Recursive Learning in Boolean Satisfiability

Combinational Equivalence Checking Using Satisfiability and Recursive Learning

Effective Lower Bounding Techniques for Pseudo-Boolean Optimization

Full CNF Encoding: The Counting Constraints Case

GRASP A New Search Algorithm for Satisfiability

Improving Unsatisfiability-based Algorithms for Boolean Optimization

An Overview of Backtrack Search Satisfiability Algorithms

Learning Techniques for Pseudo-Boolean Solving and Optimization

The Impact of Branching Heuristics in Propositional Satisfiability Algorithms

THE UNIVERSITY OF MICHIGAN. GRASP A New Search Algorithm for Satisfiability

Learning Techniques for Pseudo-Boolean Solving

Heuristic Backtracking Algorithms for SAT

Unrestricted Backtracking Algorithms for Satisfiability

Using Synthesis Techniques in SAT Solvers

Towards More Effective Unsatisfiability-Based Maximum Satisfiability Algorithms

Parallel Search for Boolean Optimization

PBS: A Pseudo-Boolean Solver and Optimizer

Hybrid Constraint Solvers

Preprocessing in Pseudo-Boolean Optimization: An Experimental Evaluation

IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN OF INTEGRATED CIRCUITS AND SYSTEMS, VOL. 27, NO. 6, JUNE

On the Relation between SAT and BDDs for Equivalence Checking

Random backtracking in backtrack search algorithms for satisfiability

Massively Parallel Seesaw Search for MAX-SAT

Discrete Optimization. Lecture Notes 2

Preprocessing in Pseudo-Boolean Optimization: An Experimental Evaluation

Heuristic-Based Backtracking for Propositional Satisfiability

Boolean lexicographic optimization: algorithms & applications

ON SOLVING OPTIMIZATION PROBLEMS USING BOOLEAN SATISFIABILITY

Normal Forms for Boolean Expressions

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

Formal Verification using Probabilistic Techniques

Effective Bounding Techniques For Solving Unate and Binate Covering Problems. Matthias F. Stallmann. Raleigh, NC, USA.

Effective Bounding Techniques For Solving Unate and Binate Covering Problems

QuteSat. A Robust Circuit-Based SAT Solver for Complex Circuit Structure. Chung-Yang (Ric) Huang National Taiwan University

SAT Solvers. Ranjit Jhala, UC San Diego. April 9, 2013

The Einstein Puzzle. Hints to Einstein Puzzle. Hints to Einstein Puzzle (cont) Specify Einstein Puzzle in SAT. Specify Einstein Puzzle in SAT

Boolean Functions (Formulas) and Propositional Logic

THE reduction of finite state machines (FSM s) is a wellknown

Pbmodels Software to Compute Stable Models by Pseudoboolean Solvers

Combinational Equivalence Checking

Lookahead Saturation with Restriction for SAT

Optimization-based Multiple Target Test Generation for Highly Compacted Test Sets

Bounded Model Checking with Parametric Data Structures

EECS 219C: Formal Methods Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

CS-E3200 Discrete Models and Search

ESE535: Electronic Design Automation CNF. Today CNF. 3-SAT Universal. Problem (A+B+/C)*(/B+D)*(C+/A+/E)

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

SAT/SMT Solvers and Applications

Using Problem Symmetry in Search Based Satisfiability Algorithms. Mukul R. Prasad Fujitsu Labs. of America Sunnyvale, CA

Efficient Wrapper/TAM Co-Optimization for Large SOCs

Effective CNF Encodings for the Towers of Hanoi

Implementation of a Sudoku Solver Using Reduction to SAT

Symbolic Methods. The finite-state case. Martin Fränzle. Carl von Ossietzky Universität FK II, Dpt. Informatik Abt.

Search techniques for SAT-based Boolean optimization

Solving the Minimum-Cost Satisfiability Problem Using SAT Based Branch-and-Bound Search

A Novel SAT All-Solutions Solver for Efficient Preimage Computation

Boolean Satisfiability Solving Part II: DLL-based Solvers. Announcements

Example: Map coloring

1 Inference for Boolean theories

SAT, SMT and QBF Solving in a Multi-Core Environment

Constraint Satisfaction Problems

A New Algorithm to Create Prime Irredundant Boolean Expressions

Minimum Satisfying Assignments for SMT. Işıl Dillig, Tom Dillig Ken McMillan Alex Aiken College of William & Mary Microsoft Research Stanford U.

3 No-Wait Job Shops with Variable Processing Times

Symmetry Breaking for Pseudo-Boolean Formulas

Inference methods for a pseudo-boolean satisfiability solver

Generalizations of Watched Literals for Backtracking Search

An Introduction to SAT Solvers

Using Problem Symmetry in Search Based Satisfiability Algorithms. Mukul R. Prasad Fujitsu Labs. of America Sunnyvale, CA

4.1 Review - the DPLL procedure

Towards a Symmetric Treatment of Satisfaction and Conflicts in Quantified Boolean Formula Evaluation

Verification of Proofs of Unsatisfiability for CNF Formulas

SAT BASED ALGORITHMIC APPROACH FOR SUDOKU PUZZLE

Formally Certified Satisfiability Solving

Lecture 2: Symbolic Model Checking With SAT

Design Diagnosis Using Boolean Satisfiability

3 SOLVING PROBLEMS BY SEARCHING

N-Model Tests for VLSI Circuits

SAT-CNF Is N P-complete

A Pearl on SAT Solving in Prolog (extended abstract)

BerkMin: a Fast and Robust Sat-Solver

A new algorithm for incremental prime implicate generation

Constraint Satisfaction Problems

of m clauses, each containing the disjunction of boolean variables from a nite set V = fv 1 ; : : : ; vng of size n [8]. Each variable occurrence with

Practical SAT Solving

Checking Satisfiability of a Conjunction of BDDs

Boolean Satisfiability: The Central Problem of Computation

Some Applications of Graph Bandwidth to Constraint Satisfaction Problems

Handout 9: Imperative Programs and State

Boolean Representations and Combinatorial Equivalence

Test Set Compaction Algorithms for Combinational Circuits

BITCOIN MINING IN A SAT FRAMEWORK

Clone: Solving Weighted Max-SAT in a Reduced Search Space

Polynomial SAT-Solver Algorithm Explanation

SAT Solver. CS 680 Formal Methods Jeremy Johnson

Transcription:

On Computing Minimum Size Prime Implicants João P. Marques Silva Cadence European Laboratories / IST-INESC Lisbon, Portugal jpms@inesc.pt Abstract In this paper we describe a new model and algorithm for computing minimum-size prime implicants of Boolean functions. The computation of minimum-size prime implicants has several applications in different areas, including Electronic Design Automation (EDA), Non-Monotonic Reasoning, Logical Inference, among others. For EDA, one significant and immediate application is the computation of minimum-size test patterns in Automatic Test Pattern Generation (ATPG). The proposed approach is based on creating an integer linear program (ILP) formulation for computing the minimum-size prime implicant. In addition, we introduce a new algorithm for solving ILPs, which is built on top of an algorithm for propositional satisfiability (SAT). Experimental results, obtained on several benchmark examples, indicate that our approach is significantly more efficient than existing algorithms. 1. Introduction Given a boolean function f, the problem of computing a minimum-size assignment (in the number of literals) that satisfies f is referred to as the minimum-size prime implicant problem. Note that computing a minimum-size prime implicant corresponds to identifying a maximum-size cube for the given boolean function. Minimum-size prime implicants find application in many areas including, among others, Electronic Design Automation. One interesting application example is the computation of minimum-size test patterns in automatic test pattern generation which, as we shall see, can be viewed as a particular case of computing a minimum-size prime implicant of a boolean function. In other areas, interest on computing minimum-size prime implicants of boolean functions has motivated extensive research work (see for example [5, 6], which include extensive bibliographic references.). In this paper we develop an ILP formulation for computing minimum-size prime implicants of Boolean functions described by Conjunctive Normal Form (CNF) formulas. The proposed model improves the one described in [6]. Moreover, a new algorithm for solving 01-ILPs is described. This algorithm is based on propositional satisfiability (SAT), and generalizes the SAT-based ILP algorithm originally described in [1]. In particular, our ILP algorithm is based on the GRASP SAT algorithm [7]. Preliminary results obtained on several satisfiable instances of the DIMACS benchmarks [4], indicate that the proposed model and algorithm can be used for computing minimum-size prime implicants for several classes of Boolean functions. 2. Definitions The paper follows the definitions introduced in [7], in particular for the organization of the GRASP SAT algorithm which is used in Section 4. In general, we assume a boolean function f : { 0, 1} n { 0, 1}, represented by a CNF formula ϕ, where each clause ω is a sum of literals, and a literal l is either a variable x i or its complement x i '. A clause ω = ( l 1 + + l k ) denotes a constraint and so it can also be viewed as a linear inequality, l 1 + + l k 1, and we use this alternative representation when appropriate. Furthermore, since a literal l = x i ' can also be defined by l = 1 x i, we shall in general use this latter representation when viewing clauses as linear inequalities. 3. Computing Prime Implicants Using ILPs Given a description of a Boolean function in CNF, it is straightforward to formulate the computation of the minimum-size prime implicant as an integer linear program [6]. In this paper we show how to simplify the formulation proposed in [6], thus allowing for a significant reduction in the worst-case search space. Given a CNF formula ϕ, which is defined on a set of variables { x 1,, x n }, and which denotes a Boolean function f : { 0, 1} n { 0, 1}, apply the following transformation: 1. Create a new set of boolean variables { y 1,, y 2n }, where y 2i 1 is associated with literal x i, and y 2i is associated with literal x i '. 2. For each clause ω = ( l 1 + + l m ), replace each literal l j with y 2k 1 if l j = x k, or with y 2k if l j = x i '. 3. For each pair of variables, y 2i 1 and y 2i, require that at most one is set to one. Hence, y 2i 1 + y 2i 1. 4. The set of inequalities obtained from steps 2. and 3. can be viewed as a single set of inequalities A y b. Finally, define the cost function to be,

min (1) 5. The complete ILP formulation is thus defined as follows: It is clear that the minimum value of (1) denotes a minimum-size prime implicant of the original CNF formula ϕ. Proposition 1. Given a CNF formula ϕ, the solution of the optimization problem (1) is a minimum-size prime implicant of ϕ. The proposed model is based on the one described in [6]. However, the model proposed in [6] associates an integer variable with each inequality created from each of the original clauses. As we showed above, such integer variables are unnecessary and can only potentially increase the search space. Hence, the worst-case search space for the ILP model we propose in this paper is significantly smaller than for the model proposed in [6]. The construction of the ILP model will be illustrated with the following CNF formula: First, we create the a new set of variables { y 1, y 2, y 3, y 4, y 5, y 6 }, and associate y 2i 1 with each x i and y 2i with each x i '. Consequently, from (3) the following modified CNF formula ϕ' is obtained: For each clause, simple algebraic manipulation yields an equivalent inequality: j The next step is to require that at most one variable of each pair of variables y 2i 1, y 2i can be set to one, which yields: y j min y j j s.t. A y b ϕ = ( x 1 + x 2 + x 3 ) ( x 1 ' + x 2 ') ( x 1 ' + x 3 ') ϕ' = ( y 1 + y 3 + y 5 ) ( y 2 + y 4 ) ( y 2 + y 6 ) y 1 + y 3 + y 5 1 y 2 + y 4 1 y 2 + y 6 1 y 1 + y 2 1 y 1 y 2 1 y 3 + y 4 1 y 3 y 4 1 y 5 + y 6 1 y 5 y 6 1 (2) (3) (4) (5) (6) Thus allowing for a given variable x i not to be assigned. Equations (5) and (6) define the set of inequalities A y b. The next step is to identify the cost function, which minimizes the number of variables assigned value one, i.e. the number of variables x i with an assigned value. Finally the resulting ILP model becomes: min y 1 + y 2 + y 3 + y 4 + y 5 + y 6 s.t. A y b One solution to the linear program (7) is, for example, x 1 = 0 and x 2 = 1. 4. Search Algorithm for Solving ILPs In [1], P. Barth described how to solve ILPs using a propositional satisfiability algorithm. However, the ILP algorithm described in [1] is based on the Davis-Putnam procedure, which has been shown to be particularly inefficient for a large number of instances of SAT [7]. 4.1 SAT-Based ILP Algorithm The proposed ILP algorithm is based on the GRASP SAT algorithm [7], which includes several powerful pruning techniques for reducing the amount of search associated with instances of SAT. Among the pruning techniques included in GRASP, the following have been shown to be particularly important: GRASP implements non-chronological backtracking. This backtracking strategy permits skipping over large portions of the decision tree for some instances of SAT. During the search process, and as conflicts are identified, new clauses are created from the causes of those conflicts. These new clauses are then used for pruning the subsequent search. In most cases, instances of SAT generated from EDA problems have highly structured CNF representations. The intrinsic structure of these representations can be exploited by GRASP, after analyzing the causes of conflicts, by identifying necessary assignments required for preventing conflicts from happening again during the search. Let us consider the cost function (1). The possible values assumed by the cost function for the different assignments to the variables in the set { y 1,, y 2n } range from 0, when all variables are assigned value 0, to 2n, when all variables are assigned value 1. Note however, that for the (7)

int min_prime (ϕ) { k = n ; while ( k 0 ) { ϕ = ϕ { y k} j ; status = solve_sat (ϕ); ϕ = ϕ { y k} j ; if ( status == SATISFIABLE ) { k = y j ; k ; } else { ++ k ; break; } return k ; } Figure 1: SAT-based ILP algorithm minimum-size prime implicant problem a trivial upper bound is n, since for any pair of variables y 2i 1, y 2i at most one can be assigned value 1. P. Barth s [1] approach consists of applying the following sequence of steps, starting from an upper bound of k = 2n on the value of the cost function: 1. Create a new inequality y k j. This inequality basically requires that a computed solution must have no more than k literals assigned value 1. 2. Solve the resulting instance of satisfiability. (Note that the resulting instance of satisfiability assumes arithmetic operations, but updating most SAT algorithms for handling this generalization is straightforward.) 3. If the instance of SAT is satisfiable decrement k and go back to step 1. Otherwise, report that the solution to the ILP is k + 1. Note that this ILP algorithm allows for any SAT algorithm to be used as the underlying SAT testing engine. The proposed ILP algorithm is illustrated in Figure 1. For our particular case, the solve_sat function call invokes the GRASP SAT algorithm [7]. 4.2 Extensions to the Basic Algorithm One extension variation of the ILP algorithm is the ability to incrementally enumerate prime implicants by increasing size [6]. The procedure proposed in [6] basically recreates the search process for each new prime implicant to be computed. Clearly, this solution can introduce significant and unnecessary computational overhead. One possible solution with a provably better worst-case time complexity is the following: 1. Keep a stack of pairs of computed solutions and associated upper bound values k. 2. Use the current top of the stack to find the next minimum-size prime implicant. 3. For a given solution-upper bound pair, apply the algorithm of Figure 1 until the next optimal solution is found. For this new optimal bound, enumerate all solutions. 4. As soon as a given pair solution-upper bound yields no more solutions, pop the stack and go back to step 2. Repeat until stack of solution-upper bound pairs becomes empty. 5. EDA Applications In order to illustrate the potential application of minimum-size prime implicants in EDA, we now study its use in test pattern generation. It is well-known that fault detection problems in ATPG can be cast as instances of the propositional satisfiability problem [8]. In some situations, the ATPG tool is required to compute test patterns of minimum-size. This is the case, for example, when computing test patterns for generating deterministic built-in self test logic. Given a CNF formula ϕ describing a fault detection problem, the model described in Section 3 can be applied to ϕ. This in turn yields an ILP for computing a minimumsize prime implicant of the Boolean function represented by ϕ. By restricting the cost function of the ILP to the primary input variables (PIs), the resulting solution is a minimum-size test pattern for the target fault. The procedure for computing minimum-size test patterns is illustrated in Figure 2. 6. Experimental Results In this section we include experimental results of a tool for computing minimum-size prime implicants, minprime, and compare it with other ILP solvers, lp-solve [2], opbdp [1], and the commercial optimizer CPLEX. Moreover, the binate covering tool scherzo [3] is also evaluated. For this purpose we use a representative set of the satisfiable instances of the DIMACS benchmarks [4]. The experimental results, obtained on a SUN 5/85 machine with 64 MByte of physical memory, are shown in Table 1. For each benchmark and for each tool were allowed 3000 seconds of CPU time. Column min indicates the size of

stuck-at fault the minimum-size prime implicant, when this size is known. Each column UB denotes the upper bound computed by each algorithm. For the results shown, whenever a tool quits earlier than 3000 sec, then the tool exceeded the available virtual memory (i.e. 64 MByte). As can be concluded, general-purpose ILP solvers, such as CPLEX and lp-solve, may be inadequate for computing minimum-size prime implicants. Similarly, despite the very promising results as an algorithm for solving binate covering problems, scherzo performs particularly poorly when computing minimum-size prime implicants. Both SAT-based ILP solvers can handle a large number of benchmarks and, in general, min-prime performs better and is more robust than opbdp. For the JNH benchmarks, opbdp performs better because the amount of search is similar and the overhead of GRASP is larger. From the experimental results obtained, it can also be concluded that the computation of the minimum-size prime implicant can be a particularly hard problem for specific sets of instances. This is the case, for example, with the ii8 and ssa7552 benchmarks. For the ssa7552 benchmark, the ILP formulation computes a minimumsize assignment for all nodes in the fault detection representation. This is naturally harder than computing a minimum-size assignment to the primary inputs. Nevertheless, this benchmark provides strong evidence that none of the tools tested can currently be used effectively for solving the minimum-test pattern problem in automatic test pattern generation. One key drawback of the proposed algorithmic solucreate CNF formula min prime ILP model restrict cost function to PIs Figure 2: Computation of minimum-size test patterns tion, is the ILP layer around the SAT algorithm. This layer iteratively creates additional clauses which, for the minimum-size prime implicant problem, involve all variables in the problem representation. Hence, conflicts involving this clause necessarily lead to chronological backtracking 1, and so the most useful features of GRASP cannot be exploited. 7. Conclusions and Ongoing Work In this paper we describe a new model and algorithm for computing minimum size prime implicants of boolean functions. The model is based on an ILP formulation and the proposed algorithm is a SAT-based ILP algorithm. To our best knowledge min-prime is the first SAT-based ILP algorithm that incorporates conflict analysis techniques in solving optimization problems. As the results given in the previous section clearly show, the proposed algorithm, min-prime, is by far the most competitive for the set of benchmarks considered. Thus, for these classes of benchmarks min-prime would be the option of choice. Nevertheless, and despite the promising results given in the previous section, more work needs to be done before a SAT-based ILP algorithm, such as min-prime, can be used for solving minimum-size prime implicant problems with a practical impact, as for example the minimum-size test pattern problem. Finally we observe that even though both the minimum size prime implicant problem and the binate covering problem have similar formulation, the algorithms for solving each problem should have different organizations, as the experimental results of min-prime and scherzo clearly suggest. As mentioned earlier, one key bottleneck of the proposed algorithmic solution is the ILP layer around GRASP. The iterated addition of large clauses to the CNF formula reduces the ability of GRASP for backtracking non-chronologically and in several cases causes GRASP to always backtrack chronologically. Other algorithmic solutions are currently being study which show greater promise. Acknowledgments The author would like to thank Arlindo Oliveira for 1. In such a situation, each conflict involves all variables and so backtracking is necessarily chronological, to the most recent decision assignment [7].

Benchmark min CPLEX lp-solve [2] scherzo [3] opbdp [1] min-prime time UB time UB time UB time UB time UB aim-50-1_6-yes1-1 50 116.5 50 > 3,000 2.33 50 0.09 50 0.05 50 aim-50-2_0-yes1-2 50 109.5 50 > 3,000 5.65 50 0.64 50 0.02 50 aim-50-3_4-yes1-3 50 62.9 50 377.1 50 0.57 50 0.40 50 0.08 50 aim-50-6_0-yes1-4 50 26.9 50 96.8 50 0.73 50 0.48 50 0.07 50 aim-100-1_6-yes1-2 100 > 3,000 > 3,000 > 1,000 > 3,000 100 0.09 100 aim-100-2_0-yes1-3 100 > 3,000 > 3,000 691.57 100 42.45 100 0.17 100 aim-100-3_4-yes1-4 100 > 3,000 > 3,000 35.47 100 0.81 100 0.47 100 aim-100-6_0-yes1-1 100 294.3 100 > 3,000 2.78 100 0.18 100 0.32 100 aim-200-1_6-yes1-3 200 > 3,000 > 3,000 > 345 > 3,000 0.22 200 aim-200-2_0-yes1-4 200 > 3,000 > 3,000 > 1,705 > 3,000 0.83 200 aim-200-3_4-yes1-1 200 > 3,000 > 3,000 > 3,000 41.84 200 4.32 200 aim-200-6_0-yes1-2 200 > 3,000 > 3,000 619.38 200 4.59 200 3.58 200 ii8a1 54 63.3 54 786.90 54 0.98 54 1.93 54 861.53 54 ii8b2 > 3,000 388 > 3,000 474 > 3,000 > 3,000 > 3,000 379 ii8c2 > 3,000 629 > 3,000 668 > 3,000 > 3,000 > 3,000 525 ii8d2 > 3,000 588 > 3,000 > 3,000 > 3,000 > 3,000 540 ii8e2 > 3,000 653 > 3,000 > 3,000 > 3,000 > 3,000 494 jnh1 92 > 3,000 93 > 3,000 70.00 92 2.24 92 17.96 92 jnh7 89 > 3,000 90 > 3,000 5.35 89 0.45 89 9.06 89 jnh12 94 2,529 94 > 3,000 3.07 94 0.12 94 0.58 94 jnh17 95 873.9 95 > 3,000 17.28 95 0.30 95 2.53 95 ssa7552-038 > 3,000 1449 > 3,000 1450 > 223 > 3,000 1452 > 1,205 1448 Table 1: Experimental results on selected benchmarks (CPU times in seconds) many fruitful discussions, Paulo Flores for installing and maintaining the ILP codes, and Olivier Coudert for providing the executable of scherzo. References [1] P. Barth, A Davis-Putnam Based Enumeration Algorithm for Linear Pseudo-Boolean Optimization, Technical Report MPI-I-95-2-003, Max-Planck-Institut für Informatik, January 1995. [2] M.R.C.M. Berkelaar, UNIX TM Manual Page of lpsolve. Eindhoven University of Technology, Design Automation Section, 1992. [3] O. Coudert, On Solving Covering Problems, in Proceedings of the Design Automation Conference, June 1996. [4] D. S. Johnson and M. A. Trick (eds.), Second DIMACS Implementation Challenge, DIMACS Series in Discrete Mathematics and Theoretical Computer Science, 1993. DIMACS benchmarks available in ftp://dimacs.rutgers.edu/pub/challenge/sat/benchmarks/cnf. [5] T. Ngair, A New Algorithm for Incremental Prime Implicant Generation, in Proceedings of the International Joint Conference on Artificial Intelligence, 1993. [6] C. Pizzuti, Computing Prime Implicants by Integer Programming, in Proceedings of International Conference on Tools with Artificial Intelligence, November 1996. [7] J. P. M. Silva and K. A. Sakallah, GRASP A New Search Algorithm for Satisfiability, in Proceedings of the International Conference on Computer-Aided Design, November 1996. [8] P. R. Stephan, R. K. Brayton and A. L. Sangiovanni- Vincentelli, Combinational Test Generation Using Satisfiability, IEEE Transactions on Computer-Aided Design, vol. 15, no. 9, pp. 1167-1176, September 1996.