Finding Similar/Diverse Solutions in Answer Set Programming

Thomas Eiter, Esra Erdem, Halit Erdogan, Michael Fink

Abstract

In many complex computational tasks, finding a single valid solution is often insufficient. Users frequently require either a diverse set of solutions to explore a large search space or a set of similar solutions to provide robust alternatives when a primary plan fails. This paper addresses the challenge of finding $n$ solutions with specific distance constraints within the Answer Set Programming (ASP) framework. By introducing theoretical complexity results and a novel solver modification, CLASP-NK, the authors demonstrate significant improvements in computational efficiency and memory usage compared to traditional modeling approaches.

Introduction

Answer Set Programming (ASP) has emerged as a powerful paradigm for solving combinatorial search problems. While standard ASP solvers are highly efficient at finding one or all solutions to a problem, they lack native mechanisms to reason about the relationship between different solutions. In practical applications—such as robot path planning, configuration, or biological phylogeny reconstruction—the sheer volume of valid solutions can be overwhelming. This paper investigates how to systematically find sets of solutions that are either intentionally similar or purposefully diverse.

The Problem: Solution Explosion and Robustness

The motivation for this research stems from two primary practical needs:

  1. Solution Explosion: In domains like planning, a solver might generate thousands of valid but nearly identical plans. A user cannot manually inspect these; instead, they require a representative (diverse) sample to understand the breadth of possibilities.
  2. Robustness and Recovery: If a chosen plan becomes unfeasible due to real-world changes, a user needs an alternative that is as close as possible to the original (similar) to minimize the cost of switching.

To address these, the authors define the computational task of finding $n$ solutions such that the distance between any two solutions is either at least or at most $k$. The paper proves that finding such sets is generally NP-complete, while optimization variants (e.g., finding the most diverse set) reside higher in the complexity hierarchy at $FP^{NP}$.

Proposed Methodologies

The authors propose and compare four distinct strategies for solving these distance-constrained problems:

1. Offline Method

This "brute force" approach involves computing all possible solutions first and then applying clustering or clique-finding algorithms to select the subset that satisfies the distance constraints. While conceptually simple, it is computationally infeasible for problems with a large number of solutions.

2. Online Reformulation

This method rewrites the ASP program so that a single "answer set" represents $n$ different solutions simultaneously. Constraints are added to the logic program to enforce the distance requirements. While this stays within the standard ASP language, it increases the problem size by a factor of $n$, often leading to memory exhaustion.

3. Iterative Online Method

A greedy approach where the solver finds one solution, then adds a constraint to find a second solution relative to the first, and continues until $n$ solutions are found. This is fast but "incomplete," as the initial choice may prevent the solver from finding a globally optimal set of solutions.

4. Incremental Solver Modification (CLASP-NK)

The core contribution of the paper is the modification of the internal search algorithm of the clasp solver. CLASP-NK integrates distance reasoning directly into the C++ search heuristics. By estimating the distance of partial solutions during the search process, the solver can prune branches of the search tree that cannot possibly satisfy the distance constraints, leading to dramatic performance gains.

Experimental Evaluation

The methods were evaluated using two distinct benchmarks:

  • Phylogeny Reconstruction: Analyzing a real-world dataset of Indo-European languages to find evolutionary trees. This required "Nodal Distance" measures to compare tree structures.
  • Blocks World Planning: A classic AI benchmark used to test the efficiency of finding diverse plans in a search space containing over 50,000 possible solutions.

Key Results and Insights

The experiments highlighted the superiority of integrating distance functions into the solver's core rather than relying on high-level modeling:

  • Performance: In phylogeny experiments, CLASP-NK found similar solutions in 1.46 seconds, whereas the reformulation method took 26.23 seconds—a nearly 18x speedup.
  • Memory Efficiency: In the Blocks World problem, the reformulation method frequently encountered Out-of-Memory (OM) errors. In contrast, CLASP-NK maintained a stable memory footprint (approximately 111MB) even when searching for six similar plans.
  • Flexibility: The framework is modular, allowing for various distance measures beyond simple Hamming distance, such as action-based distances for plans or structural distances for trees.

Conclusion and Future Work

The research demonstrates that finding sets of similar or diverse solutions is a computationally hard but manageable task when distance constraints are handled at the solver level. The resulting tool, CLASP-NK, has been successfully integrated into PHYLO-ASP, providing historical linguists with a robust tool for language evolution analysis.

Future research directions include improving the admissibility of distance heuristics to allow for more effective pruning and exploring "hybrid" constraints—such as finding a solution that is simultaneously close to a "good" reference and far from a set of "bad" examples.

Summary updated

BibTeX
@inproceedings{eiter2013finding,
  author = {Thomas Eiter and Esra Erdem and Halit Erdogan and Michael Fink},
  title = {{Finding Similar/Diverse Solutions in Answer Set Programming}},
  booktitle = {Theory Pract. Log. Program},
  year = {2013},
  url = {https://openreview.net/forum?id=OFFgXjq9t7},
}
Figure