Approximate Counting Subhasree Basu Rajiv Ratn Shah Vu Vinh An Kiran Yedugundla School of Computing National University of Singapore 1 School of Computing Agenda • • • • • • Background The Class #P Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent Summary 2 School of Computing Agenda • • • • • • Background The Class #P Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent Summary 3 School of Computing Solving and Counting • Suppose a problem ∏ • We check if I is an YES-instance of ∏ • That usually involves finding the solution to ∏ and checking if I matches it 4 School of Computing Example If we want to find all possible permutations of 3 different items 5 School of Computing Example If we want to find all possible permutations of 3 different items 6 School of Computing Solving and Counting • When we are trying to count, we actually try to find the number of solutions of ∏ where I is a solution • Following the same example, in the counting version we want to know how many such permutations exist 7 School of Computing Approximate Counting • Approximate Counting – involves two terms Approximate and Counting • Counting is getting the number of solutions to a problem • Approximate because we do not have an exact counting formula for a vast class of problems Approximately counting Hamilton paths and cycles in dense graphs Martin Dyer, Alan Frieze, and Mark Jerrum, SIAM Journal on Computing 27 (1998), 12621272. 8 School of Computing Agenda • • • • • • Background The Class #P Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent Summary 9 School of Computing The Class #P • #P is the class of counting problems associated with the NP decision problems • Formally a problem ∏ belongs to the #P if there is a nondeterministic polynomial time Turing Machine that, for any instance I, has a number of accepting computations that is exactly equal to the number of distinct solutions to instance I • ∏ is #P-complete if for any problem ∏’ in #P, ∏’ can be reduced to ∏ by a polynomial time Turing machine. 10 School of Computing Need for Randomization • #P-complete problems can only be solvable in polynomial time only if P=NP • Hence the need for approximate solutions • Randomization is one such technique to find approximate answers to counting problems 11 School of Computing Various Applications for Approximate Counting • • • • • DNF counting problem. Network reliability. Counting the number of Knapsack solutions. Approximating the Permanent. Estimating the volume of a convex body. 12 School of Computing Various Applications for Approximate Counting • • • • • DNF counting problem. Network reliability. Counting the number of Knapsack solutions. Approximating the Permanent. Estimating the volume of a convex body. 13 School of Computing Agenda • • • • • • Background The Class #P Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent Summary 14 School of Computing Polynomial Approximation Scheme • Let #(I) be the number of distinct solutions for instance I of problem ∏ • Let the Approximation algorithm be called A • It takes an input I and outputs and integer A(I) • A(I) is supposed to be close to #(I) 15 School of Computing Polynomial Approximation Scheme DEF 1: A Polynomial Approximation scheme(PAS) for a counting problem is a deterministic algorithm A that takes and input instance I and a real number ε > 0, and in time polynomial in n = |I| produces an output A(I) such that (1- ε) #(I) < A(I) < (1 + ε) #(I) 16 School of Computing Polynomial Approximation Scheme DEF 1: A polynomial Approximation scheme(PAS) for a counting problem is a deterministic algorithm A that takes and input instance I and a real number ε > 0, and in time polynomial in n = |I| produces an ouput A(I) such that (1- ε) #(I) < A(I) < (1 + ε) #(I) DEF 2 :A Fully Polynomial Approximation Scheme (FPAS) is a polynomial approximation scheme whose running time is polynomially bounded in both n and 1/ε. The output A(I) is called an ε-approximation to #(I) 17 School of Computing Polynomial Randomized Approximation Algorithm DEF 3: A Polynomial Randomized Approximation scheme(PRAS) for a counting problem ∏ is a randomized algorithm A that takes an input instance I and a real number ε>0, and in time polynomial in n = |I| produces an output A(I) such that Pr[(1- ε)#(I) ≤ A(I) ≤ (1 + ε)#(I)] ≥ ¾ 18 School of Computing Polynomial Randomized Approximation Algorithm DEF 3: A Polynomial Randomized Approximation scheme(PRAS) for a counting problem ∏ is a randomized algorithm A that takes an input instance I and a real number ε>0, and in time polynomial in n = |I| produces an output A(I) such that Pr[(1- ε)#(I) ≤ A(I) ≤ (1 + ε)#(I)] ≥ 3/4 DEF 4: A Fully Polynomial Randomized Approximation Scheme (FPRAS) is a polynomial randomized approximation scheme whose running time is polynomially bounded in both n and 1/ε. 19 School of Computing An (ε, δ) FPRAS DEF 5: An (ε, δ)-FPRAS for a counting problem ∏ is a fully polynomial randomized approximation scheme that takes an input instance I and computes an ε-approximation to #(I) with probability at least 1- δ in time polynomial in n , 1/ ε and log(1/δ) 20 School of Computing Agenda • • • • • • Background The Class #P Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent Summary 21 School of Computing Monte Carlo Method • It is a wide-range of algorithms under one name • In essence it includes all the techniques that use random numbers to simulate a problem • It owes its name to a casino in the principality of Monte Carlo. • Events in a casino depend heavily on chance of a random event. e.g., ball falling into a particular slot on a roulette wheel, being dealt useful cards from a randomly shuffled deck, or the dice falling the right way 22 School of Computing DNF Counting - Terminologies • F(X1, X2,… Xn) is Boolean formula in DNF – – – – X1, X2,… Xn are Boolean variables. F = C1 ∨ C2… ∨ Cm is a disjunction of clauses Ci = L1 ∧ L2… ∧ Lri is a conjunction of Literals Li is either variable Xk or Xk’ e.g. F = (x1 ∧ x3’) ∨ (x1 ∧ x2’ ∧ x3) ∨ (x2 ∧ x3) 23 School of Computing Terminologies contd … • a = (a1, a2, … an ) is truth assignment • a satisfy F if F(a1, a2, … an ) evaluates to 1 or TRUE • #F is the number of distinct satisfying assignment of F Clearly we have here 0 < #F ≤ 2n 24 School of Computing DNF Counting Problem • The Problem at hand is now to compute the value of #F • It is known to be #P complete (We can reduce #SAT to #P complete) • We will describe an (ε, δ)- FPRAS algorithm for this • The input size for this is at most nm • We have to design a approximation scheme that has a running time polynomial in n, m , 1/ ε and log(1/ δ) 25 School of Computing Some more terminologies • U is a finite set of known size • f: U {0,1} be a Boolean function over U • Define G = {u є U | f(u) =1} as the pre-image of U Assume: we can sample uniformly at random from U We now want to find the size of G i.e., |G| 26 School of Computing Formulation of Our Problem • Let in our formulation U = {0,1}n , the set of all 2n truth assignments • Let f(a) = F(a) for each of aєU • Hence our G is now the set of all satisfying truth assignments for F Our problem thus reduces to finding the size of G 27 School of Computing Monte Carlo method • Choose N independent samples from U, say, u1, u2, ……. ,uN • Use the value of f on these samples to estimate the probability that a random choice will lie in G • Define the random variable Yi = 1 if f(ui) = 1 , Yi = 0 otherwise So Yi is 1 if and only if uiєG • The estimator random variable is Yi Z = |U| N We claim that with high probability Z will be an approximation to |G| N i 1 28 School of Computing An Unsuccessful Attempt (cont.) • Estimator Theorem: Let ρ = |𝐺| , |𝑈| Then Monte Carlo method yields an 𝜖-approximation to |G| with probability at least 1 – δ provided N ≥ 𝜖4ρ ln δ2 2 • Why unsuccessful? – We don’t know the value of ρ – We can solve this by using a successively refined lower bound on ρ to determine the number of samples to be chosen – It has running time of at least N. where N ≥ ρ1 29 School of Computing Agenda • Background • Randomized Approximation Schemes • The DNF Counting Problem – DNF Counting – Compute #F – An Unsuccessful Attempt – The Coverage Algorithm • Approximating the Permanent • Summary 30 School of Computing DNF Counting • • • • • • • Let F = C1∨ C2∨ C3∨ C4 = (x1 ∧ x3’) ∨ (x1 ∧ x2’∧ x3) ∨ (x2 ∧ x3) ∨ (x3’) G be set of all satisfying truth assignment Hi be set of all satisfying truth assignment for Ci H1 = {a5, a7} x1 x2 x3 H2 = {a6} a1 0 0 0 H2 H3 = {a4, a8} a2 0 0 1 H4 H4 = {a1, a3, a5, a7} a3 0 1 0 • H = H1 ∪ H2 ∪ H3 ∪ H4 = {a1, a3, a4, a5, a6, a7, a8} a4 0 1 1 a5 1 0 0 a6 1 0 1 a7 1 1 0 a8 1 1 1 H1 H3 • It is easy to see that |Hi | = 2 n-ri 31 School of Computing DNF Counting a1 a2 . . ai aj . 0 1 , f(a) = F(a) f: V→ {0, 1} . . . a2 n |G| = #F V 32 School of Computing The Coverage Algorithm • Importance Sampling – Want to reduce the size of the sample space – Ratio ρ is relatively large – Ensuring that the set G is still completely represented. – Reformulate the DNF counting problem in a more abstract framework, called the union of sets problem. 33 School of Computing union of sets problem • union of sets problem Let V be a finite Universe. We are given m subsets H1, H2, …, Hm ⊆ V, such that following assumptions are valid: 1. For all i, |Hi| is computable in polynomial time. 2. It is possible to sample uniformly at random from any Hi 3. For all v ∈ V, it can be determined in polynomial time whether v ∈ Hi – The Goal is to estimate the size of the Union H = H1 ∪ H2 ∪ … ∪ Hm – The brute-force approach to compute |H| is inefficient when the universe and the set Hi are of large cardinality – The assumption 1-3 turn out to be sufficient to enable the design of Importance sampling algorithm 34 School of Computing . DNF Counting . . 0, 1 H1 H2 . . . . H.m V 𝐻 = ∪𝑖=1…𝑚 Hi F[v] → {0, 1} 35 School of Computing The Coverage Algorithm • DNF Counting is special case of union of sets – – – – F(X1, X2,… Xn) is Boolean formula in DNF The universe V corresponds to the space of all 2n truth assignment Set Hi contains all the truth assignment that satisfy the clause Ci Easy to sample from Hi by assigning appropriate values to variables appearing in Ciand choosing rest at random – Easy to see that |Hi | = 2 n-ri – Verify in linear timethat some v ∈ V is a member of Hi – Then the union of sets 𝐻 = ∪𝑖=1…𝑚 Hi gives the set of satisfying assignments for F 36 School of Computing The Coverage Algorithm • Solution to union of sets problem. – Define a multiset U = H1 ⊎ H2 … ⊎ Hm – Multiset union contains as many copies of v ∈ V as the number of Hi`sthat contain that v. – U = {(v,i) | (v,i)∈ Hi} – Observe that |U| = 𝑚 𝑖=1 |Hi| ≥ |H| – For all v ∈ H, cov(v) = {(v,i) | (v,i) ∈ U} – In DNF problem, for a truth assignment a, the set cov(a) is the set of clauses satisfied by a v1 v2 v3 v4 … … vs H1 1 0 1 0 … … 0 H2 1 1 0 0 … … 1 … … .. … … … … … Hm 0 0 1 1 … 37 … 1 School of Computing The Coverage Algorithm • The following observations are immediate – – – – The number of coverage set is exactly |H| U =∪𝑣 ∈𝐻 COV(v) |U| = 𝑣 ∈𝐻 |𝐶𝑂𝑉(𝑣)| For all v ∈ H, |COV(v)| ≤ m H1 H2 H3 . . . Hm v1 v2 v3 * x 0 . . . x * 0 x . . . 0 0 * 0 . . . 0 … vs … … … 0 0 * . . . . . . … x – Define function f((v, i)) = {1 if i = min{ j |v ∈Hj}; 0 otherwise} – Define set G = {(v, i) ∈ U | f((v, i)) = 1} – |G| = |H| 38 School of Computing The Coverage Algorithm • Algorithm – for j = 1 to N do • pick (v, i) uniformly at random from U • Set Yj =1 if f((v, i)) = 1 ; else 0 // if((v, i)) = 1, call it special pair – Output(𝑁1 – E[Yj] = 𝜇= 𝑁 𝑗=1 Yj).|U| = Y .|U| 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑠𝑝𝑒𝑐𝑖𝑎𝑙 𝑝𝑎𝑖𝑟𝑠 |𝑈| = |∪𝑖=1…𝑚 Hi| |𝑈| = |𝐻| |𝑈| – So the algorithm is an unbiased estimator for |∪𝑖=1…𝑚 Hi| as desired R.M. Karp and M. Luby, “Monte-carlo algorithms for enumeration and reliability problems,” In Proceedings of the 15th Annual ACM Symposium on Theory of Computing, 1983, pp. 56–64. 39 School of Computing Analysis • The Value of N: – E[Yj] = µ ≥ 𝑠 𝑚𝑠 = 1 𝑚 – By Estimator Theorem N = 4 ϵ 2μ ≤ 4𝑚 𝜖2 = # trials v1 v2 v3 H1 H2 H3 * x * . . . . . . x • Complexity – – – – Computing |U| requires O(nm) Checking (v, i) is special requires O(nm) Generating a random pair requires O(n+m) Total running time per trial = O(nm) – Total running time = 𝑛𝑚2 O( 2 ) 𝜖 Hm * . . . … vs … … x … * . . . . . . . . . … x Karp, R., Luby, M., Madras, N., “Monte-Carlo Approximation Algorithms for Enumeration Problems", J. 𝑛𝑚 of Algorithms, Vol. 10, No. 3, Sept. 1989, pp. 429-448. improved the running time to O( 2 ) 𝜖 40 School of Computing (𝜖, δ)-FPRAS for DNF Counting • Our Goal is to estimate the size of G ⊆ U such that G = f-1(1) – Apply Estimator Theorem based on naïve Monte Carlo sampling technique We claim that the naïve Monte Carlo sampling algorithm gives an (𝝐, δ)-FPRAS for estimating the size of G. Lemma: In the union of sets problem ρ = |𝐺| |𝑈| ≥ 1 𝑚 Proof: relies on the observations made above • |U| = 𝑣 ∈𝐻 |𝐶𝑂𝑉(𝑣)| ≤ 𝑣 ∈𝐻 41 𝑚 ≤ m|H| = m|G| School of Computing The Coverage Algorithm • The Monte Carlo Sampling technique gives as (𝜖, δ)-FPRAS for |G|, hence also for |H| Estimator Theorem:The Monte Carlo method yields an 𝜖approximation to |G| with probability at least 1 - δ provided 2 N ≥ 4𝑚 ln 𝜖 δ 2 The running time is polynomial in N Proof: We need to show: (1) fcan be calculated in polynomial time (2) It is possible to sample uniformly from U. 42 School of Computing The Coverage Algorithm Proof(1): Compute f((v,i)) in O(mn) by checking whether truth assignment v satisfies Ci but none of the clauses Cj for j <i. Proof(2): It is possible to sample uniformly from U. Sampling an element (v,i) uniformly from U: I. choose is.t. 1 ≤ i ≤ m and Pr[i] = |𝐻𝑖| |𝑈| = |𝐻𝑖| 𝑚 |𝐻 | 𝑖=1 𝑖 = 2𝑛 _ 𝑘𝑖 𝑚 2𝑛 _ 𝑘𝑖 𝑖=1 II. Set the Variables in Hi so that Hi is satisfied III. choose a truth assignment for the remaining variables uniformly at random IV. output iand the resulting truth assignment v 43 School of Computing Agenda • • • • Background Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent – Number of perfect matchings in bipartite graph – Near-uniform generation – The canonical path argument • Summary 44 School of Computing Matrix Permanent • The permanent of a square matrix in linear algebra is a function of the matrix similar to the determinant. The permanent, as well as the determinant, is a polynomial in the entries of the matrix. • Permanent formula: Let 𝑄 = (𝑄𝑖𝑗 ) be an 𝑛 × 𝑛 matrix, the permanent of the matrix is defined as: 𝑛 𝑝𝑒𝑟 𝑄 = 𝑄𝑖,𝜋𝑖 𝜋∈𝑆𝑛 𝑖=1 Where 𝑆𝑛 𝑖𝑠 𝑡ℎ𝑒 𝑠𝑦𝑚𝑚𝑒𝑡𝑟𝑖𝑐 𝑔𝑟𝑜𝑢𝑝 𝑜𝑓 𝑝𝑒𝑟𝑚𝑢𝑡𝑎𝑡𝑖𝑜𝑛𝑠 𝑜𝑓 𝑠𝑖𝑧𝑒 𝑛 • Example: 𝑝𝑒𝑟 𝑎 𝑐 𝑏 = 𝑎𝑑 + 𝑏𝑐 𝑑 • Best running time: Ο(𝑛2𝑛 ) A Z Broder. 1986. How hard is it to marry at random? (On the approximation of the permanent). In Proceedings of the eighteenth annual ACM symposium on Theory of computing (STOC '86). ACM, New York, NY, USA, 50-58. DOI=10.1145/12130.12136 45 School of Computing Agenda • • • • Background Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent – Number of perfect matchings in bipartite graph – Near-uniform generation – The canonical path argument • Summary 46 School of Computing Bipartite Graph • Definition: a bipartite graph is a set of graph vertices decomposed into two disjoint sets such that no two graph vertices within the same set are adjacent. • Notations: G(U, V, E) where: – 𝑈 = 𝑢1 , … , 𝑢𝑛 𝑎𝑛𝑑 𝑉 = {𝑣1 , … , 𝑣𝑛 } are disjoint sets of vertices in which n is number of vertices in each set – E is set of graph edges • Bipartite graph G could be represented in 0-1 matrix A(G) as following: U1 V1 V1 U1 U2 V2 U2 47 V2 1 1 1 0 School of Computing Graph Perfect Matchings • A matching is a collection of edges 𝑀 ⊆ 𝐸 such that vertex occurs at most once in M • A perfect matching is a matching of size n U1 V1 U1 V1 U2 V2 U2 V2 Rajeev Motwani and Prabhakar Raghavan. 1995. Randomized Algorithms. Cambridge University Press, New York, NY, USA. Chapter 11. 48 School of Computing Graph Perfect Matchings • Let #(𝐺) denote the number of perfect matchings in the bipartite graph G: #(𝐺) = 𝑝𝑒𝑟(𝐴 𝐺 ) • Computing the number of perfect matchings in a given bipartite graph is #P-complete computing permanent of 0-1 matrix is also #P-complete • Propose a 𝜖, 𝛿 − 𝐹𝑃𝑅𝐴𝑆 for counting number of perfect matchings problem U1 V1 V1 U1 U2 U2 V2 #(𝐺) = 1 𝑝𝑒𝑟 𝐴 𝐺 49 V2 1 1 1 0 = 1×0 + 1×1 = 1 School of Computing Introduction to Monte Carlo Method • A method which solves a problem by generating suitable random numbers and observing that fraction of the numbers obeying some properties • Monte Carlo methods tend to follow a particular pattern: – Define a domain of possible inputs. – Generate inputs randomly from a probability distribution over the domain. – Perform a deterministic computation on the inputs. – Aggregate the results. 50 School of Computing Estimator Theorem • Estimator Theorem: Let ρ = |𝐺| , |𝑈| Then Monte Carlo method yields an 𝜖-approximation to |G| with probability at least 1 – δ provided 4 2 𝑁 ≥ 2 ln 𝜖 𝜌 𝛿 where N ≥ 1 ρ 51 School of Computing Agenda • • • • Background Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent – Number of perfect matchings in bipartite graph – Near-uniform generation – The canonical path argument • Summary 52 School of Computing Uniform Generation • Let 𝑀𝑘 denote the set of distinct matchings of size k in G and 𝑚𝑘 = 𝑀𝑘 • A uniform generator for 𝑀𝑘 is a randomized polynomial time algorithm 𝑈𝑘 that: – Takes G as input – Returns a matching 𝑚 ∈ 𝑀𝑘 such that m is uniformly distributed over 𝑀𝑘 53 School of Computing Near-uniform generation for 𝑀𝑘 • Definition: Given a sample space omega, a generator 𝑈 is said to be a near-uniform generator for Ω with error 𝜌 if, for all 𝜔 ∈ Ω: Pr 𝑈 = 𝜔 − 1/|Ω| ≤𝜌 1/|Ω| • A near-uniform generation for 𝑀𝑘 ∪ 𝑀𝑘−1 is the one in which the sample space is 𝑀𝑘 ∪ 𝑀𝑘−1 54 School of Computing Near-uniform generation 𝑈𝑘 for 𝑀𝑘 ∪ 𝑀𝑘−1 • Rationale: – Use 𝑈𝑘 and Monte Carlo method to estimate ratios 𝑟𝑘 = 𝑚𝑘 /𝑚𝑘−1 (estimator theorem) – 𝑟1 = 𝑚1 = 𝑛𝑜. 𝑜𝑓 𝑒𝑑𝑔𝑒𝑠 𝑖𝑛 𝑡ℎ𝑒 𝑖𝑛𝑝𝑢𝑡 𝑔𝑟𝑎𝑝ℎ 𝑚𝑛 𝑚𝑛−1 𝑚2 𝑚𝑛 = × × ⋯× × 𝑚1 = 𝑚𝑛−1 𝑚𝑛−2 𝑚1 𝑛 𝑟𝑘 𝑘=1 1 – For bipartite graph G, try to find 𝑈𝑘 with error 𝜌 ≤ 4 and running 𝑛 time polynomially bounded in n 55 School of Computing Design 𝑈𝑘 • Devise Markov chain 𝐶𝑘 , each state is one element of 𝑀𝑘 ∪ 𝑀𝑘−1 • Simulate 𝐶𝑘 by executing a random walk on the underlying graph of 𝐶𝑘 . Each vertex in the graph is one element of 𝑀𝑘 ∪ 𝑀𝑘−1 • After 𝜏 steps (𝜏 is not too large), 𝐶𝑘 will approach its stationary distribution. The stationary probability of 1 each state is equal to 𝑀𝑘 ∪𝑀𝑘−1 56 School of Computing Structure of 𝐶𝑛 • Underlying graph: – Nodes: element of 𝑀𝑛 ∪ 𝑀𝑛−1 – Edges: let E denote the set of edges in G. In any state m of 𝐶𝑛 , with probability ½, remain at the state and do nothing. Otherwise, choose an edge e=(u,v): • Reduce: If 𝑚 ∈ 𝑀𝑛 and 𝑒 ∈ 𝑚, move to state m’=m-e • Augment: If 𝑚 ∈ 𝑀𝑛−1 , with u and v unmatched in m, move to m’=m+e • Rotate: If 𝑚 ∈ 𝑀𝑛−1 , with u matched to w and v unmatched, move to m’=(m+e)-f where f=(u,w) • Reduce Augmen t Rotate Idle: otherwise, stay at current place 57 School of Computing 𝐶2 for 𝐺 = 𝐾22 58 School of Computing Properties of 𝐶𝑛 • Each transition has an associated probability 1 of 2|𝐸| • If a transition exists from m to m’ then the reverse transition also exists and has the same probability Approximating the Permanent Mark Jerrum and Alistair Sinclair, SIAM Journal on Computing 18 (1989), 1149-1178. . 59 School of Computing 𝐶𝑛 Transition Probability Matrix • 𝜋: the stationary distribution of 𝐶𝑛 • 𝑋𝑡 : the state of 𝐶𝑛 after t steps of simulation with 𝑋0 is the beginning state • 𝑝𝑖𝑗 : the probability of transition i j then: (𝑡) 1 𝑝𝑖𝑗 = 2𝐸 1 𝑝𝑖𝑖 ≥ 2 • 𝑝𝑖𝑗 • 𝑃 = 𝑝𝑖𝑗 : transition probability matrix • 𝑃𝑡 = [𝑝𝑖𝑗 Conditional probability that 𝑋𝑡 = 𝑗 given that 𝑋0 = 𝑖 𝑡 ] 60 School of Computing Prove 𝜖, 𝛿 − 𝐹𝑃𝑅𝐴𝑆 𝑜𝑓 𝑈𝑘 • Proof sketch: – Prove the stationary distribution of 𝐶𝑛 is a uniform distribution after finite steps – The approximated stationary distribution does not depend on the starting state when number of simulation steps is polynomially bounded in n and 1 the error is less than 4 𝑛 61 School of Computing Uniform stationary distribution of 𝐶𝑛 • The underlying graph of 𝐶𝑛 : – Irreducible: we can go from any matching in a graph to any other matching – Aperiodic: self-loop probabilities are positive 𝐶𝑛 is ergodic Any finite, ergodic Markov Chain converges to a unique stationary distribution after finite steps • Transition probability matrix P: – Symmetric, doubly stochastic: each of rows and columns sum to 1 The stationary distribution of 𝐶𝑛 must be the uniform distribution on its states 62 School of Computing Approximated stationary distribution • Relative point-wise distance: 𝑝𝑖𝑗 (𝑡) − 𝜋𝑗 ∆ 𝑡 = 𝑚𝑎𝑥 𝜋𝑗 • Need to prove that ∆(𝜏) reduces below polynomial in n 63 1 𝑛4 for 𝜏 School of Computing Proof ∆ 𝑡 < 1 𝑛4 • 𝜆1 > 𝜆2 ≥ ⋯ 𝜆𝑛 are eigenvalues of P • 𝑁 = 𝑀𝑛 ∪ 𝑀𝑛−1 is number of states in 𝐶𝑛 ln 𝑁 = Ο(𝑛2 ) • By theorem 6.21: ∆(𝑡) ≤ 𝑛15 (𝜆2 )𝑡 • By Proposition B.3: 𝜆2 ≤ 𝑒 − • Choose t = 𝜏 = (4 ln 𝑛)(ln 𝑁) 1−𝜆2 15 ∆(𝑡) ≤ 𝑛 × 1−𝜆2 then when 𝑛 > 2: (4 ln 𝑛)(ln 𝑁) 1−𝜆2 (𝑒 − 1−𝜆2 ) 64 1 ≤ 4 𝑛 School of Computing Proof 𝜏 is polynomially bounded in n • 𝑤𝑖𝑗 = 𝜋𝑖 𝑝𝑖𝑗 the stationary probability of transition i j 𝑤𝑖𝑗 = 𝑤𝑗𝑖 • Let S be a subset of the set of states of 𝐶𝑛 such that: ∅ ⊂ 𝑆 ⊂ 𝑀𝑛 ⋃𝑀𝑛−1 and 𝑆 is its complement: – Capacity of S: ∁𝑆 = 𝑖∈𝑆 𝜋𝑖 – Ergodic flow out of S: 𝐹𝑠 = 𝑖∈𝑆,𝑗∈𝑆 𝑤𝑖𝑗 – Conductance of S: Φ𝑆 = 𝐹𝑆 /∁𝑆 65 School of Computing Proof 𝜏 is polynomially bounded in n • From theorems 6.16, 6.17 and 6.19: Φ2 𝜆2 ≤ 1 − 2 1 1−𝜆2 ≤ 2 Φ2 • By Canonical path argument: Φ ≥ 1 12𝑛6 1 1−𝜆2 is polynomially upper-bounded in n 𝜏 = (4 ln 𝑛)(ln 𝑁) 1−𝜆2 is also polynomially upper-bounded in n 66 School of Computing Agenda • • • • Background Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent – Approximating the number of perfect matchings in bipartite graph – The canonical path argument • Summary 67 School of Computing Conductance • Let S be a subset of the set of states of 𝐶𝑛 such that: ∅ ⊂ 𝑆 ⊂ 𝑀𝑛 ⋃𝑀𝑛−1 and 𝑆 is its complement: – Capacity of S: ∁𝑆 = 𝑖∈𝑆 𝜋𝑖 – Ergodic flow out of S: 𝐹𝑠 = 𝑖∈𝑆,𝑗∈𝑆 𝑤𝑖𝑗 – Conductance of S: Φ𝑆 = 𝐹𝑆 /∁𝑆 – Conductance of Markov chain with state space 𝑄, is defined as Φ= min ∅⊂𝑆⊂𝑄,∁𝑆 ≤1/2 Φ𝑆 S 68 𝑆 School of Computing Canonical path For every pair of states 𝑋, 𝑌 ∈ 𝑄 define a path 𝑋, 𝑌 = 𝑋 = 𝑃0, 𝑃1, 𝑃2, , … , 𝑃𝑚, = 𝑌 where the probability of going from 𝑃𝑖 to 𝑃𝑖+1 is nonzero. 69 School of Computing Canonical path Symmetric difference XY • This consists of a disjoint collection of paths in H (some of which may be closed cycles), each of which has edges that belong alternately to X and to Y. • Fix some arbitrary ordering on all simple paths in H, and designated in each of them a so-called “start vertex”, which is arbitrary if the path is a closed cycle but must be an endpoint otherwise. • This ordering induces a unique ordering P1, P2, . . . , Pm on the paths appearing in XY. • The canonical path from X to Y involves “unwinding” each of the Pi 70 School of Computing Canonical path • There are two cases to consider: – Pi is not a cycle • If Pi starts with a X-edge, remove it (↓-transition -reduce) • Perform a sequence of ↔-transitions (removes X-edge, inserts Y-edge - Rotate) • If Pi’s length is odd (we remain with one Y-edge), insert it (↑-transition - Augment) – Pi is a cycle • Let Pi=(v0,v1,. . .,v2l+1) – V0 is the start vertex, , • Remove (v0,v1) – an X-edge (↓-transition-reduce) • We are left with a path with endpoints v0, v1, one of which must be the start vertex v 2j , v2 j 1 X v 2 j 1 , v2 j 2 Y • Continue as above, but: – If v0 is the start vertex, use v1 as the start vertex – If v1 is the start vertex, use v0 as the start vertex – (This trick serves to distinguish paths from cycles) 71 School of Computing Unwinding a path X Y X ↔-transition ↓-transition X Y X X 72 School of Computing X Unwinding a cycle Y Y X X Y Y X X ↓-transition X X ↔-transition X X X Y X X X ↔-transition ↑-transition Y Y Y Y X Y Y Y 73 Y Y School of Computing Example X: Y: XY: 74 School of Computing Canonical path Argument Theorem: For the Markov chain 𝐶𝑛 , Conductance Φ ≥ 1/12𝑛6 Proof: Let H be the graph underlying 𝐶𝑛 The transition probabilities along all the oriented edges of H are exactly 1/(2 𝐸 ) where E is the set of edges in G. We can show that, 1 for any subset S of the vertices of H with capacity ∁𝑆 ≤ , the 2 number of edges between 𝑆 and 𝑆 is large. 75 School of Computing Canonical path Argument A Canonical path between every pair of vertices of H, such that no oriented edge of H occurs in more than bN of these paths. For a subset S of the vertices of H, the number of such canonical paths crossing the cut from S to 𝑆 is 𝑆 𝑁 − 𝑆 ≥ |𝑆|𝑁/2 we assume |𝑆| ≤ 𝑁/2 76 School of Computing Canonical path Argument Since at most bN edges pass through each of the edges between S and 𝑆 , the number of such edges must be at least |S|/2b, so that the conductance of Cn is at least 1/(4𝑏|𝐸|) ≥ 1/(4𝑏𝑛2 ) Now we have to prove b = 3𝑛4 to get the desired lower bound for conductance 77 School of Computing Canonical path Argument Let m be any matching in Mn Define k(m) – set of all nodes 𝑠 ∈ 𝑀𝑛 ∪ 𝑀𝑛−1 such that 𝑠 = 𝑚 𝑎𝑛𝑑 𝑠 ≠ 𝑚 Lemma: For any m ∈ 𝑀𝑛 , 𝑘 𝑚 < 𝑛2 The only perfect matching that chooses m as its partner is m itself. It requires n Reduce operations to reach any near near perfect matching adjacent to m. The number of near perfect matchings at distance exactly 2 from m is at most n(n-1). Thus, there are at most n+n(n-1) different near perfect matchings within distance of two of m. 78 School of Computing Canonical path Argument • Associate a unique node 𝑠 ∈ 𝑀𝑛 with every node s ∈ 𝑀𝑛−1 ∪ 𝑀𝑛 • Choose a canonical path between s and 𝑠, If s is in 𝑀𝑛 , then we set s = 𝑠. • Canonical paths between nodes s, 𝑡 ∈ 𝑀𝑛−1 ∪ 𝑀𝑛 consists of three consecutive segments, s to 𝑠, 𝑠 to 𝑡 and 𝑡 to t . • Two types of Segments in paths: Type A : paths between a node s ∈ 𝑀𝑛−1 ∪ 𝑀𝑛 and its partners 𝑠 ∈ 𝑀𝑛 Type B : paths between pairs of nodes in 𝑀𝑛 79 School of Computing 𝐶2 for 𝐺 = 𝐾22 80 School of Computing Canonical path argument Lemma: Any transition T in H lies on at most 3𝑛4 N distinct canonical paths. Fix a transaction T=(u,v) in H Total number of type A segments canonical paths that T has is bounded by (k(v)+k(u))N < 2𝑛2 N Type B segments is atmost 𝑛2 × 𝑛𝑜. 𝑜𝑓 𝑝𝑒𝑓𝑒𝑐𝑡𝑚𝑎𝑡𝑐ℎ𝑖𝑛𝑔𝑠 𝑤𝑖𝑡ℎ 𝑇 × 𝑛2 = 𝑛2 × N × 𝑛2 = 𝑛4 𝑁 Total paths with T is bounded by 3 𝑛4 N 81 School of Computing Summary • • • • Background Randomized Approximation Schemes The DNF Counting Problem Approximating the Permanent – Approximating the number of perfect matchings in bipartite graph – The canonical path argument 82 School of Computing