A Scalable Scheme for Counting Linear Extensions

Topi Talvitie, Kustaa Kangas, Teppo Mikael Niinimäki, Mikko Koivisto

Abstract

Counting linear extensions of a partial order is a #P-hard problem with significant applications in AI, ranging from preference reasoning to learning Bayesian network structures. While theoretical polynomial-time algorithms exist, their high-degree exponents often make them impractical. This paper presents Relaxation Tootsie Pop (RTP), a novel approximate counting scheme that bridges the gap between theory and practice. By combining continuous-space sampling with poset relaxation and a novel perfect sampler, RTP achieves efficient scalability for posets with hundreds of elements, outperforming both previous MCMC methods and state-of-the-art SAT-based counters.

Introduction

A partial order (poset) is a set of elements with defined "before/after" relationships where not every pair is comparable. A linear extension is a total ordering that respects these constraints. Counting these extensions is a fundamental problem in combinatorics and AI, but it is computationally intensive (#P-hard). Historically, researchers have relied on either slow polynomial-time MCMC schemes or exponential-time brute force methods that fail as the number of elements ($n$) grows.

Talvitie et al. address this scalability gap with Relaxation Tootsie Pop (RTP). Their approach moves away from discrete "swap-based" Markov chains toward a continuous-space framework, leveraging the efficiency of poset relaxation to reduce the computational distance to the target count.

Methodology

The RTP algorithm is built upon three technical pillars:

1. The Tootsie Pop Algorithm (TPA)

TPA transforms the discrete counting problem into a continuous volume measurement problem. It maps permutations into the unit hypercube $[0, 1]^n$ and uses random walks to estimate the ratio between nested sets.

2. Poset Relaxation

The "Relaxation" in RTP refers to starting the process from a simplified poset $R$ whose linear extensions are easy to count (e.g., a tree). Because the set of linear extensions of the target poset is a subset of the relaxation ($\mathcal{L}(P) \subseteq \mathcal{L}(R)$), the algorithm only needs to estimate the ratio of volumes between the relaxation and the target, which is much more efficient than starting from a trivial empty poset.

Conceptual diagram showing the relationship between the relaxation $\mathcal{L}(R)$ and the target poset $\mathcal{L}(P)$.

3. A Novel Perfect Sampler

The core technical innovation is a "continuous relocation" Markov chain. Using monotonic coupling-from-the-past, the authors developed a sampler that provides exact uniform samples from the continuous space. This eliminates the uncertainty of "mixing times" typically associated with MCMC methods.

The Relaxation Tootsie Pop (RTP) algorithm uses random walks in a continuous space to bridge the gap between the relaxation and the target.

Experimental Evaluation

The authors tested RTP against a benchmark suite of random, bipartite, and real-world posets (extracted from Bayesian networks like Andes and Munin) with up to 512 elements.

Key Results

  • Scalability: RTP demonstrates polynomial-like growth in runtime. While exponential-time methods like ARMC are faster for $n < 100$, they hit a computational wall at $n \approx 200$. RTP continues to perform efficiently up to $n=512$.
  • Efficiency: Utilizing a non-trivial relaxation provided an order-of-magnitude speedup compared to starting from an empty poset.
  • Comparison with SAT Counters: Despite the sophistication of modern SAT solvers (e.g., sharpSAT), they were significantly slower than RTP, often taking hours for tasks RTP completed in seconds.

Conclusion

Relaxation Tootsie Pop represents a significant step forward in practical combinatorial counting. By mapping discrete constraints into a continuous domain and utilizing intelligent relaxations, the authors have created a tool capable of handling the scale required for modern AI applications. Future work includes formalizing the polynomial time complexity bounds and exploring large-scale parallelization.

Summary updated

BibTeX
@inproceedings{talvitie2018scalable,
  author = {Topi Talvitie and Kustaa Kangas and Teppo Mikael Niinimäki and Mikko Koivisto},
  title = {{A Scalable Scheme for Counting Linear Extensions}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/710},
}
Figure