1 UNIVERSIDAD NACIONAL DE CÓRDOBA FACULTAD DE MATEMÁTICA, ASTRONOMÍA Y FÍSICA SERIE A TRABAJOS DE MATEMATICA Nº 85/08...
1 UNIVESIDAD NACIONAL DE CÓDOBA FACULTAD DE MATEMÁTICA, ASTONOMÍA Y FÍSICA SEIE A TABAJOS DE MATEMATICA Nº 8/7 A Free...
1 Trabajos Originales 75 article_file Click here to download Manuscript: article_file.doc Title Surveillance of Human Echinococcosis in Castilla-Leon ...
1 150 C. Trabajos Relacionados con esta Tesis2 Bibliografía 153 Bibliografía Abello L., Chhor K & Pommier C. Thermodynamic Studies o...
1 Manual de diagnosticos de. Although, there are many FTP client applications available for ios that may assist some content creators with this task. ...
1 Calificacion de de manual proveedores DownloadCalificacion de de manual proveedores. Free Pdf Download AirSnort must gather about 5 to 10 million pa...
1 Centro de Estudios de Postgrado UNIVERSIDAD DE JAÉN Centro de Estudios de Postgrado Master s Dissertation/ Trabajo Fin de Máster MULTI...
1 De Bijbel In De Kunst One day, you will discover a new adventure and knowledge by spending more money. But when? Do you think that you need to obtai...
1 Facultade de Ciencias da Educación TRABALLO DE FIN DE GRAO A EVOLUCIÓN BIOLÓXICA, UNHA TEORÍA ESQUECIDA LA EVOLUCI&Oacut...
1 Facultade de Ciencias da Educación Grao en Mestre/a de Educación Primaria Traballo de fin de grao O fomento do galego empregando o fol...
UNIVERSIDAD NACIONAL DE CÓRDOBA FACULTAD DE MATEMÁTICA, ASTRONOMÍA Y FÍSICA ______________________________________________________________________
TRABAJOS DE INFORMÁTICA
iSat: Structure Visualization for SAT Problems
Ezequiel Orbe - Carlos Areces - Gabriel Infante Lopez
Editores: Luciana Benotti – Laura Brandan Briones
____________________________________________________________ CIUDAD UNIVERSITARIA – 5000 CÓRDOBA REPÚBLICA ARGENTINA
iSat: Structure Visualization for SAT Problems Ezequiel Orbe1 , Carlos Areces, and Gabriel Infante-Lopez1,2 1
Grupo de Procesamiento de Lenguaje Natural Universidad Nacional de C´ ordoba, Argentina Consejo Nacional de Investigaciones Cient´ıficas y T´ecnicas, Argentina
Abstract. We present iSat, a Python command line tool to analyze and find structure in propositional satisfiability problems. iSat offers an interactive shell to control propositional solvers and generate graph representations of the internal structure of the search space explored by them for visualization, with the final aim of providing a unified environment for propositional solving experimentation. iSat was designed to allow the simple integration of both new provers and new visualization graphs and statistics with a minimum of coding overhead.
iSat (interactive SAT) is a command line tool implemented in Python that helps a user to analyze and find structure in propositional satisfiability problems. It can be used, for example, to investigate the behavior of different provers over a given test set. The main service offered by iSat is a unified interface for experimentation with different SAT solvers and visualization graphs. Moreover, it can be used to mechanize the repetitive tasks often performed during the development of SAT solvers (e.g., fine tuning heuristics) or the selection of the appropriate configuration options for a given solver working on a particular satisfiability problem. iSat computes different graphs (e.g., the Variable-Clause graph, Variable graph, Interaction graph, etc.) over the current clause set at different points during the exploration of the search space, and computes related statistics over these graphs (degree mean/max/min/standard deviation, clique number, clustering, number of cliques, etc.). iSat was designed to allow the simple integration of both new provers and new visualization graphs and statistics with a minimum of coding overhead. The source code of iSat can be downloaded from https://cs.famaf.unc.edu.ar/~ezequiel/software/isat/. It is distributed under a GPL license and currently supports two SAT solvers out of the box: Minisat  and CryptoMinisat . 1.1
A Brief Overview on SAT Solving
Propositional satisfiability (SAT) is a well-known NP-complete problem  that consists of determining if there exists a boolean assignment to variables, such that all clauses in a given propositional formula reduce to true. Despite its complexity there are many different theorem provers, usually called SAT solvers
(e.g., [1,4,5]), that are able to efficiently solve many instances of the SAT problem. Current SAT solvers can be classified in two broad classes: incomplete and complete systems. Incomplete solvers performs different kinds of stochastic local search to find a satisfying valuation; if the search is successful, satisfiability is established, but search failure does not imply unsatisfiability. Complete SAT solvers, on the other hand, perform an exhaustive, systematic search, and hence can establish both satisfiability and unsatisfiability. Most of them implement variants of the Davis-Putnam-Logemann-Loveland algorithm (DPLL) [6,7] to explore the exponential search space. Complete SAT solvers can be further classified into conflict-driven and look-ahead. Conflict-driven solvers augment the basic DPLL with conflict analysis, clause learning, non-chronological backtracking and restarts as their principal components. Look-ahead solvers, are also based on DPLL but invest substantial efforts choosing first the branching variable to be used (the different choice options are called decision heuristics) and then the truth value this variable will be assigned (using so called direction heuristics) aiming to achieve the largest reduction of the remaining search space.  provides an excellent overview of the area. The SAT solving community is large and very active, with strong industrial involvement on classic application areas like planning , timing analysis , test pattern generation [11,12], Field Programmable Gate Arrays routing , to name only a few. As a result of this demand, new algorithms and heuristics are being constantly developed, and the available solvers are constantly tuned to obtain the best behavior on particular problem domains. Nevertheless interacting with solvers to gather statistics and explore their behavior when solving particular problems in order to find the best configuration parameters for a given problem class is a burdensome task. Consider, for example, the case of a researcher trying to find how the heuristics from different conflict-driven SAT solvers affect the internal structure of a particular problem by analyzing its Variable Clause graph. First, she would have to build the graph for the problem before running the SAT solvers (this is easy). Then, she would run every SAT solver with the problem in consideration and build visualization graphs at different stages during the search. Available solvers provide only limited access to their internal states, and in the best of cases this access is cumbersome and difficult to handle. In this article we present iSat as a tool to simplify these tasks. iSat is a command line system developed in Python that provides an interactive shell for multiple solvers and is capable of producing a wide range of visualization graphs and statistics, with the final aim of providing a unified environment for SAT solving experimentation. Currently, iSat provides access to the Minisat  and the CryptoMinisat  solvers; produces Variable-Clause graphs, Variable graphs, Literal-Clause graphs, Literal graphs and Interaction graphs that can be exported in gml and dot format and can be visualized using, for example, Cytoscape3 ; and computes statistics over these graphs like degree mean/max/min/standard deviation, clique number, cluster3
ing and number of cliques. Moreover, the architecture of iSat has been designed to allow the simple integration of new solvers and new analysis tools (i.e., new visualizations and statistics). The rest of this paper is organized as follows. Section 2 presents a typical use case of the tool from the point of view of the user. This is followed, in Section 3, by a detailed discussion of the capabilities of iSat, with a description of the available commands, supported provers and graphs visualizations already provided. In Section 4 we discuss the architecture of iSat and explain how new solvers and graph visualization tools and statistics can be integrated. We conclude in Section 5 with some final remarks and suggestions for further development.
A Sample Session
In this section we will describe, step by step, a typical interaction session with iSat to illustrate its capabilities. The screen capture of the interaction can be seen in Figure 1. Consider the case of a researcher who wants to visualize how the structure of a pigeon hole problem evolves during search. She suspects that if she can identify some structural properties of the problem, she could develop new heuristics that use that information to improve the search. To carry out her experiments she decided to use iSat with Minisat as SAT solver and the Literal-Clause graph to visualize the problem structure. When iSat starts, it loads all the SAT solver modules and visualization graph modules that are available. Once the start up process has finished, she loads (command loadcnf ) the problem into the tool. iSat first parses and loads the problem, and then, creates an output folder where all the results files of the session will be stored. When this is finished, she creates an instance of Minisat (command setup), iSat automatically loads the problem into the solver and creates an output folder where all the files related to this instance will be stored. Then she builds the Literal-Clause graph (command dumpgph) for the original problem. She plans to use it as a baseline against which to compare the different graphs she is planning to generate during the rest of her session. Before solving the problem, she configures the solver instance (command setconf ) to make it restart its search after having found only 2 conflicts and to keep this upper bound constant during the next restarts. Next, she checks that the other configuration options of the instance are correctly set (command getconf ). Now, she can start the process of exploring how Minisat attempts to solve the problem. Given that she wants to see the structure of the problem at different points, she runs a partial solving of the problem (command psolve). A partial solve in iSat consists on stopping the search after an specific number of restarts. Once the partial solving ends, she retrieves some statistics from the solver (command ssts) to check how the search is performing, and then builds another graph representation from the current state of the problem. She repeats this process until the problem is proved to be UNSAT. After that, she saves its
Creating Literal-Clause graph Configuring the instance
Partial Solving Getting statistics from the solver
Saving the session
activity as a script (command save) so she can easily re-run her experiments later. After quitting iSat she will be able to visualize and analyze the generated graphs (see Figure 2) using a suitable graph analysis tool like Cytoscape, looking for structural properties that can be used in the heuristic she is developing.
Fig. 2. Evolution of the problem structure: a) Original problem. b) After one restart. c) After five restarts.
Services Provided by iSat
SAT solvers can be though as complex procedures that iteratively modify one internal state which consists of the set of clauses still to be solved and a partial assignment. The computation starts with initial state given by the set of clauses in the original formula and an empty assignment. The solver modifies this state step by step adding and removing clauses, and assigning variables. iSat is a tool that instruments this computation. It allows a user to retrieve the solver state, explore it, represent it as a graph and manually modify it. iSat can run many instances of either the same or different solvers in the same session. It allows a user to compare different intermediate states that might come from different solvers or from the same solver at different stages. Since iSat groups instances according to the underlying SAT solver, it is possible to interact with one specific instance, with all instances of one specific solver or with all instances of all solvers. The current version of iSat can interact with Minisat and CryptoMinisat but other SAT solvers can be easily integrated. iSat also allows the user to save sessions and to reproduce them as scripts. The shell interface (implemented with cmd24 ) allows the user to retrieve command history, search the history, and execute Python code and shell commands. iSat provides different ways to inspect intermediate states by means of visualization graphs that can be visualized using existing graph visualization tools. Currently, iSat provides five graph representations: Interaction graph  , 4
Variable-Clause graph , Variable graph , Literal-Clause graph and Literal graph. The last two are similar to the previous two but they uses literals as nodes instead of variables. The user can select at any time during the exploration the type of graph and the instance whose state she wants to export. The graph is then generated as a file for further analysis. The commands available in the interactive shell can be grouped in four categories. Commands to handle and modify the state of the SAT solver, commands to inspect the current state (by means of relevant statistics or visualization graphs), commands to create instances of a problem and commands to save sessions and to execute saved sessions. We briefly describe the most relevant commands here: State handling commands: addc: Adds a list of clauses to a given instance. If no instance is given, they are added to all instances. simplify: Simplifies the set of clauses in a given instance. If no instance is given, it simplifies all instances. solve: Attempts to solve the problem in a given instance; it lets the solver compute a final state. If no instance is given, it solves all instances. psolve: Performs a partial solve in a given instance. It receives as parameter the number of restarts the solver can make before returning control to the user. If no instance is given, it partially solves all instances using the same number of restarts. reset: Resets the internal state. If no instance is given, it resets all instances. State Exporting Commands: ssts: Gather statistics from the given instance. If no instance is specified, it gathers statistics from all instances. gsts: Gathers statistics from a specific visualization graph. If no instance is given, it gathers statistics from all instances. dumpgph: Generates a file with the visualization graph of the current state of a given instance. If no instance is specified, it generates visualization graphs for every instance. getconf: Gets the current configuration options from a given instance. If no instance is specified, it gets the current configuration options from all instances. Instance Creation Commands: loadcnf: Loads a problem into memory and creates a folder where the results of the session are stored. setup: Creates an instance of a solver and feeds it with the last problem that was loaded using loadcnf. For each instance, it creates a subfolder where it outputs information particular to the instance. setconf: Configures a SAT solver instance with the given configuration options.
Session Saving and Retrieval Commands save: Saves the current session as a script. load: Loads and execute a script file. iSat is a powerful tool offers the user a wealth of information. It allows the user to interact with different solver instances in a ordered and intuitive fashion. Moreover, its architecture allows easy integration of new solvers and visualization graphs as we discuss in the next section.
iSat has been designed to be easily extended to include new SAT solvers and different visualization graphs, with their respective statistics. iSat uses a Client/Services architecture. The Client layer is in charge of implementing the user interface which is an interactive shell. The Services layer provides the interface to different solvers and visualization graphs. Services can be either Solvers or Graphs. A graphical description of the architecture is shown in Figure 3.
To integrate a new SAT solver into iSat, two components have to be defined. The first component wraps the API of the SAT solver into Python, and provides Python bindings for this API. Since this wrapper only traduces the SAT solver’s
API into Python, the resulting bindings might not be the ones required by the interactive shell. The second component addresses this issue adapting the wrapper to the specific needs of the interactive shell. Both components are SAT solver dependent and both have to be implemented when a new solver is added to iSat. For solvers developed in C/C++ (this is the case for most current SAT solvers), the first component can be defined with the help of tools like the Simplified Wrapper and Interface Generator (Swig)5 or the Boost libraries6 which assist in the definition of bindings for a number of target programming languages, including Python. But even with the help of these tools, defining this component requires careful work and knowledge of the particular solver involved. In particular it is in this component where we should ensure that the resulting Python bindings provide all the necessary basic functionality required by iSat (like the ability to stop the run of the solver at a certain point, and retrieve the current state). For example, to build the Python bindings for Minisat, its original C++ API was first extended in the native language to provide the missing functionality required by iSat. Besides providing a simplified interface to some of the methods already present in the solver, this extension includes a partial solving method that continues the search till the next restart, and methods that returns the current set of clauses and learnt clauses. The Python bindings for this extension were then obtained using Swig. The second component, on the other hand, is mostly bookkeeping, and adapts the previous functionality to the concrete function interfaces and datatypes used by iSat. In particular, implementing this component boils down to the definition of a subclass of the Python class Solver and uses the functionality provided by the wrapper in its implementation. The Solver class interface is shown in Figure 3. Methods in this class can be grouped into three categories: configuration methods, information methods, and solving methods. In the configuration category we have methods to load a problem in the solver (load and add clause), methods to configure the solver parameters (set conf params), and methods to reset the internal state of the solver (reset state). In the information category, we have methods that grant access to the internal state of the solver (get clauses, get learnt clauses), a method to obtain statistics (get stats), a method that returns a model of the current problem, if available (get model), and a method that returns the current configuration parameters (get conf params). Finally, the solving category includes methods to run the solver, or to run it till a certain predefined condition is met, over the current problem (solve and partial solve). Integrating new visualization graphs into iSat follows a similar strategy but is usually simpler as we don’t have to deal with the internal complexity of a SAT solver. The common interface is defined by the class Graph also shown in Figure 3. This interface includes methods to build the graph (build), dump the graph to a file (dump), and gather statistics both at graph and at node level 5 6
(analyze graph and analyze node). There is no restriction on how the graph is implemented internally, or on how the statistics are gathered. For example, graphs modules already implemented in iSat has been developed using the Python package NetworkX7 to build graphs and to gather associated statistics.
In this article we introduced iSat, an interactive command line tool that can be used to investigate the internal structure of the search space explored by propositional solvers, to assist developing new heuristics and to compare different stages of the same or different solvers. It also provides different graphical visualizations of the current problem state, and related statistics. The current version of iSat provides the general architecture, integration with the Minisat and CryptoMinisat solvers, and implementations for computing Variable-Clause, Variable, Literal-Clause, Literal and Interaction graphs; it provides access to the statistics obtained from Minisat and CryptoMinisat (number of decisions made, propagations, conflicts detected, current number of variables, etc.) together with statistics over the graphs computed (degree mean/max/min/standard deviation, clique number, clustering, number of cliques, etc.). iSat was developed with two concrete design goals in mind: to simplify extensibility and to provide an agile interaction with different provers. The outcome is a unified interface for experimentation where new SAT solvers and visualization graphs can be easily integrated. In contrast to similar tools like DPViz , which mainly have a pedagogical purpose, the main target of iSat are researchers investigating the behavior of SAT solvers over particular problem instances (e.g., SAT solver developers) or skilled users fine tuning a SAT solver for a particular application (e.g., SAT solvers used in particular industrial applications). This is the first release of iSat. We are currently working on the integration of new SAT solvers, and different graph visualizations. The flexibility offered by the current implementation opens the way to many customizations possibilities. It would be interesting to see in which ways the SAT solving community will make use of iSat and contribute to its development.
References 1. Een, N., S¨ orensson, N.: An extensible SAT-solver. Theory and Applications of Satisfiability Testing (2004) 2. Soos, M.: CryptoMiniSat — a SAT solver for cryptographic problems (2009) http: //www.msoos.org/cryptominisat2. 3. Cook, S.: The complexity of theorem-proving procedures. In: STOC’71: Proceedings of the third annual ACM symposium on theory of computing, New York, NY, USA, ACM (1971) 151–158 7
4. Moskewicz, M., Madigan, C., Zhao, Y., Zhang, L., Malik, S.: Chaff: Engineering an efficient sat solver. In: Proceedings of the 38th Design Automation Conference (DAC’01). (2001) 5. Heule, M., van Maaren, H.: March dl: Adding adaptive heuristics and a new branching strategy. Journal on Satisfiability, Boolean Modeling and Computation 2 (2006) 47–59 6. Davis, M., Putnam, H.: A computing procedure for quantification theory. Journal of the ACM 7(3) (1960) 201–215 7. Davis, M., Logemann, G., Loveland, D.: A machine program for theorem-proving. Communications of the ACM 5(7) (1962) 394–397 8. Heule, M.: SmArT solving: Tools and techniques for satisfiability solvers. PhD thesis, TU Delft (2008) 9. Kautz, H., Selman, B.: Planning as satisfiability. In: Proceedings of ECAI-92, John Wiley and Sons, Inc (1992) 10. L. Guerra e Silva, J. Marques-Silva, L.S., Sakallah, K.: Timing analysis using propositional satisfiability. In: Proceedings of the IEEE International Conference on Electronics, Circuits and Systems (ICECS), IEEE Press (1998) 11. Larrabee, T.: Test pattern generation using boolean satisfiability. IEEE Transactions on Computer-Aided Design 11(1) (1992) 6–22 12. Marques-Silva, J., Sakallah, K.: Robust search algorithms for test pattern generation. In: Proceedings of the Fault-Tolerant Computing Symposium (FTCS), IEEE Computer Society (1997) 13. Nam, G., Sakallah, K., Rutenbar, R.: Satisfiability-based layout revisited: Detailed routing of complex FPGAs via search-based boolean SAT. In: Proceedings of the International Symposium on Field Programmable Gate Arrays, ACM Press (1999) 14. Sinz, C.: DPvis - a tool to visualize the structure of SAT instances. Theory and Applications of Satisfiability Testing (2005) 15. Nudelman, E., Leyton-Brown, K., Devkar, A., Shoham, Y., Hoos, H.: Understanding random SAT: Beyond the clauses-to-variables ratio. In: International Conference on Principles and Practice of Constraint Programming (CP). (2004) 438–452