Approximation Algorithm(1) - Vertex Cover

Recently I started learning approximation algorithm to find a course on Coursera: address .

In accordance with this weekly course content, each writing a blog to summarize and share.


Week 1: Vertex Cover

Problem definition: Minimum Vertex Cover, i.e. given an undirected graph, a minimum required set of points S $ $, are such that each side has at least one vertex point in this episode.

 

Before learning courses can think of:

The brain make it their own, the minimum point of the tree cover is easy with $ O (| V |) $ time is given by:

1. Dynamic Programming: $ dp [v] [0/1] $ said minimum number of points required to be covered with V $ $ subtree rooted at the second dimension $ 0 / V 1 $ $ $ represents its parent node, and whether between the sides have been covered, consider the transfer point $ v $ option is not selected, the fruit of the tree can be transferred.

2. greedy: a leaf node from consideration, each leaf node and its father's side must be covered in order to cover this edge is clearly inferior to the election leaf node also selected its father. So long as the node in depth-sorted in descending order, considered in turn, if the edge between the current node and its father, uncovered, on the choice of its father.

 

Algorithms and Data Structures class in terms of the method of local search. 

 

 

Course content:

FIG minimum point is typically covered NP-Hard proved leaving the pit.

Vertex Cover to Integer Linear Programming:

$ | V | $ a $ 0 / $ 1 variable corresponding to each tap is not selected, $ | E | $ conditions, each edge represents must be covered, the objective function is $ \ sum {x_i} $, if each points a little right, it should be $ \ sum {w_i x_i} $

So how inequality is expressed with a certain edge must be covered by it? Suppose the endpoint of an edge and are $ U $ $ v $, the corresponding condition $ x_u + x_v \ geq 1 $, i.e. $ x_u, x_v $ a is at least $ 1 $.

 

However integer linear programming and no polynomial algorithm, but there is a polynomial algorithm for linear programming real number.

idea: to relax the conditions allow $ x_i $ is not an integer, but need to meet the $ x_i \ in [0, 1] $. Practice with real number linear programming, optimal solution $ X '$ In this condition, the optimal solution in some way transformed into the original linear programming optimal solution $ X $.

solution: Solutions of the real linear program to do a "rounding", and even if $ x_i = [x_i '\ geq 0.5] $.

correctness proof: We also need to prove that the resulting solution is indeed a point of covering that for any edge $ <u, v> $, need to meet the $ x_u + x_v \ ge 1 $ $ x_u + x_v \ ge 1 $ proof. simply because $ x_u '+ x_v' \ ge 1 $, then the $ x_u ', x_v' $ least a $ \ geq 0.5 $, so $ x_u, x_v $ a is at least $ 1 $.   

 

 

Results of the assessment:

Consider first a four-membered ring, each point equal right to the point, the optimal solution is obviously only need two points. However, real numbers obtained a linear programming optimal solution would be $ x_1 '= x_2' = x_3 '= x_4' = 0.5 $, after rounding $ x_1 = x_2 = x_3 = x_4 = 1 $. Optimal solution is 2 times .

So $ Appromation \ ratio \ geq 2 $

Observation: $ x_i \ leq 2x_i '$ Therefore $ W (X) \ leq 2W (X.') $, And $ X '$ is the optimal solution after the relaxation of the conditions, the optimal solution will certainly not be greater than the original problem, so there are $ W (X) \ leq 2W (X ') \ leq 2OPT $.

In sum $ Appromation \ ratio = 2. $

 

 

Exercise: pdf Download

 

The official did not provide an answer, the following is my personal answer:

Exercises 1. Analyze the following algorithm:

Algorithm: obtaining a maximum matching graph (acm do ships competition when contacted with blooms FIG maximum matching algorithm, a maximum matching in general can be solved in polynomial time graph), and then the two sides of the matching endpoints added point set covering.

 

Proof of correctness: as long as each side will be proved that the obtained set of points covered. The assumption of an edge is not covered, then the two endpoints of this edge is not equipped point, then put the match while adding +1 lets several matches, and maximum matching contradiction.

近似度证明: 因为匹配边之间没有公共点,所以$OPT \geq 匹配数 = \frac{1}{2}求出的点集大小$, 即$求出的点集大小 \leq 2 OPT$。  再看看这个上界能不能达到:还是考虑一个四元环,最大匹配数是2,因此求出的点集大小是4, 而最优解显然是2,恰好是2倍关系。  因此这个算法近似度就是2.

 

 

习题2: 给出一个无向图,要删除最少的点,使得剩下的点构成的图不含三元环。

 

从线性规划的角度考虑,每个点删还是不删对应一个$0/1$变量,每个原图中的三元环$<a, b, c>$对应一个条件$x_a +x_b + x_c \geq 1$.

同样地,考虑把实数解改造成整数解,需要做一个rounding。 显然应该令$x_i = [x_i' \geq \frac{1}{3}]$.

类似上面最小点覆盖的证明,$x_i \leq 3x_i'$, 可以推出这样求出的答案不超过最优解的3倍。.  

同时这个上界也很容易达到,只要考虑一个三元环,线性规划实数解会求出一个最优解是$x_1' = x_2' = x_3' = \frac{1}{3}$, rounding 一下变成$x_1 = x_2 = x_3 = 1$, 答案是3, 而最优解只要随便删掉1个点就好了,因此3倍的上界是可以达到的。

 

 

 

互评作业: pdf下载

分析下面的算法。

首先补充一点,最小点覆盖问题的实数线性规划,一定存在某个最优解,任意$x_i$满足$x_i \in \{0, \frac{1}{2}, 1\}$ (half-integrality)。

证明:

只要证明任意最优解一定可以调整为上面的形式。

假设求出一个最优解是$\{x_i\}$.

取足够小的$\epsilon$, 构造新的解$\{y_i\}$:

$\begin{equation}
y_i = \left\{
\begin{array}{**lr**}
x_i, & x_i \in \{0, 0.5, 1\}\\
x_i+ \epsilon, & 0\lt x_i\lt 0.5\\
x_i - \epsilon, & 0.5\lt x_i\lt 1 &
\end{array}
\right. \end{equation}$

以及$\{z_i\}$

$\begin{equation} 
z_i = \left\{ 
\begin{array}{**lr**} 
x_i, & x_i \in \{0, 0.5, 1\}\\ 
x_i - \epsilon, & 0\lt x_i\lt 0.5\\ 
x_i + \epsilon, & 0.5\lt x_i\lt 1 & 
\end{array} 
\right. \end{equation}$

check一下容易发现$\{y_i\}, \{z_i\}$也是线性规划的解。

因为$\{x_i\}$是最优解,所以有$\sum{w_ix_i} \leq \sum{w_iy_i}, \sum{w_ix_i} \leq \sum{w_iz_i}$

又有$\sum{w_iy_i} + \sum{w_iz_i} = 2 \sum{w_ix_i}$.

因此$\sum{w_ix_i} = \sum{w_iy_i} = \sum{w_iz_i}$, 即$\{y_i\}, \{z_i\}$也是最优解。

考虑$\epsilon$从0开始不断变大,直到本来不是0,0.5,1的某个变量变成了0,0.5,1, 称这样的操作为一次松弛操作。

不断重复这个过程,最终所有变量都会变成0或者0.5或者1.  因为变量一旦变成了0,0.5,1,就再也不会改变它。所以最多只需要重复 $|V|$次松弛操作。

综上,我们可以在多项式时间内把任意最优解改造成任意$x_i$满足$x_i \in \{0, \frac{1}{2}, 1\}$的形式。

 

 

考虑一个可以四染色的图,下面给出一个近似度为$\frac{3}{2}$的点覆盖算法。

算法流程:

1. 将图四染色。

2. 做一次实数线性规划,并把解改造成任意$x_i$满足$x_i \in \{0, \frac{1}{2}, 1\}$的形式。

3. 将所有$x_i = 1$的点加入答案集合$S$.

4. 将所有$x_i = \frac{1}{2}$的点,按照颜色分类,并按权值和排序。即按颜色分成$V_0^{\frac{1}{2}}, V_1^{\frac{1}{2}}, V_2^{\frac{1}{2}}, V_3^{\frac{1}{2}}$四个集合,

满足$W(V_0^{\frac{1}{2}}) \leq W(V_1^{\frac{1}{2}}) \leq W(V_2^{\frac{1}{2}})  \leq W(V_3^{\frac{1}{2}}) $

5. 将$V_0^{\frac{1}{2}}, V_1^{\frac{1}{2}}, V_2^{\frac{1}{2}}$加入答案集合$S$.

 

正确性证明:

考虑边$<u, v>$, $x_u+x_v \geq 1$.

1. 如果$x_u, x_v$有一个为1,那么那个点在$S$中,这条边被覆盖。

2. 如果$x_u, x_v$有一个为0,另一个肯定为1,那么那个点在$S$中,这条边被覆盖。

3. 剩下一种$x_u = x_v = \frac{1}{2}$的情况。因为它们相邻,所以颜色不同,因此不会都在$V_3^{\frac{1}{2}}$里,所以至少有一个点在$S$中。

 

近似度证明:

Guess you like

Origin www.cnblogs.com/vb4896/p/11234568.html