npsolver A SAT Based Solver for Optimization Problems

Similar documents
MPBO A Distributed Pseudo-Boolean Optimization Solver

Open-WBO: a Modular MaxSAT Solver

Sudoku as a SAT Problem

InvGen: An Efficient Invariant Generator

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

Between Restarts and Backjumps

CS510 Software Engineering

Heuristics for Dynamically Adapting Constraint Propagation in Constraint Programming

Introduction to Logic in Computer Science: Autumn 2006

Solving the Employee Timetabling Problem Using Advanced SAT & ILP Techniques

Satisfiability Checking

Guessing Game: NP-Complete?

Smart Graphics: Methoden 3 Suche, Constraints

Strategic planning in LTL logistics increasing the capacity utilization of trucks

Branch-and-Price Approach to the Vehicle Routing Problem with Time Windows

M.S. Project Proposal. SAT Based Attacks on SipHash

Adaptive Memory Search for Boolean Optimization Problems

INTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Jedd: A BDD-based Relational Extension of Java

Discuss the size of the instance for the minimum spanning tree problem.

Lecture 7: NP-Complete Problems

Ant Colony Optimization and Constraint Programming

Bounded Treewidth in Knowledge Representation and Reasoning 1

University of Potsdam Faculty of Computer Science. Clause Learning in SAT Seminar Automatic Problem Solving WS 2005/06

A Constraint Programming based Column Generation Approach to Nurse Rostering Problems

Approximation Algorithms

Bounded-width QBF is PSPACE-complete

Research Statement Immanuel Trummer

Generating models of a matched formula with a polynomial delay

Verifying Refutations with Extended Resolution

A Tool for Generating Partition Schedules of Multiprocessor Systems

Analysis of Micro-Macro Transformations of Railway Networks

Index Terms Domain name, Firewall, Packet, Phishing, URL.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

PLEDGE: A Product Line Editor and Test Generation Tool

Faster SAT Solving with Better CNF Generation

An Interactive Train Scheduling Tool for Solving and Plotting Running Maps

OHJ-2306 Introduction to Theoretical Computer Science, Fall

Nan Kong, Andrew J. Schaefer. Department of Industrial Engineering, Univeristy of Pittsburgh, PA 15261, USA

Indexing Techniques for Data Warehouses Queries. Abstract

Performance Test of Local Search Algorithms Using New Types of

Introduction. The Quine-McCluskey Method Handout 5 January 21, CSEE E6861y Prof. Steven Nowick

Multi-layer MPLS Network Design: the Impact of Statistical Multiplexing

Scheduling Algorithm with Optimization of Employee Satisfaction

PLAANN as a Classification Tool for Customer Intelligence in Banking

Binary Image Reconstruction

CNFSAT: Predictive Models, Dimensional Reduction, and Phase Transition

5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

Optimizing Description Logic Subsumption

WESTMORELAND COUNTY PUBLIC SCHOOLS Integrated Instructional Pacing Guide and Checklist Computer Math

Cloud Computing is NP-Complete

Evolutionary SAT Solver (ESS)

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

The van Hoeij Algorithm for Factoring Polynomials

µz An Efficient Engine for Fixed points with Constraints

Efficient Data Structures for Decision Diagrams

Using diversification, communication and parallelism to solve mixed-integer linear programs

Minimizing costs for transport buyers using integer programming and column generation. Eser Esirgen

Pushing the Envelope of Optimization Modulo Theories with Linear-Arithmetic Cost Functions

Association Rules Mining: Application to Large-Scale Satisfiability

Computational Methods for Database Repair by Signed Formulae

D-optimal plans in observational studies

RN-Codings: New Insights and Some Applications

Attaining EDF Task Scheduling with O(1) Time Complexity

Arithmetic Coding: Introduction

Practical Graph Mining with R. 5. Link Analysis

2 Temporal Logic Model Checking

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Stabilization by Conceptual Duplication in Adaptive Resonance Theory

Random vs. Structure-Based Testing of Answer-Set Programs: An Experimental Comparison

Graph Mining and Social Network Analysis

The Problem of Scheduling Technicians and Interventions in a Telecommunications Company

A numerically adaptive implementation of the simplex method

Solving convex MINLP problems with AIMMS

Solving WCSP by Extraction of Minimal Unsatisfiable Cores

International Journal of Advanced Research in Computer Science and Software Engineering

ExSched: Solving Constraint Satisfaction Problems with the Spreadsheet Paradigm

Chapter 1. NP Completeness I Introduction. By Sariel Har-Peled, December 30, Version: 1.05

CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Using Ant Colony Optimization for Infrastructure Maintenance Scheduling

Lecture 19: Introduction to NP-Completeness Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

A New Approach for Finite Capacity Planning in MRP Environment

ExSched: Solving Constraint Satisfaction Problems with the Spreadsheet Paradigm

Chapter 13: Binary and Mixed-Integer Programming

C H A P T E R. Logic Circuits

Transcription:

npsolver A SAT Based Solver for Optimization Problems Norbert Manthey and Peter Steinke Knowledge Representation and Reasoning Group Technische Universität Dresden, 01062 Dresden, Germany peter@janeway.inf.tu-dresden.de Abstract. The pseudo-boolean (PB) solver npsolver encodes PB into SAT and solves the optimization instances by calling a SAT solver iteratively. The system supports MaxSAT, PB and WBO. Optimization instances are tackled by a greedy lower bound mechanism first. The solver can translate PB to SAT based on a portfolio of different encodings, based on the number of clauses. As back end of the system any SAT solver can be used, even incremental solvers for the optimization function. By using glucose as back end and the SAT simplifier Coprocessor, npsolver shows an outstanding performance on decision instances and can compete on optimization instances. 1 Introduction The performance of SAT solvers improved impressively in the last decade. To utilize this power, many different encodings for PB constraints have been developed. In 2006, MiniSat+ [6] combined three of these encodings to a PB solver. Since that time, new encodings have been proposed. In this paper we present npsolver, a pseudo-boolean (PB) solver that translates PB to SAT similar to MiniSat+, but which incorporates novel techniques. The used SAT solver can be exchanged, enabling the usage of most recent and even parallel systems. To keep learned clauses and avoid re-encodings, we also provide incremental solving of optimization instances. The search for the optimum supports simple bounding, binary search and a novel approximation technique. Besides the encodings for general PB constraints we furthermore provide special encodings for cardinality constraints. 2 Preliminaries Let V be a finite set of Boolean variables. The set of literals is V {x x V }. A clause is a disjunction of literals and a formula is a conjunction of clauses. An assignment σ is a set of literals. In the following, an assignment cannot contain both x and x for any variable x. An assignment σ satisfies a clause C if C contains a literal in σ, and satisfies a formula if it satisfies all its clauses. The SAT problem asks the question whether a given formula φ is satisfiable. Details how SAT is solved in state-of-the-art are given in [4].

Now we briefly introduce the pseudo-boolean (PB) decision problem and its extension to an optimization problem. For more details we point the reader to [9]. In PB constraints, each literal l i is always assigned a integer weight w i. A linear pseudo-boolean constraint has the form: w i l i k, where w i and k are integer constants, l i are literals and is one of the following classical relational operators: =, >, <, or. The right side of the constraint is called degree. Each PB constraint can be transformed into equivalent PB constraints with the operator [6,9]. A PB constraint is satisfied with respect to a truth assignment, if the left side evaluates to an integer that satisfies the relational operator. The pseudo- Boolean decision problem asks whether for a set of PB constraints there exists a truth assignment such that all PB constraints are satisfied. The pseudo-boolean optimization problem is the task for finding the optimal assignment for a set of PB constraints with respect to an optimization function. Special cases of a linear PB constraint are cardinality constraints. In a cardinality constraint l i k, the weight w i of each literal l i is w i = 1. The at-most-one constraint is a specialization for k = 1. The at-least-one constraints with the form l i 1 represents SAT clauses. In the following we have analyzed the set of PB instances from recent PB competitions and have extracted the frequency of occurrence of special cases to stress that translating PB into SAT, and using special encodings, is useful. Table 1 shows the distribution of PB constraints in the instances of the PB benchmark 2010/2011 1. The first column gives the kind of the constraint that has been analyzed. The second column gives the absolute number of occurrences of this kind and is followed by a column that gives the relative frequency. The last three columns give the relation between the degree and the number of literals in the constraint. The last row cumulates all other rows. The table clearly motivates that translating PB to SAT is a good idea: 88.4 % of the constraints can be encoded as a single SAT clause. Another 1.8 % of the constraints encode cardinality constraint for which special SAT encodings are present. When the exactly-k constraint is also considered as cardinality constraint, another 1 % is encoded with these encodings. Finally, only 8.5 % of all constraints encode a general PB constraint. 3 The Solver Design Like MiniSat+ we encode each PB constraint individually, by using the best encoding in terms of a expected fast SAT solver run time. In addition, we detect cardinality constraints and use specially designed encodings. See section 4 for more information about the different encodings. After encoding all PB constraints to SAT, the optimization function (if one exists) is transformed into a PB constraint. The first value of k is received by running the encoded SAT instance without the encoded optimization function 1 http://www.cril.univ-artois.fr/pb11/benchs/pb11-smallint.tar http://www.cril.univ-artois.fr/pb11/benchs/pb11-bigint.tar http://www.cril.univ-artois.fr/pb10/benchs/pb10-selected-benchs.tar

Table 1. Distribution of special PB constraints Constraint absolute relative k > n 2 n 2 k > n n k at-least-one 226,678,359 88.4 % 0 % 0 % 88.43 % at-most-one 3,913,720 1.5 % 0 % 0 % 1.52 % at-most-k 997,132 0.3 % 0 % 0 % 0.38 % exactly-k 2,729,545 1.0 % 0 % 0 % 1.06 % other 22,014,154 8.5 % 0.04 % 0.02 % 8.51 % equality 793 0.0 % 0 % 0 % 0.00 % total 256,333,703 100 % - - - and applying the assignment of the variables to the optimization function. To find the optimum we incrementally reduce k until we find the optimal value of the function. These steps are repeated until the formula becomes unsatisfiable. The last upper bound is returned as the optimum of the PB instance. In addition to MiniSat+ our solver is also able to perform binary search and use an incremental SAT solver, to avoid the loss of learned clauses. However, the incremental solver has to be restarted whenever an unsatisfiable formula has been encoded such that for binary search using the incremental solver does not improve the system significantly. The components of our solver are visualized in Figure 1 2. Since most of the time the optimization constraint is larger than the other PB constraints in a PB instance, we try to approximate the objective function. Therefore we divide each weight w i and k of the constraint by an heuristically chosen factor c, resulting in a PB constraint that can be encoded with less clauses. To avoid invalid solutions we overestimate the approximation by rounding up new weights: w i wi := c and rounding down the new degree: k := k c. We call this technique quickbound. As long as the encoded formula is satisfiable, we use this approximation of the objective function to search for the optimum. If the SAT formula is unsatisfiable, we leave quickbound and perform the usual algorithm, i.e. without the approximation. Note that we have to encode the last bound twice one time with quickbound and one time without. Still, the benefit is to encode the optimization function with less clauses to reduce the fraction of clauses for that function for example in MaxSAT instances. 4 Encoding PB into SAT The algorithm decides for each PB constraint which encoding to use. Here we try to use only encodings that maintain general arc consistency (GAC) by unit propagation, since this is important for the performance of a SAT solver. We choose among the following known encodings for PB: sorting networks [2] for cardinality constraints, a nested encoding for at-most-one constraints and BDDs, adder networks [6] for general PB constraints. We treat the at-most-one x 1 + + x n 1 constraints specially by introducing a fresh variable y if n > 4 and encode: n 2 (y + x i 1) i=1 (y + n i= n 2 +1 x i 1). 2 The tool is available at tools.computational-logic.org.

BDD, Sorting Network,... F P B F F i Iterative PB Encoder CP2 Solver J i SAT Solver Optimization Constraint Fig. 1. Solver Design: The PB instance P B is encoded to the SAT formula F. The preprocessor Coprocessor2 [8] is used to simplify F to F. Optimization problems are solved iteratively by encoding the objective function with different bounds i until the optimum is found. The resulting formulas F i are solved by a SAT solver, calculating the models J i. There are other encodings for the at-most-one constraint, e.g. [5], but for small n the above method produces less clauses. Finally, we encode BDDs without any auxiliary variables (by adding a clause for each path that leads to a false node), if this results in fewer clauses. Among all these encodings (except for the adder network) we use the best encoding for each individual PB constraint, in terms of less clauses. Only if the number of clauses becomes higher than 1 000 000 we switch to adder networks, that need the fewest number of clauses but do not maintain GAC. Equality constraints are translated into two -constraints, resulting in twice the number of clauses and auxiliary variables, except for the sorting networks, where just the number of clauses are duplicated while using the same amount of auxiliary variables. Table 2 shows the encodings our solver used during the benchmark presented in section 5. Since the global watchdog encoding presented in [1] is rarely useful, we decided to not implement this encoding and only approximate the number of clauses for the table (with n 3 log(k) log(w max ), where w max is the biggest weight w i in a constraint). This encoding might be useful for constraints with k n, but our benchmark lacks of such instances. Table 2. Best encodings in terms of less clauses, where AMO is the presented encoding for at-most-one encoding and 2-product is the encoding of [5], resulting in fewer clauses if n > 47. Encoding AMO 2-product sorting networks BDDs WatchDog adder networks absolute 611859 19227 112253 22967061 517 567 relative 2.58 % 0.08 % 0.47 % 96.86 % 0.00 % 0.00 %

Table 3. Solving PB instances from the PB competition Instance bsolo npsolver+bin npsolver+topdown PB 98 136 s 141 142 s 141 145 s PBO 119 206 s 104 127 s 102 123 s 4.1 Encoding MaxSAT into SAT To solve MaxSAT, for each clause C i with the weight w i npsolver introduces a relaxation variable r i that is added to C i (compare to [3]). The optimization that is performed afterwards it to minimize the sum i w ir i. 4.2 Encoding Weighted PBO into SAT Weighted boolean optimization (WBO) could be transformed as MaxSAT: For each constraint C i with a weight w i add a relaxation variable r i to the constraint and minimize the sum i w ir i. For a PB constraint with n variables and degree k, the an encoding would require the clauses for the original constraint, and additional clauses if the relaxation variable is added. To avoid these additional clauses, we decided to add the relaxation variable not to the constraint C i itself, but to all the clauses that are generated to encode this constraint. The optimization function is created as in MaxSAT: i w ir i. 5 Experimental Results We compare the available methods of our solver with the native domain solver bsolo [7], because of its high performance in recent competitions. MiniSat+ has not been chosen as reference, because the internally used SAT solver is too old for a fair comparison, hence we have to use the SAT formula output MiniSat+ with a current state-of-the-art SAT solver, but then the solver can only solve decision problems, and we found an unsatisfiable PB instance where the SAT translation resulted in a satisfiable SAT formula 3. Table 3 shows the number of solved instances and the corresponding mean run time per solver on all 492 instances of the last two PB competitions 1. We divided the instances into two sets: decision instances (PB) and optimization instances (PBO). For decision instances the translation to SAT clearly has a higher performance than bsolo. Almost 40 instances more can be solved, and the mean run time for these instances is not significantly larger although more instances can be solved. For the optimization instances the picture is different. bsolo can solve more instances than any of the other approaches. However, notice that bsolo has a higher performance on a particular instance family, namely on random instances (rand.biglist and random/rand.newlist). npsolver can solve only 12 of these instances where bsolo solves 29. In total, bsolo solves 217 instances and npsolver can solve 245 instances. Surprisingly, for the optimization instances the two search algorithms binary search and top down search do not differ significantly. At the current point we cannot explain this behavior. With the default settings, the current state of the solver already shows a high performance. Adding incremental search, the quick bound method or a 3 Such an example is the instance PB10/normalized-PB10/DEC-SMALLINT-LIN/ oliveras/j60/normalized-j6013_2-unsat.opb

SAT preprocessor to the system does not improve the results. Still, we believe that we can tweak the parameters of npsolver and improve the incremental search, resulting in an even more powerful tool. Furthermore, with new SAT solvers available, the performance of the solver will increase automatically. 6 Conclusion We presented the PB solver npsolver that is based on a translation to SAT. Based on a parameterized implementation this tool can use various encodings to achieve a good SAT formula. With this formula, a SAT solver is called to solve the PB instance. For optimization instances, the solver is called multiple times. Besides PB, the tool can also transform MaxSAT and WBO instances into SAT instances and solve these optimization problems. We showed in a brief evaluation that the current early stage of work results already in a powerful tool. By tuning the parameters of the system and choosing an appropriate SAT solver, npsolver can be adapted easily to applications. Future development of npsolver includes optimizing and parallelizing the system. A first step would be to evaluate parallel SAT solving approaches. Next, more encodings can be integrated into the system. Afterwards, the limits for each encoding will be determined by intensive testing. Finally, we might also adopt the translation into SAT to other optimization problems, resulting in a wider range of problems that could be solved by SAT solvers. References 1. O. Bailleux, Y. Boufkhad, and O. Roussel. New encodings of pseudo-boolean constraints into cnf. In Proceedings of the 12th International Conference on Theory and Applications of Satisfiability Testing, SAT 09, pages 181 194, Berlin, Heidelberg, 2009. Springer-Verlag. 2. K. E. Batcher. Sorting networks and their applications. In Proceedings of the April 30 May 2, 1968, spring joint computer conference, AFIPS 68 (Spring), pages 307 314, New York, NY, USA, 1968. ACM. 3. D. L. Berre and A. Parrain. The sat4j library, release 2.2. JSAT, 7(2-3):59 6, 2010. 4. A. Biere, M. J. H. Heule, H. van Maaren, and T. Walsh, editors. Handbook of Satisfiability, volume 185 of Frontiers in Artificial Intelligence and Applications. IOS Press, February 2009. 5. J. Chen. A New SAT Encoding of the At-Most-One Constraint. In Proceedings of ModRef 2011, 2011. 6. N. Eén and N. Sörensson. Translating pseudo-boolean constraints into sat. JSAT, 2(1-4):1 26, 2006. 7. V. M. Manquinho and J. P. M. Silva. On using cutting planes in pseudo-boolean optimization. JSAT, 2(1-4):209 219, 2006. 8. N. Manthey. Coprocessor 2.0 A flexible CNF Simplifier (Tool Presentation), 2012. Accepted for SAT 2012. 9. O. Roussel and V. Manquinho. Pseudo-Boolean and Cardinality Constraints, chapter 22, pages 695 733. Volume 185 of Biere et al. [4], February 2009.