Approximation Algorithm1(近似算法(一))(Introduction to Algorithms, 算法导论,CLRS)学习笔记

这篇博客介绍了近似算法的基本概念,如近似比,并详细探讨了Vertex Cover问题和Traveling Salesperson问题的解决策略。针对Vertex Cover,算法的时间复杂度为O(∣V∣+∣E∣),而Traveling Salesperson问题通过构建最小生成树进行近似求解。此外,还讨论了Set Cover问题的贪婪算法及其证明思路。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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|)O(V+E), loop over all edges and all vertices.

  • ∣A∣|A|A: the number of edges chosen by the algorithm, and since one edge covers two vertices, so ∣A∣=∣C∣/2|A|=|C|/2A=C/2. And since this is an approximation algorithm, and at least one of vertices chosen each time must be in CCC, thus ∣C∣|C|C must be greater than the edges chosen by the algorithm.

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^*)c(T)c(H)

    • the sum of weights in Euler tour is twice the sum in MIS, since we go through each vertex twice; c(W)=2c(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)≤2c(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.

  • cx:c_x:cx: if element xxx is covered for the first time by SiS_iSi;

    cx=1∣Si−(S1∪S2∪...∪Si−1)∣c_x=\frac{1}{|S_i-(S_1\cup S_2\cup...\cup S_{i-1})|}cx

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值