Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
HELSINGIN YLIOPISTO HELSINGFORS UNIVERSITET UNIVERSITY OF HELSINKI MATEMAATTIS-LUONNONTIETEELLINEN TIEDEKUNTA MATEMATISK-NATURVETENSKAPLIGA FAKULTETEN FACULTY OF SCIENCE COUNTING LINEAR EXTENSIONS OF SPARSE POSETS Kustaa Kangas, Teemu Hankala, Teppo Niinimäki, Mikko Koivisto Department of Computer Science Counting the linear extensions of a partially ordered set (poset) is a fundamental problem with several applications. We present two exact algorithms that target sparse posets in particular. The first algorithm PROBLEM breaks the counting task into subproblems recursively. The second algorithm uses variable elimination via inclusion–exclusion and runs in polynomial time for posets with a cover graph of bounded treewidth. RECURSIVE COUNTING A poset P is a set of n elements ordered by a transitive asymmetric relation < P . For all x, y ∈ P either Denoting minimal elements by min( P), `( P) = I ∑ `( P \ x ) x ∈ min( P) 1. x < P y If P can be partitioned into pairwise disconnected sets A and B, 2. y < P x 3. x and y incomparable The cover relation ≺ P is the transitive reduction of < P . Represented visually by the cover graph. A linear extension is a bijection σ : P → [n] such that x ≺ P y ⇒ σx < σy | P| | A| Implementations [1]: • R1: Applies rule I, runs in O(2n ) time in the worst case • R14-a: Applies rules I and II, often greatly expedites R1 • R24: Applies rule II together with other techniques [2] 103 103 Small average degree 101 103 Small maximum indegree 0 101 Bipartite 101 100 10−1 100 0 20 40 60 80 Percentage of posets solved The inverse may lead to fewer subproblems. 102 R14-a 100 R1 R24 100 10−1 Rules I and II break the poset into subproblems recursively. 102 Time (s) Time (s) 102 Problem: Compute `( P), the number of linear extensions. (#P-complete) Time (s) An element x with no y < P x is minimal. `( P) = `( A) · `( B) · II 10−1 100 0 20 40 60 80 Percentage of posets solved 20 40 60 80 Percentage of posets solved 100 VARIABLE ELIMINATION VIA INCLUSION–EXCLUSION For every mapping σ : P → [n] let ∏ With the elimination order (d, b, e, a, c) the sum factorizes: ! ∑ ∑ [b<d] ∑ [d<e] ∑ [a<d] ∑ [a<c][c<e] [σx < σy ] . x ≺P y d Therefore, `( P) = ∑ Φ(σ) . σ : P → [n] bijection The inclusion–exclusion principle removes the bijectivity constraint: n n `( P) = ∑ (−1)n−k ∑ Φ(σ) k k=0 σ : P → [k] {z } | → can use variable elimination (e.g. [3,4]) {z λb ( d ) a c | } | ∑ {z λc ( a,e) } {z λa (d,e) The summation task is | } {z } λe ( d ) [ a<c] [ a<d] [b<d] [c<e] [d<e] a,b,c,d,e • Good order → the λ are small and fast to compute where a = σa , b = σb , . . . • A cover graph of low treewidth has good orders 103 IMPLEMENTATION The implementation VEIE runs in O(nt+4 ) time for n elements and a cover graph of treewidth t. 101 101 VEIE 100 R1 R14-a 100 10−1 t =3 102 30 40 [1] Implementation available at www.cs.helsinki.fi/u/jwkangas/lecount/ [2] M. Peczarski. New results in minimum-comparison sorting. Algorithmica, 40(2):133–145, 2004. [3] R. Dechter. Bucket elimination: A unifying framework for reasoning. Artificial Intelligence, 113(12):41–85, 1999. [4] U. Bertelè and F. Brioschi. Nonserial Dynamic Programming. Academic Press, 1972. 103 t =2 102 Time (s) Then, if σ is a bijection, we have ( 1, if σ is a linear extension, Φ(σ) = 0, otherwise. e b | Time (s) Φ(σ) = EXAMPLE 50 60 70 80 Poset size (n) 90 10−1 100 30 40 50 60 70 80 Poset size (n) 90 100