Finding Similar/Diverse Solutions in Answer Set Programming

Finding Similar/Diverse Solutions in Answer Set Programming
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

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 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 in advance using the ASP formulation of the problem with an ASP solver, like Clasp, and then identify similar/diverse solutions using clustering methods. The online methods compute similar/diverse solutions following one of the three approaches: by reformulating the ASP representation of the problem to compute similar/diverse solutions at once using an ASP solver; by computing similar/diverse solutions iteratively (one after other) using an ASP solver; by modifying the search algorithm of an ASP solver to compute similar/diverse solutions incrementally. We 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 it is implemented in C++. We showed the applicability and the effectiveness of these methods on reconstruction of similar/diverse phylogenies for Indo-European languages, and on several planning problems in Blocks World. We observed that in terms of computational efficiency 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.


💡 Research Summary

The paper addresses a practical need that arises in many AI and knowledge‑intensive applications: instead of returning a single optimal answer, a user often wants a small set of solutions that are either mutually similar (to explore variations of a good solution) or mutually diverse (to cover different possibilities). The authors formalize this requirement within the framework of Answer Set Programming (ASP), a declarative paradigm where each answer set corresponds to a solution of a combinatorial problem.

Two fundamental decision problems are defined. The first asks, given an ASP program P, a distance measure Δ that maps a set of solutions to a non‑negative integer, and integers n and k, whether there exists a set S of exactly n answer sets such that Δ(S) ≤ k (k‑similar) or Δ(S) ≥ k (k‑diverse). The second problem, given an existing set S of n solutions, asks whether there exists another solution s (not in S) that can be added while preserving the same bound on Δ(S ∪ {s}). By fixing or optimizing different parameters, a whole family of related optimization problems (e.g., minimizing k for a fixed n, maximizing n for a fixed k) can be derived.

Complexity analysis shows that, under reasonable assumptions (Δ computable in polynomial time and its range polynomially bounded), the decision problems lie at the second level of the polynomial hierarchy (Σ₂^P‑complete or Π₂^P‑complete). This is one level higher than ordinary ASP model‑finding (NP‑complete), reflecting the added quantifier “exists a set of n solutions”. When Δ is not polynomially bounded or requires non‑polynomial computation, the problems become even harder.

To solve these problems the authors propose an offline approach and three online approaches.

Offline method: Compute all answer sets of P once (using any ASP solver such as Clasp), then apply a clustering or selection procedure based on Δ to extract a desired k‑similar or k‑diverse subset. This method is sound and complete but can be infeasible when the number of answer sets is exponential.

Online Method 1: Extend the original ASP encoding with “choice” rules that generate n distinct solutions in a single run, and encode Δ as an ASP sub‑program. The combined program’s answer set directly contains the n solutions satisfying the distance bound. This method is also complete, but it requires that Δ be expressible in ASP (i.e., using only constructs supported by the solver).

Online Method 2: Keep the original problem encoding unchanged, but iteratively invoke the solver. After each solution sᵢ has been found, a new ASP program consisting of the distance definition and a constraint that forces the next solution to be k‑close (or k‑distant) to the already collected set is solved. Repeating this yields a set of n solutions. The method is sound but not complete because the quality of the final set depends on the first solution found; different initial solutions can lead to different outcomes.

Online Method 3: Modify the search algorithm of the ASP solver itself. The authors instrument Clasp, creating a variant called Clasp‑NK, that checks the distance bound during the conflict‑driven search. Whenever a partial assignment would violate the bound with respect to already accepted solutions, the search backtracks immediately. The distance function is implemented in C++, allowing arbitrary (even non‑ASP‑expressible) computations. This method is the most efficient experimentally, uses far less memory, and works for any computable distance, but it also lacks completeness for the same reason as Method 2 (the search order influences the result).

The paper validates the approaches on two distinct domains.

  1. Phylogeny reconstruction: Using the ASP encoding of Brooks et al. (2007) for generating rooted, leaf‑labeled trees, the authors introduce two novel distance measures for sets of phylogenies (a partition‑based distance and a tree‑structure distance). They apply the offline method and Online Method 3 (Clasp‑NK) to the Indo‑European language family dataset. Results show that Clasp‑NK can compute k‑similar or k‑diverse sets of phylogenies orders of magnitude faster than the offline approach, while still producing biologically meaningful alternatives. The system PHYL‑ASP integrates these capabilities, offering the first tool that lets linguists explore families of phylogenies based on similarity/diversity criteria.

  2. Blocks‑World planning: Plans are encoded as sequences of actions; the authors adopt the action‑based Hamming distance from Srivastava et al. (2007). They compare the offline method, Online Methods 1 and 2, and Clasp‑NK on several Blocks‑World instances. Again, Clasp‑NK outperforms the others in runtime and memory consumption, and it can handle distance functions that involve arithmetic not supported by ASP (e.g., weighted Hamming).

The related‑work discussion positions the contribution relative to prior studies in propositional logic, constraint programming, and planning that only considered simple Hamming distances and often assumed polynomial‑time distance evaluation. By allowing arbitrary distance functions and integrating them tightly with ASP solving, the paper opens a new research direction.

In conclusion, the authors provide a thorough theoretical foundation (problem definitions, complexity results), a spectrum of practical algorithms (offline, three online variants), an engineered solver extension (Clasp‑NK), and convincing empirical evidence on two real‑world domains. The work demonstrates that ASP, when equipped with distance‑aware search, can serve not only as a tool for finding a single optimal model but also as a versatile engine for generating curated sets of similar or diverse solutions—an ability that is likely to be valuable across many AI, bioinformatics, and configuration‑management applications.


Comments & Academic Discussion

Loading comments...

Leave a Comment