Abstract
Answer-Set Programming (ASP) is a powerful declarative modeling paradigm, but its evaluation is computationally intensive, typically residing at the second level of the polynomial hierarchy. This paper introduces a novel dynamic programming approach that exploits the structural "tree-likeness" of logic programs, measured by treewidth. By utilizing tree decompositions of incidence graphs, the proposed algorithms achieve linear-time performance for counting answer sets and linear-delay for enumeration when treewidth is bounded. Experimental results with the LAPS prototype demonstrate significant performance gains over state-of-the-art solvers for counting tasks, particularly as the number of solutions grows.
Introduction
Answer-Set Programming (ASP) is widely used for modeling complex combinatorial problems in artificial intelligence. However, the computational cost is high: deciding the existence of a solution is $\Sigma_2^P$-complete, and counting solutions is #NP-complete. Modern solvers like DLV and Clasp primarily utilize techniques from SAT solving and Constraint Satisfaction Problems (CSP). While effective, these solvers often overlook the inherent graph structure of specific problem instances.
This research applies parameterized complexity theory, specifically focusing on treewidth, to address these challenges. The goal is to demonstrate that if a problem's structure is sufficiently "tree-like," even highly intractable ASP tasks can become solvable in linear time relative to the program's size.
Methodology
The core of the proposed approach is a dynamic programming algorithm that processes a tree decomposition of the program's incidence graph. In this graph, nodes represent both atoms and rules, with edges indicating the participation of atoms in specific rules.
The algorithm employs a bottom-up traversal of the tree decomposition. To handle ASP's global minimality requirement locally, the authors introduce certificates. These data structures track whether a sub-interpretation could be "defeated" by a smaller one, ensuring that only valid answer sets are counted or enumerated. The process involves:
- Decomposition: Converting the program into a "nice" tree decomposition.
- Leaf-to-Root Traversal: Computing local models and certificates at each node.
- Counting and Enumeration: Aggregating results at the root for counting, or using a top-down traversal with lazy evaluation for enumeration.
Experimental Evaluation
The approach was implemented in a prototype system called LAPS (Lazy Answer-Set Programming System), written in Haskell. Evaluation focused on randomly generated disjunctive logic programs, comparing LAPS against the state-of-the-art solver DLV. The benchmarks specifically examined how performance scales with both the number of answer sets and the treewidth of the instances.
Key Results
The experiments confirmed that for a fixed treewidth, the dynamic programming approach scales linearly with the size of the input program. A significant finding was the difference in counting performance.
While DLV's runtime grew exponentially with the number of answer sets (as shown in Figure 4), LAPS's runtime for counting remained nearly constant for a fixed treewidth. For enumeration, LAPS remained competitive with DLV for instances with treewidth up to 6.
Discussion and Future Work
The primary limitation of this approach is the "treewidth wall": while the algorithm is linear in program size, it is exponential in treewidth. Efficiency drops significantly as treewidth exceeds 7 due to the explosion in the number of local models. Additionally, the need for high-quality tree decomposition adds preprocessing overhead.
Future research directions include optimizing tree decompositions, exploring parallelization, and porting the implementation to lower-level languages to improve raw performance. This work establishes structural tractability as a viable path for scaling ASP to complex, structured domains.
Summary updated