Grounding and Solving in Answer Set Programming

Grounding and Solving in Answer Set Programming

Articles Grounding and Solving in Answer Set Programming Benjamin Kaufmann, Nicola Leone, Simona Perri, Torsten Schaub n Answer set programming is a declar - nswer set programming (ASP) combines a high-level ative problem-solving paradigm that modeling language with effective grounding and solv - rests upon a work flow involving mod - Aing technology. Moreover, ASP is highly versatile by eling, grounding, and solving. While the offering various elaborate language constructs and a whole former is described by Gebser and spectrum of reasoning modes. The work flow of ASP is illus - Schaub (2016), we focus here on key trated in figure 1. issues in grounding, or how to system - At first, a problem is expressed as a logic program. A atically replace object variables by ground terms in an effective way, and grounder systematically replaces all variables in the program solving, or how to compute the answer by (variable-free) terms, and the solver takes the resulting sets, of a propositional logic program propositional program and computes its answer sets (or obtained by grounding. aggregations of them). ASP’s success is largely due to the availability of a rich mod - eling language (Gebser and Schaub 2016) along with effec - tive systems. Early ASP solvers SModels (Simons, Niemelä, and Soininen 2002) and DLV (Leone et al. 2006) were fol - lowed by SAT 1-based ones, such as ASSAT (Lin and Zhao 2004) and Cmodels (Giunchiglia, Lierler, and Maratea 2006), before genuine conflict-driven ASP solvers such as clasp (Geb - ser, Kaufmann, and Schaub 2012a) and WASP (Alviano et al. 2015) emerged. In addition, there is a continued interest in mapping ASP onto solving technology in neighboring fields, like SAT or even MIP 2 (Janhunen, Niemelä, and Sevalnev 2009; Liu, Janhunen, and Niemelä 2012), and in the auto - matic selection of the appropriate solver by heuristics (Maratea, Pulina, and Ricca 2014). Copyright © 2016, Association for the Advancement of Artificial Intelligence. All rights reserved. ISSN 0738-4602 FALL 2016 25 Articles Problem Solution Modeling Interpreting Logic Grounder Solver Stable Program Models Solving Figure 1. The Work Flow of Answer Set Programming. By contrast, modern grounders like (the one in) The ground instantiation of the rule contains 2 n DLV (Faber, Leone, and Perri 2012) or GrinGo (Gebser ground rules, corresponding to the number of n- et al. 2011) are based on seminaive database evalua - tuples, over a set of two elements. For more details tion techniques (Ullman 1988) for avoiding duplicate about complexity of ASP the reader may refer to work during grounding. Grounding is seen as an iter - Dantsin et al. (2001). ative bottom-up process guided by the successive Grounding, hence, may be computationally very expansion of a program’s term base, that is, the set of expensive having a big impact on the performance of variable-free terms constructible from the signature of the whole system, as its output is the input for an ASP the program at hand. Other grounding approaches solver, that, in the worst case, takes exponential time are pursued in GIDL (Wittocx, Mariën, and Denecker in the size of the input. Thus, a näıve grounding 2010), Lparse (Syrjänen 2001), and earlier versions of which replaces the variables with all the constants GrinGo (Gebser, Schaub, and Thiele 2007). The latter appearing in the program (thus producing the full two bind nonglobal variables by domain predicates to instantiation) is undesirable from a computational enforce - or -restricted (Syrjänen 2001; Gebser, point of view. Indeed, most of the ground atoms Schaub, and Thiele 2007) programs that guarantee a appearing in the full instantiation are not derivable finite grounding, respectively. from the program rules, and all generated ground In what follows, we describe the basic ideas and rules containing these atoms in the positive bodies major issωues ofλ modern ASP grounders and solvers, are useless for answer set computation. For instance, also in view of supporting ASP’s language constructs consider the following program: and reasoning modes. c(1, 2). a(X) | b(Y) :- c(X, Y). The full instantiation of the only rule appearing in Grounding the program contains four ground instances: Modern ASP systems perform their computation by a(1) | b(1) :- c(1, 1). first generating a ground program that does not con - a(2) | b(1) :- c(2, 1). tain any variable but has the same answer sets as the a(2) | b(2) :- c(2, 2). original program. This phase, usually referred to as a(1) | b(2) :- c(1, 2). grounding or instantiation, solves a complex problem. However, the first three ground rules are useless. In the case in which input nonground programs can They will never be applicable because their bodies be assumed to be fixed (data complexity), this task is contain atoms c(1, 1) and c(2, 1) , and c(2, 2) that are polynomial. However, as soon as variable programs not derivable from the program (they do not appear are given in input, grounding becomes EXPTIME- in the head of any rule). hard, and the produced ground program is potential - ASP grounders, like GrinGo or the DLV instantia - ly of exponential size with respect to the input pro - tor, employ smart procedures that are geared toward gram. To give an idea of that, consider the following efficiently producing a ground program that is con - program containing only one rule, and two facts: siderably smaller than the full instantiation but pre - obj(0). obj(1). serves the semantics. In the following, we first give tuple(X1, ..., Xn) :- obj(X1), ..., obj(Xn). an informal description of the grounding computa - 26 AI MAGAZINE Articles tion. Then we introduce the problem of dealing with the body is considered. If such a matching atom is function symbols, which may lead to infinite not found, a backtracking step to a previous literal L groundings. Finally we overview some optimization is performed, some variable bindings are restored, strategies. and the process goes on by looking for another matching for L . When all body literals have been The Instantiation Procedure instantiated, an instance for the rule r is found and ′ In this subsection, we provide a description of the the process continues by backtracking again to some basic instantiation procedure, which is adopted by previous literal, in order to find other substitutions. the most popular grounders, GrinGo and the DLV A crucial aspec′t of this process is how the set of instantiator. For clarity, the description is informal, ground atoms S containing the extensions of the and presents a simplified version of the actual instan - predicates is computed. When a program is given as tiation strategy. For instance, we do not take into input to a grounder, it usually contains also a set of account extensions of the basic language like choice ground atoms, called Facts. It constitutes the starting rules or aggregates (Lifschitz 2016; Alviano and point of the computation. In other words, initially S Leone 2015, 2016). Full details can be found in the = Facts. During instantiation, the set S is expanded work by Faber, Leone, and Perri (2012) and Gebser et with the ground atoms occurring in the head of the al. (2011). newly generated ground rules. For instance, in the The core of the grounding phase is the process of previous example, the ground atoms a(1) and b(1) are rule instantiation. Given a rule r and a set of ground added to S and they will possibly be used for the atoms S, which represents the extensions of the pred - instantiation of other rules. Thus, the extensions of icates, it generates the ground instances of r. Such a the predicates are built dynamically. In order to guar - task can be performed by iterating on the body liter - antee the generation of all useful ground instances a als looking for possible substitutions for their vari - particular evaluation order should be followed. If a ables. Grounders impose a safety condition, which rule r defines (that is, has in the head) a predicate p, requires that each rule variable appear also in a posi - 1 and another rule r2 contains p in the positive body, tive body literal. Thus, for the instantiator, it is then r has to be evaluated before r since r produces enough to have a substitution for the variables occur - 1 2 1 ground atoms needed for instantiating r1. Complying ring in the positive literals. with such evaluation orders ensures that the pro - To clarify this process, consider the following duced ground program has the same answer sets of (nonground) rule: the full instantiation, but is possibly smaller (Faber, a(X) | b(Y) :- p(X, Z), q(Z, Y). Leone, and Perri 2012). Now, assume that the set of extensions S = {p(1, 2), To produce proper evaluation orders, grounders q(2, 1), q(2, 3)} is given. Then, the instantiation starts make use of structural information provided by a by looking for a ground atom in S matching with p(X, directed graph, called Dependency Graph, that Z) . Therefore p(X, Z) is matched with p(1, 2) and the describes how predicates depend on each other. This substitution for X and Z is propagated to the other graph induces a partition of the input program into body literals, thus leading to the partially ground rule subprograms, associated with the strongly connected body p(1, 2), q(2, Y) . Then, q(2, Y) is instantiated with components, and a topological ordering over them. the matching ground atom q(2, 1) and a ground rule The subprograms are instantiated one at a time start - a(1)| b(1):- p(1, 2), q(2, 1) is generated.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us