Skip to main content Accessibility help

Finding similar/diverse solutions in answer set programming*


For some computational problems (e.g., product configuration, planning, diagnosis, query answering, phylogeny reconstruction), computing a set of similar/diverse solutions may be desirable for better decision-making. With this motivation, we have studied several decision/optimization versions of this problem in the context of Answer set programming (ASP), analyzed their computational complexity, and introduced offline/online methods to compute similar/diverse solutions of such computational problems with respect to a given distance function. All these methods rely on the idea of computing solutions to a problem by means of finding the answer sets for an ASP program that describes the problem. The offline methods compute all solutions of a problem in advance using the ASP formulation of the problem with an existing ASP solver, like clasp, and then identify similar/diverse solutions using some clustering methods (possibly in ASP as well). The online methods compute similar/diverse solutions of a problem following one of the three approaches: by reformulating the ASP representation of the problem to compute similar/diverse solutions at once using an existing ASP solver; by computing similar/diverse solutions iteratively (one after the other) using an existing ASP solver; by modifying the search algorithm of an ASP solver to compute similar/diverse solutions incrementally. All these methods are sound; the offline method and the first online method are complete whereas the others are not. We have modified clasp to implement the last online method and called it clasp-nk. In the first two online methods, the given distance function is represented in ASP; in the last one, however, it is implemented in C++. We have shown the applicability and the effectiveness of these methods using clasp or clasp-nk on two sorts of problems with different distance measures: on a real-world problem in phylogenetics (i.e., reconstruction of similar/diverse phylogenies for Indo-European languages), and on several planning problems in a well-known domain (i.e., Blocks World). We have observed that in terms of computational efficiency (both time and space), the last online method outperforms the others; also, it allows us to compute similar/diverse solutions when the distance function cannot be represented in ASP (e.g., due to some mathematical functions not supported by the ASP solvers) but can be easily implemented in C++.

Hide All

Part of the results in this paper are contained, in preliminary form, in Proceedings of the 25th International Conference on Logic Programming (ICLP 2009). This work was partially supported by FWF (Austrian Science Funds) project P20841, the Wolfgang Pauli Institute, and TUBITAK Grants 107E229 and 108E229.

Hide All
Bafna, V. and Pevzner, P. 1998. Sorting by transpositions. SIAM Journal of Discrete Mathematics 11, 224240.
Bailleux, O. and Marquis, P. 1999. DISTANCE-SAT: Complexity and algorithms. In Proc. of AAAI, 642647.
Bluis, J. and Shin, D.-G. 2003. Nodal distance algorithm: Calculating a phylogenetic tree comparison metric. In Proc. of BIBE, 8794.
Bodenreider, O., Çoban, Z. H., Doğanay, M. C., Erdem, E. and Koşucu, H. 2008. A preliminary report on answering complex queries related to drug discovery using answer set programming. In Proc. of ALPSWS, 8590.
Brooks, D. and McLennan, D. 1991. Phylogeny, Ecology, and Behavior: A Research Program in Comparative Biology. University of Chicago Press, Chicago, IL.
Brooks, D. R., Erdem, E., Erdogan, S. T., Minett, J. W. and Ringe, D. 2007. Inferring phylogenetic trees using answer set programming. Journal of Automated Reasoning 39 (4), 471511.
Brooks, D. R., Erdem, E., Minett, J. W. and Ringe, D. 2005. Character-based cladistics and answer set programming. In Proc. of PADL, 3751.
Caldiran, O., Haspalamutgil, K., Ok, A., Palaz, C., Erdem, E. and Patoglu, V. 2009. Bridging the gap between high-level reasoning and low-level control. In Proc. of LPNMR, 342354.
Camin, J. and Sokal, R. 1965. A method for deducing branching sequences in phylogeny. Evolution 19 (3), 311326.
Chafle, G., Dasgupta, K., Kumar, A., Mittal, S. and Srivastava, B. 2006. Adaptation in web service composition and execution. In Proc. of ICWS, 549557.
Chen, Z.-Z. and Toda, S. 1995. The complexity of selecting maximal solutions. Information and Computation 119, 231239.
Coban, E., Erdem, E. and Ture, F. 2008. Comparing ASP, CP, ILP on two challenging applications: Wire routing and haplotype inference. In Proc. of the 2nd International Workshop on Logic and Search (LaSh 2008), 166180.
DasGupta, B., He, X., Jiang, T., Li, M., Tromp, J. and Zhang, L. 1997. On distances between phylogenetic trees. In Proc. of SODA, 427436.
Davis, M., Logemann, G. and Loveland, D. 1962. A machine program for theorem-proving. Communications of the ACM 5, 394397.
Do, M. B. and Kambhampati, S. 2001. Planning as constraint satisfaction: Solving the planning graph by compiling it into CSP. Artificial Intelligence 132 (2), 151182.
Edwards, A. and Cavalli-Sforza, L. 1964. Reconstruction of evolutionary trees. In Phenetic and Phylogenetic Classification, Heywood, V. H. and McNeill, J., Systematics Association, London, 6776.
Eiter, T. and Subrahmanian, V. 1999. Heterogeneous active agents, ii: Algorithms and complexity. Artificial Intelligence 108 (1–2), 257307.
Erdem, E. 2002. Theory and Applications of Answer Set Programming. PhD thesis, Department of Computer Sciences, University of Texas at Austin.
Erdem, E. 2009. PHYLO-ASP: Phylogenetic systematics with answer set programming. In Proc. of LPNMR, 567572.
Erdem, E., Lifschitz, V. and Ringe, D. 2006. Temporal phylogenetic networks and logic programming. Theory and Practice of Logic Programming 6 (5), 539558.
Erdem, E. and Wong, M. D. F. 2004. Rectilinear Steiner tree construction using answer set programming. In Proc. of ICLP, 386399.
Felsenstein, J. 2009. Phylip. URL:
Ferraris, P. and Lifschitz, V. 2005. Weight constraints as nested expressions. Theory and Practice of Logic Programming 5, 4574.
Gebser, M., Kaufmann, B., Neumann, A. and Schaub, T. 2007a. clasp: A conflict-driven answer set solver. In Proc. of LPNMR, 260265.
Gebser, M., Kaufmann, B., Neumann, A. and Schaub, T. 2007b. T.: Conflict-driven answer set solving. In Proc. of IJCAI, 386392.
Gelfond, M. and Lifschitz, V. 1991. Classical negation in logic programs and disjunctive databases. New Generation Computing 9, 365385.
Gerevini, A., Saetti, A. and Serina, I. 2003. Planning through stochastic local search and temporal action graphs in LPG. Journal of Artificial Intelligence Research 20 (1), 239290.
Gutin, G. 2003. Independent sets and cliques. In Handbook of Graph Theory, Chap. 5.3. Gross, J. L. and Yellin, J., Eds. CRC Press, Boca Raton, FL, 389402.
Hamming, R. W. 1950. Error detecting and error correcting codes. Bell System Technical Journal 29 (2), 147160.
Hebrard, E., Hnich, B., O'Sullivan, B. and Walsh, T. 2005. Finding diverse and similar solutions in constraint programming. In Proc. of AAAI, 372377.
Hebrard, E., O'Sullivan, B. and Walsh, T. 2007. Distance constraints in constraint satisfaction. In Proc. of IJCAI, 106111.
Hon, W.-K., Kao, M.-Y. and Lam, T.-W. 2000. Improved Phylogeny Comparisons: Non-shared Edges, Nearest Neighbor Interchanges, and Subtree Transfers. In Algorithms and Computation. Goos, G., Hartmanis, J., van Leeuwen, J., Lee, D. T., Teng, S-H., Eds. Springer Berlin/Heidelberg, 369382.
Kautz, H. A. and Selman, B. 1992. Planning as satisfiability. In Proc. of ECAI, 359363.
Kuhner, M. and Felsenstein, J. 1994. A simulation comparison of phylogeny algorithms under equal and unequal evolutionary rates [published erratum appears in Mol Biol Evol 1995 May;12(3):525]. Molecular Biology and Evolution 11 (3), 459468.
Lifschitz, V. 1999. Action languages, answer sets and planning. In The Logic Programming Paradigm: a 25-Year Perspective, Apt, K. R., Marek, V. W., Truszczynski, M., Warren, D. S., Eds. Springer Verlag, Berlin, 357373.
Lifschitz, V. 2008. What is answer set programming? In Proc. of. AAAI, 15941597.
Lifschitz, V. 2010. Thirteen definitions of a stable model. In Fields of Logic and Computation, Blass, A., Derschowitz, N., Reisig, W., Eds. Springer-Verlag, Berlin, Heidelberg, 488503.
Lifschitz, V., Tang, L. R. and Turner, H. 1999. Nested expressions in logic programs. Annals of Mathematics and Artificial Intelligence 25, 369389.
Marek, W. and Remmel, J. 2003. On the expressibility of stable logic programming. Theory and Practice of Logic Programming 3 (4–5), 551567.
Marques-Silva, J. and Sakallah, K. 1999. A search algorithm for propositional satisfiability. IEEE Transactions on Computers 5, 506521.
McIlraith, S. A. and Son, T. C. 2002. Adapting Golog for composition of semantic web services. In Proc. of KR, 482496.
Nogueira, M., Balduccini, M., Gelfond, M., Watson, R. and Barry, M. 2001. An A-Prolog decision support system for the space shuttle. In Proc. of PADL. Springer-Verlag, London, 169183.
Nye, T. M., Lio, P. and Gilks, W. R. 2006. A novel algorithm and web-based tool for comparing two alternative phylogenetic trees. Bioinformatics 22 (1), 117119.
Papadimitriou, C. 1994. Computational Complexity. Addison-Wesley, Reading, MA.
Ringe, D., Warnow, T. and Taylor, A. 2002. Indo-European and computational cladistics. Transactions of the Philological Society 100 (1), 59129.
Robinson, D. F. and Foulds, L. R. 1981. Comparison of phylogenetic trees. Mathematical Biosciences 53 (1–2), 131147.
Simons, P., Niemelä, I. and Soininen, T. 2002. Extending and implementing the stable model semantics. Artificial Intelligence 138, 181234.
Soininen, T. and Niemelä, I. 1998. Developing a declarative rule language for applications in product configuration. In Proc. of PADL, 305319.
Son, T., Pontelli, E. and Sakama, C. 2009. Logic programming for multiagent planning with negotiation. In Proc. of ICLP, 99114.
Srivastava, B., Nguyen, T. A., Gerevini, A., Kambhampati, S., Do, M. B. and Serina, I. 2007. Domain independent approaches for finding diverse plans. In Proc. of IJCAI, 20162022.
Swofford, D. L. 2003. PAUP*: Phylogenetic Analysis under Parsimony (and Other Methods), version 4.0. Sinauer Associates, Sunderland, MA.
White, J. and O'Connell, J. 1982. A Prehistory of Australia, New Guinea, and Sahul. Academic, San Diego, CA.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *



Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed