ASP Encodings of Acyclicity Properties

ASP Encodings of Acyclicity Properties

Proceedings of the Fourteenth International Conference on Principles of Knowledge Representation and Reasoning ASP Encodings of Acyclicity Properties Martin Gebser∗y and Tomi Janhunen∗ and Jussi Rintanen∗z Helsinki Institute for Information Technology HIIT Department of Information and Computer Science Aalto University, FI-00076 AALTO, FINLAND Abstract an acyclic or a tree structure subject to further conditions. That the choice among underlying edge candidates actually Many knowledge representation tasks involve trees or similar structures as abstract datatypes. However, devising compact results in some graph structure with the desired properties and efficient declarative representations of such properties is must be enforced by corresponding constraints. Straightfor- non-obvious and can be challenging indeed. In this paper, ward formulations, however, can become impractically large we take acyclicity properties into consideration and investi- and inefficient, and our work sheds light on ways to encode gate logic-based approaches to encode them. We use answer such constraints succinctly and efficiently. set programming as the primary representation language but Although we rely on answer set programming (ASP) also consider mappings to related formalisms, such as propo- (Brewka, Eiter, and Truszczynski´ 2011) as the primary rep- sitional logic, difference logic, and linear programming. resentation language for encodings, respective formulations in related formalisms, such as propositional satisfiability Introduction (SAT), SAT extended with difference logic (DL), and linear Numerous hard computational tasks involve the construction programming (LP), can be obtained through automatic poly- of acyclic or tree structures. Constraint satisfaction and re- nomial translations from ASP. Linear translations to SAT ex- lated methods are an important approach for solving many of ist whenever ASP rules are tight (Erdem and Lifschitz 2003), these problems. Since acyclicity and the property of being a i.e., if there are no circular positive dependencies through tree are no primitives in common constraint-based represen- rules’ prerequisites on the ground level. In the non-tight tation formalisms, the challenge of formulating such condi- case, level mappings (Janhunen 2004) can be used to bridge tions in terms of more basic constraint expressions arises. the semantic gap between ASP and SAT. Compact linear Hence, in this work, we systematically investigate logic- representations of level mappings can be achieved by means based approaches to encode respective properties. of difference constraints available in DL (Niemela¨ 2008) or Construction of acyclic graphs, trees, or chordal graphs integer variables in LP (Liu, Janhunen, and Niemela¨ 2012). shows up in numerous applications. For instance, Bayesian In this short paper, we present encoding approaches for di- network structure learning, where directed acyclic graphs rected acyclic graphs. Their extensions to forests and trees, in the directed and undirected case, as well as chordal graphs provide solution candidates, can be reduced to constraint 1 optimization (Jaakkola et al. 2010; Cussens 2011). Further- are addressed in an extended version of this paper. more, chordal Markov network learning amounts to the task of optimizing maximum weight spanning trees induced by Directed Graphs chordal graphs (Corander et al. 2013). Chordality is a re- As usual, a directed graph G is a pair hV; Ei, where V is a fi- laxation of strict acyclicity in which cycles of length three nite set of vertices and E ⊆ V ×V is a set of directed edges. are allowed in an otherwise tree-structured undirected graph. For some v 2 V , we denote the number of incoming or out- Constraint-based methods can also be used to infer phyloge- going edges, respectively, by deg−(v) = jfu j hu; vi 2 Egj netic trees (Brooks et al. 2007; Bonet and John 2009), de- and deg+(v) = jfu j hv; ui 2 Egj; v is a root (or leaf ) of G scribing the evolution of living organisms, languages, and if deg−(v) = 0 (or deg+(v) = 0). A path of length k − 1 other evolving systems. in G is a non-empty sequence v1; : : : ; vk of vertices from V The basic problem to be solved with constraint-based for- such that hvi; vi+1i 2 E and vi 6= vj for all 1 ≤ i < j ≤ k. malisms in the above and other applications is constructing A sequence v0; v1; : : : ; vk is a cycle of length k in G if ∗The support from the Finnish Centre of Excellence in Com- hv0; v1i 2 E, v0 = vk, and v1; : : : ; vk is a path in G. putational Inference Research (COIN) funded by the Academy of A directed acyclic graph is a directed graph G such that Finland (under grant #251170) is gratefully acknowledged. there is no cycle in G. A directed acyclic graph G = hV; Ei y Also affiliated with the University of Potsdam, Germany. is a directed forest if, for every vk 2 V , there is exactly z Also affiliated with Griffith University, Brisbane, Australia. one path v1; : : : ; vk in G from a root v1 of G to vk. Given Copyright c 2014, Association for the Advancement of Artificial 1 Intelligence (www.aaai.org). All rights reserved. http://research.ics.aalto.fi/software/asp/etc/asp-acyclic.pdf 634 1 1 1 1 5 order(X,Y) :- pair(X,Y), not edge(X,Y). 6 order(X,Y) :- pair(X,Y), order(Y). 2 3 2 3 2 3 2 3 7 order(X) :- node(X), order(X,Y) : pair(X,Y). 4 5 4 5 4 5 4 5 9 :- node(X), not order(X). (a) Cyclic (b) Acyclic (c) Forest (d) Tree Figure 3: Inductive bottom-up encoding of acyclicity test Figure 1: Directed example graphs with five vertices each order(3) :- order(3,1), order(3,2), order(3,4), order(3,5). 1 #const n=5. :- not order(3). 2 node(1..n). order(3, ) 3 3 pair(X,Y) :- node(X;Y), X != Y. As expressed by v , vertex fulfills the condi- 4 { edge(X,Y) } :- pair(X,Y). tion of < relative to a potential successor v 2 f1; 2; 4; 5g if there is no edge from 3 to v or if v has no path to 3. Figure 2: Encoding part for generating directed graphs Then, order(3) is derived once the existence of a cycle through vertex 3 can be safely excluded for all potential suc- cessors v of 3. In particular, the positive prerequisites of cor- that any incoming edge hvk−1; vki can be extended to a responding ground rules for other vertices along with well- path v1; : : : ; vk−1; vk from a root v1, the former condition is foundedness of derivations, as required in ASP, prohibit equivalent to requiring deg−(v) ≤ 1 for all vertices v 2 V . order(3) to hold if 3 belongs to some cycle. Given this, Finally, a directed tree is a directed forest G = hV; Ei with a the integrity constraint denying models such that order(3) unique root, i.e., deg−(v) = 0 holds for exactly one v 2 V . is false rejects any directed graph with a cycle through 3, and Some directed example graphs illustrating the introduced respective ground rules establish the same for other vertices. acyclicity properties are depicted in Figure 1. Reconsidering the example graph in Figure 1(a), we have that order(u,v) can be derived for distinct vertices u and v Encodings such that hu; vi is not an edge. Since each vertex u has some successor v, there still is some atom order(u,v) for u We illustrate different encodings by means of first-order that cannot be concluded in this way, e.g., order(5,3) specifications in the input language of the ASP grounder for vertex 5. Hence, order(u) remains underivable for all GRINGO (Gebser et al. 2012). The underlying principles, u 2 f1; 2; 3; 4; 5g, and the cyclic graph in Figure 1(a) is re- however, are of general applicability, and we outline partic- jected by means of the rules in Figure 3. Unlike this, vertex 5 ularities of respective SAT, DL, and LP formulations. has no successor in the acyclic graph shown in Figure 1(b), Rules describing the (non-deterministic) generation of di- so that order(5,v) is derivable for v 2 f1; 2; 3; 4g. This in node rected graphs are shown in Figure 2. The predicate /1 turn yields order(5), order(4,5), and order(4), given 1;:::; n n provides the labels for vertices, where is an in- that 5 is the only successor of vertex 4. Similarly, the deriva- teger constant standing for the number of vertices, and the tion of order(2,4) leads to order(2), and the establish- pair symmetric predicate /2 represents the domain of di- ment of order(3,2), order(3,4), and order(3,5) for rected edges given by all pairs of distinct vertices. Any the successors of vertex 3 allows for deriving order(3). Fi- subset of these pairs can be generated via the choice rule in nally, order(1) can be concluded in view of order(1,2) edge line 4, permitting instances of /2 to hold without further and order(1,3). As derivable atoms are compatible with preconditions. For instance, the atoms characterizing the di- (ground instances of) the integrity constraint in line 9 of Fig- edge(1,2) edge(1,3) rected graph in Figure 1(a) are , , ure 3, the graph in Figure 1(b) passes the acyclicity test. edge(2,4), edge(3,2), edge(4,5), and edge(5,3). Encoding Variants Acyclicity Checking The encoding in Figure 3 is non-tight, i.e., it relies on To make sure that a generated directed graph hV; Ei is well-foundedness in the presence of circular positive de- acyclic, we may check whether there is a strict partial or- pendencies on the ground level.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 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