Let A be the set of edges chosen in line 4 of the algorithm. Any vertex cover must cover at least one endpoint of every edge in A. Since each execution of line 4 picks an edge for which neither endpoint is yet in C and adds these two vertices to C , then we know that.
That is, C cannot be larger than twice the optimal, so is a 2-approximation algorithm for Vertex Cover. This is a common strategy in approximation proofs: we don't know the size of the optimal solution, but we can set a lower bound on the optimal solution and relate the obtained solution to this lower bound.
Can you come up with an example of a graph for which Approx-Vertex-Cover always gives a suboptimal solution? Suppose we restrict our graphs to trees. Can you give an efficient greedy algorithm that always finds an optimal vertex cover for trees in linear time?
We define the cost of such a cycle A to be the sum of the costs of edges:. In many applications e. Essentially this means that it is no more costly to go directly from u to v than it would be to go between them via a third point w. The algorithm finds a minimum spanning tree Topic 17 , and then converts this to a low cost tour:.
Suppose we are working on the graph shown below to the left. Vertices are placed on a grid so you can compute distances if you wish. The MST starting with vertex a is shown to the right. Recall from early in the semester or ICS that a preorder walk of a tree visits a vertex before visiting its children.
Starting with vertex a , the preorder walk visits vertices in order a , b , c , h , d , e , f , g. This is the basis for constructing the cycle in the center cost The optimal solution is shown to the right cost Consider the cost of the full walk W that traverses the edges of T exactly twice starting at the root. Since each edge in T is traversed twice in W :.
This walk W is not a tour because it visits some vertices more than once, but we can skip the redundant visits to vertices once we have visited them, producing the same tour H as in line 3. Instead, we will concentrate on some simple examples of algorithms for which good approximations are known, to give a feel for what approximation algorithms look like. The quality of an approximation In any combinatorial optimization problem, there is some objective function we are supposed to optimize.
The approximation ratio or approximation factor of an algorithm is the ratio between the result obtained by the algorithm and the optimal cost or profit. An algorithm with approximation ratio k is called a k-approximation algorithm; both algorithms above would be called 2-approximation algorithms.
When the approximation ratio is close to 1, it is often more useful to look at the approximation error , which is defined as the approximation ratio minus 1. So an algorithm that always got within 1.
A family of algorithms that can achieve any constant approximation error in polynomial time is called a polynomial-time approximation scheme or PTAS. Fully polynomial-time approximation schemes are the holy grail of approximation algorithms; they do not appear to exist for many problems, but when they are available, they are often almost as useful as an optimizing algorithm would be.
Proving an approximation ratio In general, proving that an algorithm gives a good approximation ratio is hard. It's not enough to prove that the algorithm's output is good which we usually know how to do ; you also have to show that the optimum is not much better. This takes us into the realm of proving lower bounds, which can be tricky when we can't figure out what the optimum should be. Most of the time a crude lower bound can be obtained from the structure of the problem see the VERTEX COVER approximation below ; occasionally the solution method also helps for example, a fractional solution to a linear program gives a lower bound on the quality of the best integer solution.
Python Pillow. Python Turtle. Verbal Ability. Interview Questions. Company Questions. Artificial Intelligence. Cloud Computing. Data Science. Angular 7. Machine Learning. Data Structures. Operating System. Computer Network.
Compiler Design. Computer Organization. Discrete Mathematics. Ethical Hacking.
0コメント