Problems
Min-Cut ∈ P \in\text{P} ∈ P
Max-Cut ∈ NPH \in\text{NPH} ∈ NPH
Polynomial Identity Testing (univariate) ∈ \in ∈ co-NPH \text{NPH} NPH
Input: a polynomial f ∈ F [ x ] f\in\mathbb{F}[x] f ∈ F [ x ] of degree d d d
Determine whether f ≡ 0 f\equiv0 f ≡ 0
PIT:
Input: two n n n -variate polynomials f , g ∈ F [ x 1 , x 2 , ⋯ , x n ] f,g\in\mathbb{F}[x_1,x_2,\cdots,x_n] f , g ∈ F [ x 1 , x 2 , ⋯ , x n ] of degree d d d
Determine: f ≡ g f\equiv g f ≡ g
Set Cover ∈ NPH \in\text{NPH} ∈ NPH :
Input: m m m subsets S 1 , ⋯ , S m ⊆ U S_1,\cdots,S_m\subseteq U S 1 , ⋯ , S m ⊆ U of a universe of size n n n
Output: C ⊆ { 1 , 2 , ⋯ , m } C\subseteq\{1,2,\cdots, m\} C ⊆ { 1 , 2 , ⋯ , m } such that U = ⋃ i ∈ C S i U=\bigcup_{i\in C}S_i U = ⋃ i ∈ C S i
freq ( x ) = ∣ { i ∣ x ∈ S i } ∣ \text{freq}(x)=|\{i|x\in S_i\}| freq ( x ) = ∣ { i ∣ x ∈ S i } ∣
Hitting Set Problem ∈ NPH \in\text{NPH} ∈ NPH
Input: n n n subsets S 1 , ⋯ , S m ⊆ U S_1,\cdots,S_m\subseteq U S 1 , ⋯ , S m ⊆ U of a universe of size m m m
Output C ⊆ U C\subseteq U C ⊆ U that C C C intersects with every set S i S_i S i
freq ( x ) = ∣ S i ∣ \text{freq}(x)=|S_i| freq ( x ) = ∣ S i ∣
equivalent to Set Cover
Vertex Cover Problem ∈ NPH \in\text{NPH} ∈ NPH
Input: an undirect graph G ( V , E ) G(V,E) G ( V , E )
Output: the smallest C ⊆ V C\subseteq V C ⊆ V such that ∀ e ∈ E \forall e\in E ∀ e ∈ E is incident to at least one vertex in C C C
set cover with frequency 2 2 2
Minimum Makespan on Identical Parallel Machine ∈ NPH \in\text{NPH} ∈ NPH
Input: n n n positive integers p 1 , p 2 , ⋯ , p n p_1,p_2,\cdots,p_n p 1 , p 2 , ⋯ , p n nad a positive integer m m m
Output: an assignment σ : [ n ] → [ m ] \sigma:[n]\rightarrow[m] σ : [ n ] → [ m ] which minimizes C max = max i ∈ [ m ] ∑ j : i = σ ( j ) p j C_{\max}=\max_{i\in [m]}\sum_{j:i=\sigma(j)}p_j C m a x = max i ∈ [ m ] ∑ j : i = σ ( j ) p j
Partition Problem ∈ NPH \in\text{NPH} ∈ NPH
Input: S = { x 1 , ⋯ , x n } S=\{x_1,\cdots,x_n\} S = { x 1 , ⋯ , x n }
Output: Whether there is a partition of S S S into A A A and B B B such that ∑ x ∈ A x = ∑ x ∈ B x \sum_{x\in A}x=\sum_{x\in B}x ∑ x ∈ A x = ∑ x ∈ B x
算法设计
P \text{P} P : Randomize to accelerate
NPH \text{NPH} NPH
sampling: random approximation
greedy/local search: approximation
Min-Cut
Deterministic Algorithm
Max-flow min-cut Theory: ( ∣ V ∣ − 1 ) × (|V|-1)\times ( ∣ V ∣ − 1 ) × max-flow time
Stoer–Wagner Algorithm(multi-graphs): O ( E V + V 2 log V ) O(EV+V^2\log V) O ( E V + 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} ZPP
Running time: O ( V 2 ) O(V^2) O ( V 2 )
P c = 2 V ( V − 1 ) P_c=\frac{2}{V(V-1)} P c = V ( V − 1 ) 2
w.h.p: O ( V 2 log V ) O(V^2\log 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 ≥ V C 2 E\geq\frac{VC}{2} E ≥ 2 V C , min-cut C C C
p i = 1 − C E i ≥ 1 − 2 V i p_i=1-\frac{C}{E_i}\geq 1-\frac{2}{V_i} p i = 1 − E i C ≥ 1 − V i 2
p correct ≥ P C = ∏ i = 1 n − 2 P ( e i ∉ C ∣ ∀ j < i , e j ∉ C ) ≥ ∏ i = 1 n − 2 ( 1 − 2 n − i + 1 ) = ∏ i = 3 n i − 2 i = 2 n ( 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)} p correct ≥ P C = ∏ i = 1 n − 2 P ( e i ∈ C ∣∀ j < i , e j ∈ C ) ≥ ∏ i = 1 n − 2 ( 1 − n − i + 1 2 ) = ∏ i = 3 n i i − 2 = n ( n − 1 ) 2
Fast Min-Cut Algorithm
Karger's Algorithm improved by recursion(1996)
Running time: O ( V 2 log V ) O(V^2\log V) O ( V 2 log V )
P c = Ω ( 1 log V ) P_c=\Omega(\frac{1}{\log V}) P c = Ω ( l o g V 1 )
w.h.p: run O ( log 2 V ) O(\log^2V) O ( log 2 V ) 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): P survive = t ( t − 1 ) n ( n − 1 ) P_{\text{survive}}=\frac{t(t-1)}{n(n-1)} P survive = n ( n − 1 ) t ( t − 1 )
t = ⌈ 1 + n 2 ⌉ , P ≥ 1 2 t=\lceil 1+\frac{n}{\sqrt{2}}\rceil,P\geq \frac{1}{2} t = ⌈ 1 + 2 n ⌉ , P ≥ 2 1
P correct ≥ 1 − ( 1 − 1 2 p ( ⌈ 1 + n 2 ⌉ ) ) 2 P_{\text{correct}}\geq 1-(1-\frac{1}{2}p(\lceil 1+\frac{n}{\sqrt{2}}\rceil))^2 P correct ≥ 1 − ( 1 − 2 1 p (⌈ 1 + 2 n ⌉) ) 2
T ( n ) = 2 T ( ⌈ 1 + n 2 ⌉ ) + O ( n 2 ) T(n)=2T(\lceil 1+\frac{n}{\sqrt{2}}\rceil)+O(n^2) T ( n ) = 2 T (⌈ 1 + 2 n ⌉) + O ( n 2 )
T ( n ) = O ( n 2 log 2 n ) T(n)=O(n^2\log_2n) T ( n ) = O ( n 2 log 2 n )
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 = 1 n ( ∣ E ( S i , { v i } ) ∣ + ∣ E ( T i , { v i } ) ∣ ) |E|=\sum_{i=1}^n(|E(S_i,\{v_i\})|+|E(T_i,\{v_i\})|) ∣ E ∣ = ∑ i = 1 n ( ∣ E ( S i , { v i }) ∣ + ∣ E ( T i , { v i }) ∣ )
SOLG = ∑ i = 1 n max ( ∣ E ( S i , { v i } ) ∣ , ∣ E ( T i , { v i } ) ∣ ) ≥ 1 2 E ≥ 1 2 _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} G = ∑ i = 1 n max ( ∣ E ( S i , { v i }) ∣ , ∣ E ( T i , { v i }) ∣ ) ≥ 2 1 E ≥ 2 1 OPTG _G G
best known approximation ratio α ∗ ≈ 0.878 \alpha^*\approx 0.878 α ∗ ≈ 0.878 (best if assuming unique game conjecture)
Derandomization from Average Case
Randomized Algorithm: uniform and independent random bit X v ∈ { 0 , 1 } X_v\in\{0,1\} X v ∈ { 0 , 1 }
E ( ∣ E ( S , T ) ∣ ) = ∑ u v ∈ E E ( I ( X u ≠ X v ) ) = ∑ u v ∈ E P ( X u ≠ X v ) = ∣ E ∣ 2 ≥ OPT G 2 \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} E ( ∣ E ( S , T ) ∣ ) = ∑ uv ∈ E E ( I ( X u = X v )) = ∑ uv ∈ E P ( X u = X v ) = 2 ∣ E ∣ ≥ 2 OPT G
Probablistic method: ∃ ≥ OPT G 2 \exists \geq\frac{\text{OPT}_G}{2} ∃ ≥ 2 OPT G
solution space: O ( 2 n ) O(2^n) O ( 2 n )
Derandomization by Monotone Path: OPT G 2 ≤ E ( E ( S , T ) ) ≤ ⋯ ≤ E ( E ( S , T ) ∣ X v 1 = x 1 , ⋯ , X v i − 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 2 OPT G ≤ E ( E ( S , T )) ≤ ⋯ ≤ E ( E ( S , T ) ∣ X v 1 = x 1 , ⋯ , X v i − 1 ) ≤ ⋯
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 n n n pairwise independent variables from log n \log n log n mutually independent variables
Let X i X_i X i be mutually indpendent uniform random bits
S i ⊆ 2 [ k ] S_i\subseteq 2^{[k]} S i ⊆ 2 [ k ] be nonempty sets
Y i = ⊕ j ∈ S i X j Y_i=\oplus_{j\in S_i}X_j Y i = ⊕ j ∈ S i X j , 2 k − 1 2^k-1 2 k − 1 pairwise independent varibles Y i Y_i Y i
Randomized Algorithm: X v X_v X v only need to be pairwise independent
solution space: O ( n 2 ) O(n^2) 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 G 1 G_1 G 1 and G 2 G_2 G 2 share same randomness
stochastic dominance: partial orders of random variable
Statewise dominance: A ≥ B , ∃ A > B A\geq B,\exists A>B A ≥ B , ∃ A > B
first-order stochastic dominance (FSD): P ( A ≥ x ) ≥ P ( B ≥ x ) , ∃ x P ( A ≥ x ) > P ( B ≥ x ) P(A\geq x)\geq P(B\geq x),\exists xP(A\geq x)>P(B\geq x) P ( A ≥ x ) ≥ P ( B ≥ x ) , ∃ x P ( A ≥ x ) > P ( B ≥ x )
Polynomial Identity Testing
Naive Randomized Algorithm for Univariate: co-RP \text{RP} RP
pick r ∈ S r\in S r ∈ S and check f ( r ) = 0 f(r)=0 f ( r ) = 0
false posivitve: f ≢ 0 , P ( f ( r ) = 0 ) ) ≤ d ∣ S ∣ f\not\equiv 0,P(f(r)=0))\leq\frac{d}{|S|} f ≡ 0 , P ( f ( r ) = 0 )) ≤ ∣ S ∣ d
multivariate polymonials
f ( x 1 , ⋯ , x n ) = ∑ ∑ j i j ≤ d a i 1 , ⋯ , i n x 1 i 1 ⋯ x n i n f(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} f ( x 1 , ⋯ , x n ) = ∑ ∑ j i j ≤ d a i 1 , ⋯ , i n x 1 i 1 ⋯ x n i n
total degree: i 1 + ⋯ + i n i_1+\cdots+i_n i 1 + ⋯ + i n
sum of monomials: # of coefficients ( n + d d ) ≤ ( n + d ) d {n+d\choose d}\leq (n+d)^d ( d n + d ) ≤ ( n + d ) d
product form: expend is expensive but evaluate is efficient
Randomized Algorithm
S ⊆ F S\subseteq\mathbb{F} S ⊆ F
pick r 1 , ⋯ , r n ∈ S r_1,\cdots,r_n\in S r 1 , ⋯ , r n ∈ S uniformly and independently at random
check f ( r ‾ ) = 0 f(\overline{r})=0 f ( r ) = 0
Schwatz-Zippel Theorem: finte ∀ S ⊂ F , r 1 , r 2 , ⋯ , r n ∈ S \forall S\subset\mathbb{F},r_1,r_2,\cdots,r_n\in S ∀ S ⊂ F , r 1 , r 2 , ⋯ , r n ∈ S choosed uniformly and independently at random, P ( f ( r 1 , r 2 , ⋯ , r n ) = 0 ) ≤ d ∣ S ∣ P(f(r_1,r_2,\cdots,r_n)=0)\leq\frac{d}{|S|} P ( f ( r 1 , r 2 , ⋯ , r n ) = 0 ) ≤ ∣ S ∣ d
Set cover
There is no poly-time algorithm with approximation ratio better than ( 1 − o ( 1 ) ) ln n (1-o(1))\ln n ( 1 − o ( 1 )) ln n assuming that NP ≠ P \text{NP}\neq \text{P} NP = P (2014)
Greedy Algorithm
Algorithm
Initially C = ∅ C=\emptyset C = ∅
while U ≠ ∅ U\not=\emptyset U = ∅ do
C = C ∪ arg max i ∣ S i ∩ U ∣ C=C\cup\arg\max_i|S_i\cap U| C = C ∪ arg max i ∣ S i ∩ U ∣
U = U \ S i U = U\backslash S_i U = U \ S i
approximation ratio H n ≈ ln n H_n\approx\ln n H n ≈ ln n
Vertex cover problem
2 2 2 -approximation
(2008) no poly-time algorithm with approximation ratio 2 − ϵ 2-\epsilon 2 − ϵ assuming UGC
Primal-Dual Algorithm
(Dual Problem) Matching: M ⊆ U M\subseteq U M ⊆ U that ∀ i , ∣ S i ∩ M ∣ ≤ 1 \forall i,|S_i\cap M|\leq 1 ∀ i , ∣ S i ∩ M ∣ ≤ 1
Find a maimal M M M , return C = { i : S i ∩ M ≠ ∅ } C=\{i:S_i\cap M\not=\emptyset\} C = { i : S i ∩ M = ∅ }
max freq ( x ) \max\text{freq}(x) max freq ( x ) -approximation algorithm
Scheduling
Graham's List algorithm
List Algorithm
for j = 1 , 2 , ⋯ , n j = 1,2,\cdots,n j = 1 , 2 , ⋯ , n : assign job j j j to the machine that currently has the smallest load
Approximation ratio: 2 − 1 m 2-\frac{1}{m} 2 − m 1
Local Search
start with a feasible solution, improve at each step by modifying locally
start with an arbitrary schedule of n n n jobs to m m m machines
while (true)
let ℓ \ell ℓ denote the job finished at last in the current schedule;
if there is machine i i i such that job ℓ \ell ℓ can finish earlier if transferred to machine i i i
job ℓ \ell ℓ transfers to machine i i i
else break;
Approximation ratio: 2 − 1 m 2-\frac{1}{m} 2 − m 1
Longest Processing Time (LPT)
Algorithm
sort p i p_i p i in non-increasing order
assign job j j j to the machine currently has the smallest load
Approximation: 4 3 \frac{4}{3} 3 4
competitive ratio: ∀ \forall ∀ input sequence I I I , SOL I ≤ α OPT I , OPT I \text{SOL}_I\leq\alpha\text{OPT}_I,\text{OPT}_I SOL I ≤ α OPT I , OPT I is the solution returned by optimal oofline algorithm