A Framework for Representing and Solving NP Search Problems
Total Page:16
File Type:pdf, Size:1020Kb
A Framework for Representing and Solving NP Search Problems David G. Mitchell and Eugenia Ternovska Simon Fraser University {mitchell,ter}@cs.sfu.ca Abstract substantial effort may be required to find good encodings for some problems. NP search and decision problems occur widely in AI, and a CSP provides somewhat better modelling capabilities. number of general-purpose methods for solving them have The area has also provided a number of useful techniques. been developed. The dominant approaches include propo- sitional satisfiability (SAT), constraint satisfaction problems For example, nogood learning and backjumping methods (CSP), and answer set programming (ASP). Here, we propose developed in the CSP context are central to modern SAT a declarative constraint programming framework which we solvers (Mitchell 2005). Solvers for CSP, however, have believe combines many strengths of these approaches, while found success primarily as components in constraint logic addressing weaknesses in each of them. We formalize our ap- programming (CLP) tools. These provide rich problem solv- proach as a model extension problem, which is based on the ing environments, but are really general purpose program- classical notion of extension of a structure by new relations. ming languages and thus neither purely declarative nor tai- A parameterized version of this problem captures NP. We dis- lored to problems of moderate (in)tractability. cuss properties of the formal framework intended to support ASP is the only area of these three that took modelling effective modelling, and prospects for effective solver design. methodology seriously from the outset. ASP input lan- guages provide essentially all the modelling facilities CSP Introduction does, within a purely declarative framework. A built-in recursion mechanism provides additional modelling conve- Applications which require solving NP-complete problems nience, particularly useful when encoding problems involv- or their associated search problems abound in AI and other ing sequences of events, such as in verification and planning fields. Progress in these areas is often limited by the in- problems. ASP solvers are quite effective, and in particular ability to solve sufficiently large instances within practical may out-perform pure SAT-based methods when recursion time bounds. Propositional satisfiability (SAT), finite do- is used in models. However, the recursion mechanism is main constraint satisfaction (CSP), and answer set program- provided by the combination of logic programming syntax ming (ASP) are arguably the most prominent declarative and stable-model semantics (Marek & Truszczynski 1999; programming approaches to solving such problems. These Niemela 1999), which is a burden as well as a blessing. may be seen as part of a larger program to develop a col- Adapting results and techniques from other areas of logic lection of widely applicable – and widely applied – prac- may be challenging or impossible, and extending the formal tical tools and techniques for solving NP search problems, foundation to richer languages can be challenging. More- supported with mature mathematical foundations and theo- over, the semantics and the resulting style of expressing retical tools, much as mathematical programming has done some properties are not entirely intuitive, and the prospects for a range of optimization problems. While SAT, CSP and for ASP being widely adopted in industry seem poor. ASP have made valuable contributions, they each have many limitations. Here we present a formal framework for repre- Modelling Languages senting and solving problems which we believe addresses at least some of these limitations. One goal for our framework is to provide a foundation upon Effectiveness of the declarative approach has perhaps which practical modelling languages can be built. Such a been demonstrated most clearly by SAT. Current SAT language should at the least combine all the strengths of solvers exhibit impressive performance on many industrial SAT, CSP and ASP, and hopefully provide many additional instances and, for example, have become a widely used tool benefits. Since this is a paper about the formal foundation, for hardware verification. This success has been facilitated we will speak primarily about facilities we want in this foun- by the fact that SAT has very simple syntax and semantics. dation to support practical modelling. Unfortunately, SAT provides a poor modelling language and First and foremost, we believe that declarative modelling languages should be based, to the greatest extent possi- Copyright c 2005, American Association for Artificial Intelli- ble, on classical logic. This choice permits taking advan- gence (www.aaai.org). All rights reserved. tage of the properties of classical logic, and in particular fi- AAAI-05 / 430 nite model theory, for example in identifying tractable frag- Model Extension ments, proving correctness of axiomatizations, etc. More- In the framework, we cast computational problems as the over, the combination of rich expressive features and clean logical task of model extension, MX. semantics should facilitate producing syntactic variants, for use in industry, which have these same properties. Definition: The problem MX is: Given a formula φ with vo- Second, on our observations of, for example, logics for cabulary vocab(φ), and a finite structure AI for vocabulary knowledge representation and formal verification, database σ ⊂ vocab(φ), is there a structure A which is an extension query languages, and current directions in SAT constraint of AI to vocab(φ), and such that A |= φ. programming research, indicate that certain facilities are The idea is that the finite structure is an object of interest, crucial in practice. These include: such as a graph, and the formula specifies a question about • quantification, the object, such as whether it is Hamiltonian or not, in such • an easy way to express reachability, thus recursion, includ- a way that the extension relations witness the property. ing recursion combined with negation, Example 1. Let the input structure be a graph, G = hV ; Ei, • inclusion of a variety of pre-defined (interpreted) con- (i.e., E is binary, symmetric and irreflexive), and φ be: straint symbols, such as cardinality and other aggregate con- straints, as well as some arithmetic, ∀x∀y [(Clique(x) ∧ Clique(y)) ⊃ (x = y ∨ E(x, y))] • clear separation of the descriptions of problems and in- Let A be a structure which is an extension of G to the stances. vocabulary of φ. Then A |= φ iff CliqueA is a set of vertices In addition, effective modelling requires modularity, which which form a clique in G. comes naturally with classical logic, but is non-trivial when Example 2. Consider the vocabulary {Cell}, which we will recursion through negation is present. use to specify the elements in a square matrix a, where A further goal for our framework, beyond these criteria, Cell(r, c, i) will mean that element ar,c is i. Let φ be: was to provide the most general possible formal foundation, while capturing exactly the complexity class of interest and ∀r∀i ∃c Cell(r, c, i) ∧ ∀c∀i ∃r Cell(r, c, i) remaining close to classical logic. To satisfy these criteria ∧ ∀r∀c∀i∀j [(Cell(r, c, i) ∧ Cell(r, c, j)) ⊃ i = j ] and goals, we propose a framework based on classical first- ∧ ∀r∀c∀i(GivenCell(r, c, i) ⊃ Cell(r, c, i)) order logic (FO), formulated in such a way as to capture ex- In any structure A satisfying φ, the extension of relation actly the problems in NP, even while permitting unrestricted Cell lists the entries in a Latin Square of size ||A|| × ||A||. use of quantifiers, function symbols, and equality. To easily If A is just a universe of size n, then the model extension express recursion, we use an extension of first-order logic I problem is that of finding an n × n Latin Square. If A with inductive definitions, FO(ID). I also specifies the relation GivenCell, then we have the NP- For many industrial practitioners, classical logic may not complete Quasigroup Completion Problem. be an acceptable modelling language, so languages to be used in industry will likely be syntactic variants of FO(ID). Relation symbols which are not interpreted by the in- This would be analogous to database practice, where most stance structure behave as existentially quantified second or- users of the query language SQL are unaware that it is a der variables, so in the case of FO φ, we have the same syntactic variant of (a slight extension of) FO. power as existential second order logic (∃SO) over finite structures. Note that the set inclusion in σ ⊂ vocab(φ) Preliminaries in the formalization of the model extension problem must be proper. If σ = vocab(φ), we have model checking, not A vocabulary is a set τ of relation and function symbols, model extension. each with an associated arity. Constant symbols are zero- ary function symbols. A structure A for vocabulary τ (or, τ- There is a very close connection between model extension φ structure) is a tuple containing a universe |A|, and a relation and the spectrum problem. The spectrum of a sentence is {n ∈ | φ n}. σ = ∅ (function) for each relation (function) symbol of τ. For rela- the set N has a finite model of size If vocab(φ) = {R ,...,R } φ tion symbol R of vocabulary τ, the relation corresponding to and 1 m , the spectrum of can be R in a τ-structure A is denoted RA. The size of a structure A alternatively viewed as finite models (of the empty vocabu- ∃ ∃R ,..., ∃R φ is the number of elements in its universe, denoted ||A||. We lary) of the SO sentence 1 m , by associating n n σ = ∅ will also have need to consider total size of an explicit rep- a universe of size with . Thus, if , model extension resentation of a structure A, which we denote size(A). For coincides with the spectrum problem.