Skip to Content
Advanced Algorithm

1. Time-saving

2019-01-16Original-language archivelegacy assets may be incomplete

Problems

  • Min-Cut P\in\text{P}
  • Max-Cut NPH\in\text{NPH}
  • Polynomial Identity Testing (univariate) \inco-NPH\text{NPH}
    • Input: a polynomial fF[x]f\in\mathbb{F}[x] of degree dd
    • Determine whether f0f\equiv0
  • PIT:
    • Input: two nn-variate polynomials f,gF[x1,x2,,xn]f,g\in\mathbb{F}[x_1,x_2,\cdots,x_n] of degree dd
    • Determine: fgf\equiv g
  • Set Cover NPH\in\text{NPH}:
    • Input: mm subsets S1,,SmUS_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=iCSiU=\bigcup_{i\in C}S_i
    • freq(x)={ixSi}\text{freq}(x)=|\{i|x\in S_i\}|
  • Hitting Set Problem NPH\in\text{NPH}
    • Input: nn subsets S1,,SmUS_1,\cdots,S_m\subseteq U of a universe of size mm
    • Output CUC\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 CVC\subseteq V such that eE\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=maxi[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 xAx=xBx\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: (V1)×(|V|-1)\times max-flow time
  • Stoer–Wagner Algorithm(multi-graphs): O(EV+V2logV)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(V1)P_c=\frac{2}{V(V-1)}
    • w.h.p: O(V2logV)O(V^2\log V) times
RandomContract(G){
  while V>2
    e = choose(E)
    contract(G,e)
  return remaining edges
}
  • Analysis Details
    • Lemma: EVC2E\geq\frac{VC}{2}, min-cut CC
    • pi=1CEi12Vip_i=1-\frac{C}{E_i}\geq 1-\frac{2}{V_i}
    • pcorrectPC=i=1n2P(ei∉Cj<i,ej∉C)i=1n2(12ni+1)=i=3ni2i=2n(n1)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(V2logV)O(V^2\log V)
    • Pc=Ω(1logV)P_c=\Omega(\frac{1}{\log V})
    • w.h.p: run O(log2V)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(t1)n(n1)P_{\text{survive}}=\frac{t(t-1)}{n(n-1)}
      • t=1+n2,P12t=\lceil 1+\frac{n}{\sqrt{2}}\rceil,P\geq \frac{1}{2}
    • Pcorrect1(112p(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(n2log2n)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}))12E12_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))=uvEE(I(XuXv))=uvEP(XuXv)=E2OPTG2\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: OPTG2E(E(S,T))E(E(S,T)Xv1=x1,,Xvi1)\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 logn\log n mutually independent variables
    • Let XiX_i be mutually indpendent uniform random bits
    • Si2[k]S_i\subseteq 2^{[k]} be nonempty sets
    • Yi=jSiXjY_i=\oplus_{j\in S_i}X_j, 2k12^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: AB,A>BA\geq B,\exists A>B
    • first-order stochastic dominance (FSD): P(Ax)P(Bx),xP(Ax)>P(Bx)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 rSr\in S and check f(r)=0f(r)=0
    • false posivitve: f≢0,P(f(r)=0))dSf\not\equiv 0,P(f(r)=0))\leq\frac{d}{|S|}
  • multivariate polymonials
    • f(x1,,xn)=jijdai1,,inx1i1xninf(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
    • SFS\subseteq\mathbb{F}
    • pick r1,,rnSr_1,\cdots,r_n\in S uniformly and independently at random
    • check f(r)=0f(\overline{r})=0
  • Schwatz-Zippel Theorem: finte SF,r1,r2,,rnS\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)dSP(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 (1o(1))lnn(1-o(1))\ln n assuming that NPP\text{NP}\neq \text{P} (2014)

Greedy Algorithm

  • Algorithm
    • Initially C=C=\emptyset
    • while UU\not=\emptyset do
      • C=CargmaxiSiUC=C\cup\arg\max_i|S_i\cap U|
      • U=U\SiU = U\backslash S_i
  • approximation ratio HnlnnH_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: MUM\subseteq U that i,SiM1\forall i,|S_i\cap M|\leq 1
  • Find a maimal MM, return C={i:SiM}C=\{i:S_i\cap M\not=\emptyset\}
  • maxfreq(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: 21m2-\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: 21m2-\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