6. Introduction
An Approximate Algorithm is a way of approach NP-COMPLETENESS for the
optimization problem. This technique does not guarantee the best solution.
The goal of an approximation algorithm is to come as close as possible to the
optimum value in a reasonable amount of time which is at the most
polynomial time. Such algorithms are called approximation algorithm or
heuristic algorithm.
For the traveling salesperson problem, the optimization problem is to find the
shortest cycle, and the approximation problem is to find a short cycle.
For the vertex cover problem, the optimization problem is to find the vertex cover
with fewest vertices, and the approximation problem is to find the vertex cover
with few vertices.
7. Performance Ratios
If for any input of size n, the cost C of the
solution produced by the algorithm is
within a factor of ρ(n) of the cost C* of an
optimal solution:
Max ( C/C* , C*/C ) ≤ ρ(n)
We call this algorithm as an ρ(n)-
approximation algorithm.
8. Terminology
P: Represents an NP-Hard problem such as 0/1 Knapsack or Traveling
Salesperson Problem.
I: Represents an instance of problem P.
F*(I): Represents an optimal solution to I.
F^(I): Represents feasible solution produced for I by an approximation
algorithm.
A: Represents an algorithm that generates a feasible solution to every
instance I of a problem P.
F*(I)>F^(I) if P is a maximization problem
F^(I)>F*(I) if P is a minimization problem
9. Approximation Scheme
Absolute Approximation: A is absolute approximation
algorithm for problem P iff for every instance I of P,
|F*(I)-F^(I)|<=k for some constant k.
f(n)-Approximation: A is an f(n)-approximation
algorithm of problem P iff for every instance I of size
n, |F*(I) – F^(I) |/ F*(I) <= f(n) for F*(I) >0.
ε-Approximation: A is an epsilon (ε) approximation
algorithm of problem P iff A is f(n)-approximation
algorithm for which f(n) <=ε, where ε is some
constant.
10. Vertex Cover
The vertex-cover problem is to find a
vertex cover of minimum size in a
given undirected graph. We call such
a vertex cover an optimal vertex
cover. This problem is the
optimization version of an NP-
complete decision problem.
11. Vertex Cover
The VERTEX COVER problem is NP-hard.
VERTEX COVER
Input: An undirected graph G = (V, E).
Output: A subset of the vertices S ⊆ V
that touches every edge.
Goal: Minimize |S|.
16. Greedy-Vertex-Cover (G)
1. C={ }
2. do choose v in V with max deg
3. C = C + {v}
4. remove v
5. and every edge adjacent to v
6. until all edges are covered
7. return C
26. Vertex Cover Algorithm
Approx-Vertex-Cover (G = (V, E))
{
C = empty-set;
E'= E;
While E' is not empty do
{
Let (u, v) be any edge in E': (*)
Add u and v to C;
Remove from E' all edges incident to
u or v;
}
Return C;
}
27. C={ }
E={ (a-b), (b-c), (c-e), (c-d), (e-f), (e-d), (f-d), (d-g) }
b
a
c
e
d
f
gf
28. C={ }
E={ (a-b), (b-c), (c-e), (c-d), (e-f), (e-d), (f-d), (d-g) }
b
a
c
e
d
f
gf
34. C={ (b-c), (e-f), (d-g) }
C={ b, c, e, f, d, g }
|C|=6=2.3<=2.|C*|
the algorithm found a 2- approximation
b
a
c
e
d
f
gf
35. The traveling-salesman problem
In the traveling salesman Problem, a salesman must visits n
cities. We can say that salesman wishes to make a tour or
Hamiltonian cycle, visiting each city exactly once and finishing
at the city he starts from. There is a non-negative cost c (i, j)
to travel from the city i to city j. The goal is to find a tour of
minimum cost. We assume that every two cities are connected.
Such problems are called Traveling-salesman problem (TSP).
We can model the cities as a complete graph of n vertices,
where each vertex represents a city.
It can be shown that TSP is NPC.
36. Traveling salesman problem
Given an undirected weighted
Graph G we are to find a
minimum cost Hamiltonian cycle.
Satisfying triangle inequality or
not this problem is NP-Complete.
We can solve Hamiltonian path.
39. Traveling salesman problem with
triangle inequality.
APPROX-TSP-TOUR(G, c)
1 select a vertex r Є V[G] to be root.
2 compute a MST for G from root r using Prim
Alg.
3 L=list of vertices in preorder walk of that MST.
4 return the Hamiltonian cycle H in the order L.
41. The set-Cover
Generalization of vertex-cover problem.
We have given (X,F) :
X : a finite set of elements.
F : family of subsets of X such that every
element of X belongs to at least one subset
in F.
Solution C : subset of F that Includes all the
members of X.