Skip to Content

1. Time-saving

2019-01-16·Advanced Algorithm

Problems

  • Min-Cut ∈P\in\text{P}
  • Max-Cut ∈NPH\in\text{NPH}
  • Polynomial Identity Testing (univariate) ∈\inco-NPH\text{NPH}
    • Input: a polynomial f∈F[x]f\in\mathbb{F}[x] of degree dd
    • Determine whether f≡0f\equiv0
  • PIT:
    • Input: two nn-variate polynomials f,g∈F[x1,x2,⋯ ,xn]f,g\in\mathbb{F}[x_1,x_2,\cdots,x_n] of degree dd
    • Determine: f≡gf\equiv g
  • Set Cover ∈NPH\in\text{NPH}:
    • Input: mm subsets S1,⋯ ,Sm⊆US_1,\cdots,S_m\subseteq U of a universe of size nn
    • Output: C⊆{1,2,⋯ ,m}C\subseteq\{1,2,\cdots, m\} such that U=⋃i∈CSiU=\bigcup_{i\in C}S_i
    • freq(x)=∣{i∣x∈Si}∣\text{freq}(x)=|\{i|x\in S_i\}|
  • Hitting Set Problem ∈NPH\in\text{NPH}
    • Input: nn subsets S1,⋯ ,Sm⊆US_1,\cdots,S_m\subseteq U of a universe of size mm
    • Output C⊆UC\subseteq U that CC intersects with every set SiS_i
    • freq(x)=∣Si∣\text{freq}(x)=|S_i|
    • equivalent to Set Cover
  • Vertex Cover Problem ∈NPH\in\text{NPH}
    • Input: an undirect graph G(V,E)G(V,E)
    • Output: the smallest C⊆VC\subseteq V such that ∀e∈E\forall e\in E is incident to at least one vertex in CC
    • set cover with frequency 22
  • Minimum Makespan on Identical Parallel Machine ∈NPH\in\text{NPH}
    • Input: nn positive integers p1,p2,⋯ ,pnp_1,p_2,\cdots,p_n nad a positive integer mm
    • Output: an assignment σ:[n]→[m]\sigma:[n]\rightarrow[m] which minimizes Cmax⁡=max⁡i∈[m]∑j:i=σ(j)pjC_{\max}=\max_{i\in [m]}\sum_{j:i=\sigma(j)}p_j
  • Partition Problem ∈NPH\in\text{NPH}
    • Input: S={x1,⋯ ,xn}S=\{x_1,\cdots,x_n\}
    • Output: Whether there is a partition of SS into AA and BB such that ∑x∈Ax=∑x∈Bx\sum_{x\in A}x=\sum_{x\in B}x
  • 算法设计
    • P\text{P}: Randomize to accelerate
    • NPH\text{NPH}
      • sampling: random approximation
      • greedy/local search: approximation

Min-Cut

Deterministic Algorithm

  • Max-flow min-cut Theory: (∣V∣−1)×(|V|-1)\times max-flow time
  • Stoer–Wagner Algorithm(multi-graphs): O(EV+V2log⁡V)O(EV+V^2\log V)
  • Ken-ichi Kawarabayashi and Mikkel Thorup(simple graph, STOC 2015): near-linear time complexity

Karger's Contraction Algorithm

  • Contraction: merge two vertices into a new vertex
  • Karger's Algorithm(1993): ZPP\text{ZPP}
    • Running time: O(V2)O(V^2)
    • Pc=2V(V−1)P_c=\frac{2}{V(V-1)}
    • w.h.p: O(V2log⁡V)O(V^2\log V) times
RandomContract(G){
  while V>2
    e = choose(E)
    contract(G,e)
  return remaining edges
}
  • Analysis Details
    • Lemma: E≥VC2E\geq\frac{VC}{2}, min-cut CC
    • pi=1−CEi≥1−2Vip_i=1-\frac{C}{E_i}\geq 1-\frac{2}{V_i}
    • pcorrect≥PC=∏i=1n−2P(ei∉C∣∀j<i,ej∉C)≥∏i=1n−2(1−2n−i+1)=∏i=3ni−2i=2n(n−1)p_{\text{correct}}\geq P_C=\prod_{i=1}^{n-2}P(e_i\not\in C|\forall j<i,e_j\not\in C)\geq \prod_{i=1}^{n-2}(1-\frac{2}{n-i+1})=\prod_{i=3}^{n}\frac{i-2}{i}=\frac{2}{n(n-1)}

Fast Min-Cut Algorithm

  • Karger's Algorithm improved by recursion(1996)
    • Running time: O(V2log⁡V)O(V^2\log V)
    • Pc=Ω(1log⁡V)P_c=\Omega(\frac{1}{\log V})
    • w.h.p: run O(log⁡2V)O(\log^2V) times
FastCut(G){
  if (V<=6) return brute_force(V)
  else {
    t = ceil(1+V/sqrt(2))
    G1 = RandomContract(G,t)
    G2 = RandomContract(G,t)
    return min(FastCut(G1), FastCut(G2))
  }
}
  • Analysis Details
    • RandomContract(G,t): Psurvive=t(t−1)n(n−1)P_{\text{survive}}=\frac{t(t-1)}{n(n-1)}
      • t=⌈1+n2⌉,P≥12t=\lceil 1+\frac{n}{\sqrt{2}}\rceil,P\geq \frac{1}{2}
    • Pcorrect≥1−(1−12p(⌈1+n2⌉))2P_{\text{correct}}\geq 1-(1-\frac{1}{2}p(\lceil 1+\frac{n}{\sqrt{2}}\rceil))^2
    • T(n)=2T(⌈1+n2⌉)+O(n2)T(n)=2T(\lceil 1+\frac{n}{\sqrt{2}}\rceil)+O(n^2)
      • T(n)=O(n2log⁡2n)T(n)=O(n^2\log_2n)

Max-Cut

Greedy Heuristics

0.5-approximation algorithm

GreedyMaxCut(V,E){
  S=T=emptyset
  for i=1,2,...,n (random order)
    vi joins one of S,T to maximize the current E(S,T)
}
  • Analysis Details
    • ∣E∣=∑i=1n(∣E(Si,{vi})∣+∣E(Ti,{vi})∣)|E|=\sum_{i=1}^n(|E(S_i,\{v_i\})|+|E(T_i,\{v_i\})|)
    • SOLG=∑i=1nmax⁡(∣E(Si,{vi})∣,∣E(Ti,{vi})∣)≥12E≥12_G=\sum_{i=1}^n\max(|E(S_i,\{v_i\})|,|E(T_i,\{v_i\})|)\geq\frac{1}{2}E\geq\frac{1}{2}OPTG_G
  • best known approximation ratio α∗≈0.878\alpha^*\approx 0.878 (best if assuming unique game conjecture)

Derandomization from Average Case

  • Randomized Algorithm: uniform and independent random bit Xv∈{0,1}X_v\in\{0,1\}
    • E(∣E(S,T)∣)=∑uv∈EE(I(Xu≠Xv))=∑uv∈EP(Xu≠Xv)=∣E∣2≥OPTG2\mathbb{E}(|E(S,T)|)=\sum_{uv\in E}\mathbb{E}(I(X_u\not=X_v))=\sum_{uv\in E}P(X_u\not= X_v)=\frac{|E|}{2}\geq\frac{\text{OPT}_G}{2}
    • Probablistic method: ∃≥OPTG2\exists \geq\frac{\text{OPT}_G}{2}
    • solution space: O(2n)O(2^n)
  • Derandomization by Monotone Path: OPTG2≤E(E(S,T))≤⋯≤E(E(S,T)∣Xv1=x1,⋯ ,Xvi−1)≤⋯\frac{\text{OPT}_G}{2}\leq\mathbb{E}(E(S,T))\leq\cdots\leq\mathbb{E}(E(S,T)|X_{v_1}=x_1,\cdots,X_{v_{i-1}})\leq\cdots
    • This choice is equivalent to Greedy Heuristic one
MonotonePath(V,E){
  S=T=emptyset
  for i=1,2,...,n (random order)
    vi joins one of S,T to maximize the average size of cut conditioning on the choices made so far by the vertice
}

Derandomization by pairwise independence

  • generate nn pairwise independent variables from log⁡n\log n mutually independent variables
    • Let XiX_i be mutually indpendent uniform random bits
    • Si⊆2[k]S_i\subseteq 2^{[k]} be nonempty sets
    • Yi=⊕j∈SiXjY_i=\oplus_{j\in S_i}X_j, 2k−12^k-1 pairwise independent varibles YiY_i
  • Randomized Algorithm: XvX_v only need to be pairwise independent
    • solution space: O(n2)O(n^2)
    • exhaustive search
k = log(n)
for Y=0:2**k:
  X=generatePairwise(Y)
  t=assignVertexAccordingTo(X)
  ans = max(ans, t)

Coupling

  • Process G1G_1 and G2G_2 share same randomness
  • stochastic dominance: partial orders of random variable
    • Statewise dominance: A≥B,∃A>BA\geq B,\exists A>B
    • first-order stochastic dominance (FSD): P(A≥x)≥P(B≥x),∃xP(A≥x)>P(B≥x)P(A\geq x)\geq P(B\geq x),\exists xP(A\geq x)>P(B\geq x)

Polynomial Identity Testing

  • Naive Randomized Algorithm for Univariate: co-RP\text{RP}
    • pick r∈Sr\in S and check f(r)=0f(r)=0
    • false posivitve: f≢0,P(f(r)=0))≤d∣S∣f\not\equiv 0,P(f(r)=0))\leq\frac{d}{|S|}
  • multivariate polymonials
    • f(x1,⋯ ,xn)=∑∑jij≤dai1,⋯ ,inx1i1⋯xninf(x_1,\cdots,x_n)=\sum_{\sum_{j}i_j\leq d}a_{i_1,\cdots,i_n}x_1^{i_1}\cdots x_n^{i_n}
    • total degree: i1+⋯+ini_1+\cdots+i_n
    • sum of monomials: # of coefficients (n+dd)≤(n+d)d{n+d\choose d}\leq (n+d)^d
    • product form: expend is expensive but evaluate is efficient
  • Randomized Algorithm
    • S⊆FS\subseteq\mathbb{F}
    • pick r1,⋯ ,rn∈Sr_1,\cdots,r_n\in S uniformly and independently at random
    • check f(r‾)=0f(\overline{r})=0
  • Schwatz-Zippel Theorem: finte ∀S⊂F,r1,r2,⋯ ,rn∈S\forall S\subset\mathbb{F},r_1,r_2,\cdots,r_n\in S choosed uniformly and independently at random, P(f(r1,r2,⋯ ,rn)=0)≤d∣S∣P(f(r_1,r_2,\cdots,r_n)=0)\leq\frac{d}{|S|}

Set cover

  • There is no poly-time algorithm with approximation ratio better than (1−o(1))ln⁡n(1-o(1))\ln n assuming that NP≠P\text{NP}\neq \text{P} (2014)

Greedy Algorithm

  • Algorithm
    • Initially C=∅C=\emptyset
    • while U≠∅U\not=\emptyset do
      • C=C∪arg⁡max⁡i∣Si∩U∣C=C\cup\arg\max_i|S_i\cap U|
      • U=U\SiU = U\backslash S_i
  • approximation ratio Hn≈ln⁡nH_n\approx\ln n
  • Vertex cover problem
    • 22-approximation
    • (2008) no poly-time algorithm with approximation ratio 2−ϵ2-\epsilon assuming UGC

Primal-Dual Algorithm

  • (Dual Problem) Matching: M⊆UM\subseteq U that ∀i,∣Si∩M∣≤1\forall i,|S_i\cap M|\leq 1
  • Find a maimal MM, return C={i:Si∩M≠∅}C=\{i:S_i\cap M\not=\emptyset\}
  • max⁡freq(x)\max\text{freq}(x)-approximation algorithm

Scheduling

Graham's List algorithm

  • List Algorithm
    • for j=1,2,⋯ ,nj = 1,2,\cdots,n: assign job jj to the machine that currently has the smallest load
  • Approximation ratio: 2−1m2-\frac{1}{m}
  • start with a feasible solution, improve at each step by modifying locally
  • start with an arbitrary schedule of nn jobs to mm machines
    • while (true)
      • let ℓ\ell denote the job finished at last in the current schedule;
      • if there is machine ii such that job ℓ\ell can finish earlier if transferred to machine ii
        • job ℓ\ell transfers to machine ii
      • else break;
  • Approximation ratio: 2−1m2-\frac{1}{m}

Longest Processing Time (LPT)

  • Algorithm
    • sort pip_i in non-increasing order
    • assign job jj to the machine currently has the smallest load
  • Approximation: 43\frac{4}{3}
  • competitive ratio: ∀\forall input sequence II, SOLI≤αOPTI,OPTI\text{SOL}_I\leq\alpha\text{OPT}_I,\text{OPT}_I is the solution returned by optimal oofline algorithm