Approximation Algorithm1(近似演算法(一))(Introduction to Algorithms, 演算法導論,CLRS)學習筆記
Approximation Algorithm
1. Approximation ratio
Cost: the size of the solution, for example, in vertex cover, it’s the size of the cover; in TSP, it’s the total distance.
Since the approximation algorithm, the cost we have is always greater than the optimal solution.
2. Vertex Cover
-
Running time: O ( ∣ V ∣ + ∣ E ∣ ) O(|V|+|E|)
-
∣ A ∣ |A| ∣A∣: the number of edges chosen by the algorithm, and since one edge covers two vertices, so ∣ A ∣ = ∣ C ∣ / 2 |A|=|C|/2 ∣A∣=∣C∣/2. And since this is an approximation algorithm, and at least one of vertices chosen each time must be in C C
3. Traveling Salesperson
3.1 Algorithm
-
Construct a minimum spanning tree, whose sum of edge weights is as small as possible.
-
Remember to skip duplicates;
-
Proof to the theorem:
-
Since the distance in MIS is less than the distance in TSP; c ( T ) ≤ c ( H ∗ ) c(T)\le c(H^*)
-
the sum of weights in Euler tour is twice the sum in MIS, since we go through each vertex twice; c ( W ) = 2 c ( T ) c(W)=2c(T) c(W)=2c(T)
-
the sum of weight returned by the algorithm is less than the sum of Euler tour, since we will skip duplicates: c ( H ) ≤ c ( W ) c(H)\le c(W) c(H)≤c(W)
-
Above all, we have: c ( H ) ≤ 2 c ( H ∗ ) c(H)\le 2c(H^*) c(H)≤2c(H∗).
-
4. Set Cover
Find a set of subsets, which can cover the big set.
4.1 Greedy Algorithm
Intuition: each time pick the remaining largest subset, until the set is covered.
∣ X ∣ |X| ∣X∣: the size of the big set.
- c x : c_x: cx: 1 over the size of the subset
- ∑ x ∈ S i − S < i c x \sum_{x\in S_i-S_{<i}}c_x ∑x∈Si−S<icx: sum up the vertices in each subset;
- intuition: sum up the vertices in each chosen subset and sum up all the subset, it’s exactly the size of subsets returned by the algorithm