AlgoPerm2012 - 08 Jean Cardinal

51
Sorting and a Tale of Two Polytopes Jean Cardinal ULB, Brussels, Belgium Algorithms & Permutations, Paris, 2012

description

Jean Cardinal (Computer Science Department, Université Libre de Bruxelles) Sorting and a Tale of Two Polytopes Algorithms & Permutations 2012, Paris. http://igm.univ-mlv.fr/AlgoB/algoperm2012/

Transcript of AlgoPerm2012 - 08 Jean Cardinal

Page 1: AlgoPerm2012 - 08 Jean Cardinal

Sortingand

a Tale of Two Polytopes

Jean CardinalULB, Brussels, Belgium

Algorithms & Permutations, Paris, 2012

Page 2: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons

Input: a set V , totally ordered by an unknown order 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

I Calssical problem in algorithms

I Θ(|V | log |V |) queries necessary and sufficient (Heap Sort,Merge Sort)

Page 3: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial Information

Input:

I a set V , totally ordered by an unknown order 6

I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

Page 4: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial Information

Input:

I a set V , totally ordered by an unknown order 6

I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

Page 5: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial Information

Input:

I a set V , totally ordered by an unknown order 6

I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

Page 6: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial Information

Input:

I a set V , totally ordered by an unknown order 6

I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

OR ?

Page 7: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial Information

Input:

I a set V , totally ordered by an unknown order 6

I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

?OR

Page 8: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial InformationInput:

I a set V , totally ordered by an unknown order 6I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

Page 9: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial InformationInput:

I a set V , totally ordered by an unknown order 6

I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

OR ?

Page 10: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial InformationInput:

I a set V , totally ordered by an unknown order 6I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

OR ?

Page 11: AlgoPerm2012 - 08 Jean Cardinal

Sorting by Comparisons under Partial InformationInput:

I a set V , totally ordered by an unknown order 6I a partial order P = (V ,6P) compatible with 6

Goal: Discover 6 by making queries “is x 6 y?”, for somex , y ∈ V

Objective function: #queries

Page 12: AlgoPerm2012 - 08 Jean Cardinal

Partial Orders and Linear Extensions

I Hasse diagram: maximum on top, transitive reduction

I e(P) := #linear extensions of P

a b

c d

b

a

d

c

b

a

c

d

a

b

d

c

a

b

c

d

a

c

b

dP

e(P ) = 5

Page 13: AlgoPerm2012 - 08 Jean Cardinal

Lower Bound

Every comparison-based sorting algorithm can be forced to do atleast

lg e(P)

comparisons.

Page 14: AlgoPerm2012 - 08 Jean Cardinal

Balanced Pairs

Does there always exist a comparison that ”splits” the set of linearextensions into roughly equal part?

I 1/3− 2/3 conjecture: In any partial order P, there exists apair of elements a, b such that the fraction of linear extensionshaving a < b is between 1/3 and 2/3

I Proved for smaller valuesBrightwell, Felsner, and Trotter, 1995 – Brightwell, 1999

Page 15: AlgoPerm2012 - 08 Jean Cardinal

A Counting Issue

I Computing e(P), or computing the fraction of linearextensions in which a < b for some pair a, b are #P-Completeproblems Brightwell and Winkler, 1991

Goal of this talk:

I Insights into approximations of lg e(P) that will eventuallyyield efficient sorting algorithms

Page 16: AlgoPerm2012 - 08 Jean Cardinal

Plan

I The Order Polytope O(P) of P and how it relates to lg e(P)

I The Chain Polytope C(P) and how it relates to O(P)

I Approximating lg e(P) using the graph entropy and how itrelates to the two polytopes

I A sorting algorithm

Page 17: AlgoPerm2012 - 08 Jean Cardinal

The Order Polytope

I We consider the Euclidean space RV of all functionsf : V → R

I the Order Polytope O(P) of P is the subset of RV defined by:

0 ≤ f (x) ≤ 1 ∀x ∈ V

f (x) ≤ f (y) if x 6P y

Page 18: AlgoPerm2012 - 08 Jean Cardinal

Interpretation

I O(P) is the intersection of the subsets depicted below, foreach comparable pair a 6P b

a

f (a)

f (b)

0 1

1

b

Page 19: AlgoPerm2012 - 08 Jean Cardinal

Example

a

b c

f (a)

f (b)

f (c)

0 1

1

1

f (a) ≤ f (b)

f (a) ≤ f (c)

0 ≤ f (a), f (b), f (c) ≤ 1

Page 20: AlgoPerm2012 - 08 Jean Cardinal

Volume of the Order Polytope

vol(O(P)) = e(P)/|V |!Stanley, 1986

A short proof:

I Every linear extension of P defines a simplex of O(P)

I Every simplex has volume 1/|V |!

Page 21: AlgoPerm2012 - 08 Jean Cardinal

Volume of the Order Polytope

a

b c

f (a)

f (b)

f (c)

0 1

1

1

?

f (a) ≤ f (b)

f (a) ≤ f (c)

0 ≤ f (a), f (b), f (c) ≤ 1

a

c

Page 22: AlgoPerm2012 - 08 Jean Cardinal

Volume of the Order Polytope

a

f (a)

f (b)

f (c)

0 1

1

1

b

c

f (a) ≤ f (b) ≤ f (c)

0 ≤ f (a), f (b), f (c) ≤ 1

Page 23: AlgoPerm2012 - 08 Jean Cardinal

Volume of the Order Polytope

a

f (a)

f (b)

f (c)

0 1

1

1

b

c

f (a) ≤ f (c) ≤ f (b)

0 ≤ f (a), f (b), f (c) ≤ 1

Page 24: AlgoPerm2012 - 08 Jean Cardinal

The Chain Polytope

I The Chain polytope C(P) of P is the subset of RV defined by

0 ≤ g(x) ∀x ∈ V∑x∈C

g(x) ≤ 1 for every chain C in P

I Convex hull of the characteristic vectors of subsets ofmutually incomparable elements (antichains)

I Convex corner: contains the convex hull of the origin and thebasis vectors

Page 25: AlgoPerm2012 - 08 Jean Cardinal

Example

a

b c

0 1

1

1

g(a)

g(b)

g(c)g(a) + g(b) ≤ 1

g(a) + g(c) ≤ 1

g(a), g(b), g(c) ≥ 0

Page 26: AlgoPerm2012 - 08 Jean Cardinal

Example

a

b c

0 1

1

1

g(a)

g(b)

g(c)independent sets:

{a}, {b}, {c}, {b, c}

Page 27: AlgoPerm2012 - 08 Jean Cardinal

From the Order Polytope to the Chain Polytope

I Define the transfer map φ : O(P)→ C(P) as follows: iff ∈ O(P) and x ∈ V , then

(φf )(x) = min{f (x)− f (y) : y <P x}

I It can be checked that φ is a continuous, piecewise-linearbijection from O(P) onto C(P)

Page 28: AlgoPerm2012 - 08 Jean Cardinal

Example

I the function f is increasing along the chain

I the function g has sum at most one along the chain

af(a)

f(b)

f(c)

01

1

1

b

c

g(a)

g(b)

g(c)

01

1

1

1/2

1/2

1 1/2

0

1/2

Page 29: AlgoPerm2012 - 08 Jean Cardinal

Consequence

vol(C(P)) = vol(O(P)) = e(P)/|V |!Stanley, 1986

I We may work with either polytope

I Considering the Chain polytope allows us to borrow ideasfrom graph theory

Page 30: AlgoPerm2012 - 08 Jean Cardinal

Approximation of (log)e(P)

Approximating the volume of a convex corner by an enclosed box:

Page 31: AlgoPerm2012 - 08 Jean Cardinal

Maximizing the Box Volume

I For any x ∈ C(P), the box with the origin and x as oppositecorners is fully contained in C(P)

I Let us define the following maximum included box program:

max∏v∈V

xv

s.t. x ∈ C(P)

Page 32: AlgoPerm2012 - 08 Jean Cardinal

Entropy

Taking the log, normalizing by n := |V |, and changing sign:

min −1

n

∑v∈V

lg xv

s.t. x ∈ C(P), x > 0

Page 33: AlgoPerm2012 - 08 Jean Cardinal

Entropy

I Let us give it a name:

H(P) = min −1

n

∑v∈V

lg xv

s.t. x ∈ C(P), x > 0

I Special case of the Graph Entropy Korner, 1973

I Applications to data compression, Boolean formulas,optimization

Page 34: AlgoPerm2012 - 08 Jean Cardinal

Entropy

I For P a total order, C(P) is the convex hull of the basisvectors only

I We set xv = 1/n ∀v ∈ V , and obtain H(P) = log n

I For P an empty order, C(P) is the unit cubeI We set xv = 1 ∀v ∈ V , and obtain H(P) = 0

I Intuitively, H(P) measures the quantity of informationcontained in P

Page 35: AlgoPerm2012 - 08 Jean Cardinal

Approximation

I Let x define the optimal box

I The volume of the box is bounded by that of the polytope:

∏v∈V

xv ≤ e(P)/n!

H(P) = −1

nlog

(∏v∈V

xv

)n log n − nH(P) ≤ lg e(P) + 1.443n

Page 36: AlgoPerm2012 - 08 Jean Cardinal

Approximation

I In fact, we can show that

lg e(P) = Θ(n log n − nH(P))

Kahn and Kim, 1992

I Furthermore, computing H(P) is a convex programmingproblem, that can be solved in polynomial time

I Hence we get a polynomial time constant-factorapproximation algorithm for the sorting lower bound lg e(P)

Page 37: AlgoPerm2012 - 08 Jean Cardinal

A Sorting Algorithm

1. Compute greedy chain decomposition of P

2. Iteratively merge two smallest chains

C1 C2 C3

Page 38: AlgoPerm2012 - 08 Jean Cardinal

A Sorting Algorithm

1. Compute greedy chain decomposition of P

2. Iteratively merge two smallest chains

C1 C2 C3 C4 C5 C6 C7

Page 39: AlgoPerm2012 - 08 Jean Cardinal

A Sorting Algorithm

1. Compute greedy chain decomposition of P

2. Iteratively merge two smallest chains

Page 40: AlgoPerm2012 - 08 Jean Cardinal

A Sorting Algorithm

1. Compute greedy chain decomposition of P

2. Iteratively merge two smallest chains

Page 41: AlgoPerm2012 - 08 Jean Cardinal

A Sorting Algorithm

1. Compute greedy chain decomposition of P

2. Iteratively merge two smallest chains

Page 42: AlgoPerm2012 - 08 Jean Cardinal

A Sorting Algorithm

ETC.

Page 43: AlgoPerm2012 - 08 Jean Cardinal

Analysis (Outline)

This algorithm performs (1 + ε)lg e(P) + Oε(n) comparisonsC., Fiorini, Joret, Jungers, Munro, 2010

Proof outline:

I The tree of merges is a Huffman tree

I Hence the number of comparisons is at most g + O(n),where :

g :=k∑

i=1

|Ci | lgn

|Ci |I We could prove that g is a good approximation of

n log n − nH(P), hence of lg e(P)

Page 44: AlgoPerm2012 - 08 Jean Cardinal

Summary

1. Volume of the Order Polytope O(P) of P proportional to e(P)

2. Chain Polytope C(P) = φO(P)

3. Maximum included box in C(P) → entropy → approximateslg e(P)

4. Cost of Greedy Merge Sort approximates entropy

Page 45: AlgoPerm2012 - 08 Jean Cardinal

Extending the Scope

I The graph entropy framework provides efficient algorithms forapproximating the number of linear extensions of a partialorder

I Can it be used for other applications?

I Can it be used to approximate other quantities?

Page 46: AlgoPerm2012 - 08 Jean Cardinal

Thank You!

Page 47: AlgoPerm2012 - 08 Jean Cardinal

Pointers: Stanley’s map

R. P. Stanley.Two poset polytopes.Discrete Comput. Geom., 1:9–23, 1986.

Page 48: AlgoPerm2012 - 08 Jean Cardinal

Pointers: Counting Linear Extensions

G. R. Brightwell and P. Winkler.Counting linear extensions.Order, 8(3):225–242, 1991.

Page 49: AlgoPerm2012 - 08 Jean Cardinal

Pointers: Sorting

M. L. Fredman.How good is the information theory bound in sorting?Theor. Comput. Sci., 1(4):355–361, 1976.

N. Linial.The information-theoretic bound is good for merging.SIAM J. Comput., 13(4):795–801, 1984.

J. Kahn and M. E. Saks.Balancing poset extensions.Order, 1:113–126, 1984.

J. Kahn and N. Linial.Balancing extensions via Brunn-Minkowski.Combinatorica, 11:363–368, 1991.

G. R. Brightwell.Balanced pairs in partial orders.Discrete Mathematics, 201(1–3):25–52, 1999.

Page 50: AlgoPerm2012 - 08 Jean Cardinal

Pointers: Entropy

J. Korner.Coding of an information source having ambiguous alphabetand the entropy of graphs.In Transactions of the 6th Prague Conference on InformationTheory, pages 411–425, 1973.

G. Simonyi.Graph entropy: a survey.In Combinatorial optimization (New Brunswick, NJ,1992–1993), volume 20 of DIMACS Ser. Discrete Math.Theoret. Comput. Sci., pages 399–441. Amer. Math. Soc.,Providence, RI, 1995.

Page 51: AlgoPerm2012 - 08 Jean Cardinal

Pointers: Sorting and Entropy

J. Kahn and J. H. Kim.Entropy and sorting.J. Comput. Syst. Sci., 51(3):390–399, 1995.

A. C.-C. Yao.Graph entropy and quantum sorting problems.In STOC’04: 36th Annual ACM Symposium on Theory ofComputing, pages 112–117, 2004.

J. C., S. Fiorini, G. Joret, R. Jungers, and J. I. Munro.An efficient algorithm for partial order production.In STOC ’09: 41st ACM Symposium on Theory of Computing,2009.

J. C., S. Fiorini, G. Joret, R. Jungers, and J. I. Munro.Sorting under Partial Information (without the EllipsoidAlgorithm).In STOC ’10: 42nd ACM Symposium on Theory ofComputing, 2010.