PySAT: A Python Toolkit for Prototyping with SAT Oracles

Ignatiev A., Morgado A., Marques-Silva J. (2018) PySAT: A Python Toolkit for Prototyping with SAT Oracles. In: Beyersdorff O., Wintersteiger C. (eds) Theory and Applications of Satisfiability Testing – SAT 2018. SAT 2018. Lecture Notes in Computer Science, vol 10929. Springer, Cham. https://doi.org/10.1007/978-3-319-94144-8_26


Abstract

  Boolean satisfiability (SAT) solvers are at the core of efficient approaches for solving a vast multitude of practical problems. Moreover, albeit targeting an NP-complete problem, SAT solvers are increasingly used for tackling problems beyond NP. Despite the success of SAT in practice, modeling with SAT and more importantly implementing SAT-based problem solving solutions is often a difficult and error-prone task. This paper proposes the PySAT toolkit, which enables fast Python-based prototyping using SAT oracles and SAT-related technology. PySAT provides a simple API for working with a few state-of-the-art SAT oracles and also integrates a number of cardinality constraint encodings, all aiming at simplifying the prototyping process. Experimental results presented in the paper show that PySAT-based implementations can be as efficient as those written in a low-level language.
 

解决大量实际问题的有效方法     at the core of 

使用SAT建模以及更重要的是实现基于SAT的问题解决方案通常是一项困难且容易出错的任务。

 

本文:

      快速构建原型                             译文:支持使用SAT oracle快速构建基于python的原型    

      集成若干基数约束编码

     旨在简化原型制作过程

1 Introduction

 

When compared with Satisfiability Modulo Theories (SMT,可满足性模理论), Answer Set Programming (ASP,回答集编程) or Constraint Programming (CP,约束规划), a well-known drawback of Propositional Logic (concretely, its satisfiability (SAT) problem) is the low level at which the problem constraints are represented and the low-level programmatic interface that must be used. These limitations hinder a wider adoption of SAT solvers, but in part they are also one reason for the observed performance gains that SAT-based solutions often enable. Moreover, it is generally perceived that SAT-based modeling is difficult and also error-prone. Clearly, the aforementioned alternatives, SMT, ASP and CP, also enable some sort of direct encoding to SAT, and then invoking a SAT solver, but often key aspects of the problem formulation are lost. Other approaches that directly encode problems into SAT have been considered, including NP-Spec [10].

 

 

译文:命题逻辑(具体地说,它的满足性(SAT)问题)的一个众所周知的缺点是问题约束在较低的层次上表示,并且必须使用较低的编程接口

译文:这些限制阻碍了SAT解决方案的广泛采用;译文:但在某种程度上,它们也是基于sat的解决方案通常能够带来性能提升的原因之一。

 

译文:此外,一般认为基于sat的建模是困难的,而且容易出错。

译文:前面提到的替代方案,SMT、ASP和CP,也允许对SAT进行某种直接编码,然后调用SAT求解器,但是通常会丢失问题表述的关键方面。其他直接将问题编码到SAT的方法也被考虑过,包括NP-Spec[10]。

   
 

This paper describes PySAT, a toolkit that simplifies prototyping problem solvers with SAT solvers as oracles. Similarly to existing solutions for SMT, the prototyping language is Python, with a simple interface to an abstract SAT solver that abstracts most details away, but also aims at compromising little in terms of performance. The paper illustrates the ease of modeling reasonably challenging problems, concretely MUS extraction, but also provides empirical evidence that the toolkit can achieve reasonably efficient implementations when compared with existing state-of-the-art tools. PySAT is open source, and it is publicly available on GitHub. Furthermore, PySAT is also readily installable as a Python package。

译文:一个抽象SAT求解器的简单接口,抽象了大部分细节。

译文:本文举例说明了建模的简易性,并对具有一定挑战性的问题进行了具体的分析。

   
 

This paper is organized as follows. Basic definitions and notation are introduced in the next section. Section 3 describes the toolkit, its design and interface. Section 4 outlines the implementation of a deletion-based MUS extractor. Section 5 presents experimental results comparing a PySAT-based prototype of a MaxSAT algorithm compared to the state-of-the-art implementation. Section 6 overviews prior work related with PySAT. Finally, the paper concludes in Sect. 7.

 

译文:Section 4概述了基于删除的MUS提取器的实现。

译文:第5节介绍基于psat的MaxSAT算法原型与最新求解器在实现上的实验对比结果。

   

2 Preliminaries

  This section introduces the notation and definitions used throughout the paper. Standard propositional logic definitions apply (e.g. [9]). CNF formulas are defined over a set of propositional variables. A CNF formula F is a propositional formula represented as a conjunction of clauses, also interpreted as a set of clauses. A clause is a disjunction of literals, also interpreted as a set of literals. A literal is a variable or its complement. Throughout the paper, SAT solvers are viewed as oracles. Given a CNF formula F, a SAT oracle decides whether F is satisfiable, in which case it returns a satisfying assignment. A SAT oracle can also return an unsatisfiable core UFU⊆F, if F is unsatisfiable. Conflict-driven clause learning (CDCL) SAT solvers are summarized in [9].
   
 

CNF formulas are often used to model overconstrained problems, for example, the maximum satisfiability (MaxSAT) problem and the minimal unsatisfiable subset (MUS) extraction problem. In general, clauses in a CNF formula are characterized as hard, meaning that these must be satisfied, or soft, meaning that these are to be satisfied, if at all possible. A weight can be associated with each soft clause, and the goal of MaxSAT is to find an assignment to the propositional variables such that the hard clauses are satisfied, and the sum of the satisfied soft clauses is maximized. Algorithms for MaxSAT have been overviewed in [1930]. Recent algorithms based on implicit hitting sets have been described in [4]. In the analysis of unsatisfiable CNF formulas, consider a given unsatisfiable CNF formula F. An MUS of F is a set of clauses MFM⊆F which is both unsatisfiable and irreducible. The goal of the MUS extraction problem is to determine an MUS of a given unsatisfiable CNF formula.

译文:[4]中描述了基于隐式命中集的最新算法。

 

The goal of the MUS extraction problem:

 

   

 

 

 

7 Conclusions

 

Despite the remarkable progress observed in SAT solvers for over two decades, in many settings the option of choice is often not a SAT solver, even when this might actually be the ideal solution. One reason for overlooking SAT solvers is the apparent difficulty of modeling with SAT, and of implementing basic prototypes. This paper describes PySAT, a Python toolkit that enables fast prototyping with SAT solvers. The Python interface offers (incremental) access to a blackbox exposing the basic interface of a SAT solver, but which compromises little in terms of performance. 

 

译文:忽略SAT求解器的一个原因是使用SAT建模和实现基本原型的明显困难。

译文:他的论文描述了PySAT,这是一个Python工具包,可以使用SAT求解器进行快速原型设计。Python接口提供了对暴露SAT求解器基本接口的黑盒的(增量)访问,但在性能方面几乎没有损害。

   
 

The toolkit also offers access to a number of often-used implementations of cardinality constraints. A simple implementation of a MaxSAT solver shows performance comparable with a state-of-the-art C++ implementation. The PySAT tookit is publicly available as open source from GitHub, and also as a Python package on most POSIX-compliant OSes.

译文:该工具包还提供了对基数约束的许多常用实现的访问

                    MaxSAT求解器的一个简单实现所显示的性能可与最先进的c++实现相媲美。

   
  It is expected that the community will contribute to improving the toolkit further, with additional features, but also with proposals for improvements. Several extensions are planned. These include the integration of more SAT solvers (e.g. CryptoMiniSat and other MiniSat- and Glucose-based solvers), lower level access to the SAT solver’s parameters and policies when necessary (e.g. setting preferred “polarities” of the variables), high-level support for arbitrary Boolean formulas (e.g. by Tseitin-encoding them [50] internally), and encodings of pseudo-Boolean constraints.
   

 

posted on 2021-05-09 15:44  海阔凭鱼跃越  阅读(529)  评论(0编辑  收藏  举报